QMPlay2: fix #5904

* apply fix youtube search patch from upstream
* use system youtube-dl
* fix build
This commit is contained in:
Gerasim Troeglazov
2021-05-16 23:35:51 +10:00
parent 7815d890cf
commit 36e26e65d6
2 changed files with 129 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
From fde68ff35f7d915941c387c9eb64db3f3de632a3 Mon Sep 17 00:00:00 2001
From 34dc0d642c106ca26633d731de53bf4250436b46 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 9 Mar 2021 12:01:25 +1000
Subject: Add haiku support
@@ -758,5 +758,128 @@ index 3685f2b..04bc1d4 100644
if (type == "decoders")
defaultModules << "FFmpeg Decoder";
--
2.30.0
2.30.2
From 96c5a6eae78d74dd5a3dbfe2b520cb745e073a00 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 16 May 2021 23:14:06 +1000
Subject: Remove const for fix build
diff --git a/src/qmplay2/IPC_Unix.cpp b/src/qmplay2/IPC_Unix.cpp
index bac1b16..2bc3175 100644
--- a/src/qmplay2/IPC_Unix.cpp
+++ b/src/qmplay2/IPC_Unix.cpp
@@ -98,7 +98,7 @@ bool IPCSocket::open(QIODevice::OpenMode mode)
if (m_priv->fd > 0)
{
- const unsigned long on = 1;
+ unsigned long on = 1;
ioctl(m_priv->fd, FIONBIO, &on);
m_priv->socketNotifier = new QSocketNotifier(m_priv->fd, QSocketNotifier::Read, this);
connect(m_priv->socketNotifier, SIGNAL(activated(int)), this, SLOT(socketReadActive()));
--
2.30.2
From 52aae66a0243e19c1d109bd0acfaf6fd47cbf4ef Mon Sep 17 00:00:00 2001
From: Simon Vogl <simon.vogl@gmx.net>
Date: Thu, 1 Apr 2021 21:56:04 +0000
Subject: Fix YouTube Search for QMPlay2.
This patch is required to fix QMPlay2's YouTube Search function by using an empty Cookie.
diff --git a/src/modules/Extensions/YouTube.cpp b/src/modules/Extensions/YouTube.cpp
index 78ee675..c67c343 100644
--- a/src/modules/Extensions/YouTube.cpp
+++ b/src/modules/Extensions/YouTube.cpp
@@ -501,7 +501,7 @@ void YouTube::search()
if (lastTitle != title || sender() == searchE || sender() == searchB || qobject_cast<QAction *>(sender()))
{
m_currPage = 1;
- searchReply = net.start(getYtUrl(title, m_sortByIdx));
+ searchReply = net.start(getYtUrl(title, m_sortByIdx), QByteArray(), "Cookie: \r\n");
}
else
{
@@ -886,7 +886,7 @@ void YouTube::setSearchResults(const QJsonObject &jsonObj, bool isContinuation)
{
tWI->setDisabled(true);
- auto linkReply = net.start(url);
+ auto linkReply = net.start(url, QByteArray(), "Cookie: \r\n");
linkReply->setProperty("tWI", QVariant::fromValue((void *)tWI));
linkReplies += linkReply;
}
--
2.30.2
From 6e6269e47145e20c2a5b6153e5ec2e85a96ad618 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 16 May 2021 23:34:03 +1000
Subject: Use system youtube-dl
diff --git a/src/qmplay2/YouTubeDL.cpp b/src/qmplay2/YouTubeDL.cpp
index 3319df0..8f6567f 100644
--- a/src/qmplay2/YouTubeDL.cpp
+++ b/src/qmplay2/YouTubeDL.cpp
@@ -36,9 +36,13 @@ static QMutex g_mutex(QMutex::Recursive);
QString YouTubeDL::getFilePath()
{
+#ifdef Q_OS_HAIKU
+ return "/bin/youtube-dl"
+#else
return QMPlay2Core.getSettingsDir() + "youtube-dl"
#ifdef Q_OS_WIN
".exe"
+#endif
#endif
;
}
@@ -257,6 +261,9 @@ void YouTubeDL::abort()
bool YouTubeDL::prepare()
{
+#ifdef Q_OS_HAIKU
+ return true;
+#endif
#ifdef Q_OS_ANDROID
return false;
#endif
@@ -303,6 +310,9 @@ bool YouTubeDL::prepare()
bool YouTubeDL::download()
{
+#if defined(Q_OS_HAIKU)
+ return true;
+#endif
// Mutex must be locked here
const QString downloadUrl = "https://yt-dl.org/downloads/latest/youtube-dl"
@@ -356,6 +366,9 @@ bool YouTubeDL::download()
}
bool YouTubeDL::update()
{
+#if defined(Q_OS_HAIKU)
+ return true;
+#endif
// Mutex must be locked here
qDebug() << "\"youtube-dl\" updates will be checked";
@@ -425,7 +438,7 @@ bool YouTubeDL::update()
void YouTubeDL::ensureExecutable()
{
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
if (!QFileInfo(m_ytDlPath).isExecutable())
{
QFile file(m_ytDlPath);
--
2.30.2

View File

@@ -6,7 +6,7 @@ MyFreeMP3 browser."
HOMEPAGE="http://zaps166.sourceforge.net"
COPYRIGHT="2010-2021 Błażej Szczygieł"
LICENSE="GNU GPL v3"
REVISION="2"
REVISION="3"
SOURCE_URI="https://github.com/zaps166/QMPlay2/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="5416a48de694e1fc21a1c68f7d4102b2e9386140ba04c92421815c2191dcc51a"
SOURCE_DIR="QMPlay2-$portVersion"
@@ -25,6 +25,7 @@ PROVIDES="
"
REQUIRES="
haiku${secondaryArchSuffix}
cmd:youtube_dl
lib:libass$secondaryArchSuffix
lib:libavcodec$secondaryArchSuffix
lib:libavformat$secondaryArchSuffix
@@ -42,6 +43,7 @@ REQUIRES="
lib:libswresample$secondaryArchSuffix
lib:libswscale$secondaryArchSuffix
lib:libtag$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
@@ -62,6 +64,7 @@ BUILD_REQUIRES="
devel:libswresample$secondaryArchSuffix
devel:libswscale$secondaryArchSuffix
devel:libtag$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake