Hello community,

here is the log from the commit of package QMPlay2 for openSUSE:Factory checked 
in at 2020-11-09 13:58:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/QMPlay2 (Old)
 and      /work/SRC/openSUSE:Factory/.QMPlay2.new.11331 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "QMPlay2"

Mon Nov  9 13:58:07 2020 rev:46 rq:847049 version:20.07.04

Changes:
--------
--- /work/SRC/openSUSE:Factory/QMPlay2/QMPlay2.changes  2020-08-06 
10:42:39.830136376 +0200
+++ /work/SRC/openSUSE:Factory/.QMPlay2.new.11331/QMPlay2.changes       
2020-11-09 13:59:08.631737403 +0100
@@ -1,0 +2,12 @@
+Fri Nov  6 11:30:41 UTC 2020 - Simon Vogl <simon.v...@gmx.net>
+
+- Added 0003-fix-youtube-search.patch to fix QMPlay2's YouTube search not 
working
+
+-------------------------------------------------------------------
+Mon Aug 17 21:15:29 UTC 2020 - Simon Vogl <simon.v...@gmx.net>
+
+- No longer Require python-xml as it isn't necessary
+- Require python3 as it's required to run youtube-dl
+- Added 0002-fix-broken-python-detection.patch to fix QMPlay2 always 
perferring python2 over python3 for executing youtube-dl which could cause 
youtube-dl to crash
+
+-------------------------------------------------------------------

New:
----
  0002-fix-broken-python-detection.patch
  0003-fix-youtube-search.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ QMPlay2.spec ++++++
--- /var/tmp/diff_new_pack.zyA0ci/_old  2020-11-09 13:59:09.223736112 +0100
+++ /var/tmp/diff_new_pack.zyA0ci/_new  2020-11-09 13:59:09.227736104 +0100
@@ -28,6 +28,10 @@
 Source:         
https://github.com/zaps166/QMPlay2/releases/download/%{version}/QMPlay2-src-%{version}.tar.xz
 # PATCH-FIX-UPSTREAM
 Patch1:         0001-fix-build-error-lp151.patch
+# PATCH-FIX-OPENSUSE
+Patch2:         0002-fix-broken-python-detection.patch
+# PATCH-FIX-UPSTREAM
+Patch3:         0003-fix-youtube-search.patch
 BuildRequires:  cmake >= 3.5
 BuildRequires:  gcc-c++
 BuildRequires:  ninja
@@ -64,8 +68,7 @@
 Requires(postun): shared-mime-info
 Requires(postun): update-desktop-files
 Recommends:     youtube-dl
-# Required for youtube-dl to work with QMPlay2
-Requires:       python-xml
+Requires:       python > 3.0.0
 
 %description
 QMPlay2 is a video player, it can play and stream all formats supported by

++++++ 0002-fix-broken-python-detection.patch ++++++
From: Simon Vogl <simon.v...@gmx.net>
Date: Mon, 17 Jul 2020 21:15:29 UTC
Subject: [PATCH] Fix broken python detection of QMPlay2 when it tries to launch 
youtube-dl

This patch is required to prevent QMPlay2 from always preferring python2 over 
python3 which can lead to crashes in certain cases.

--- a/src/qmplay2/YouTubeDL.cpp
+++ b/src/qmplay2/YouTubeDL.cpp
@@ -459,25 +459,9 @@
         const int idx = shebang.lastIndexOf("python");
         if (shebang.startsWith("#!") && idx > -1)
         {
-            const auto pythonCmd = shebang.mid(idx);
-            if (!QStandardPaths::findExecutable(pythonCmd).endsWith(pythonCmd))
-            {
-                QStringList pythonCmdsToCheck {
-                    "python",
-                    "python2",
-                    "python3",
-                };
-                pythonCmdsToCheck.removeOne(pythonCmd);
-                for (auto &&pythonCmd : asConst(pythonCmdsToCheck))
-                {
-                    if 
(QStandardPaths::findExecutable(pythonCmd).endsWith(pythonCmd))
-                    {
-                        args.prepend(program);
-                        program = pythonCmd;
-                        break;
-                    }
-                }
-            }
+            const auto pythonCmd = "python3";
+            args.prepend(program);
+            program = pythonCmd;
         }
         ytDlFile.close();
     }
++++++ 0003-fix-youtube-search.patch ++++++
>From 193530399a8b5167180ec5d86f8d3dc2e398729f Fri  6 11 11:30:41 2020
From: Simon Vogl <simon.v...@gmx.net>
Date: Fri,  6 Nov 2020 11:30:41 UTC
Subject: [PATCH] Fix youtube search of QMPlay2

This patch is required to fix QMPlay2's YouTube search.

--- a/src/modules/Extensions/YouTube.cpp
+++ b/src/modules/Extensions/YouTube.cpp
@@ -760,90 +760,96 @@ void YouTube::setSearchResults(const QByteArray &data)
 {
     const auto json = getYtInitialData(data);
 
-    const auto contents = json.object()
+    const auto sectionListRendererContents = json.object()
         ["contents"].toObject()
         ["twoColumnSearchResultsRenderer"].toObject()
         ["primaryContents"].toObject()
         ["sectionListRenderer"].toObject()
-        ["contents"].toArray().at(0).toObject()
-        ["itemSectionRenderer"].toObject()
         ["contents"].toArray()
     ;
 
-    for (auto &&obj : contents)
+    for (auto &&obj : sectionListRendererContents)
     {
-        const auto videoRenderer = obj.toObject()["videoRenderer"].toObject();
-        const auto playlistRenderer = 
obj.toObject()["playlistRenderer"].toObject();
-
-        const bool isVideo = !videoRenderer.isEmpty() && 
playlistRenderer.isEmpty();
-
-        QString title, contentId, length, user, publishedTime, viewCount, 
thumbnail, url;
+        const auto contents = obj.toObject()
+            ["itemSectionRenderer"].toObject()
+            ["contents"].toArray()
+        ;
 
-        if (isVideo)
+        for (auto &&obj : contents)
         {
-            title = 
videoRenderer["title"].toObject()["runs"].toArray().at(0).toObject()["text"].toString();
-            contentId = videoRenderer["videoId"].toString();
-            if (title.isEmpty() || contentId.isEmpty())
-                continue;
-
-            length = 
videoRenderer["lengthText"].toObject()["simpleText"].toString();
-            user = 
videoRenderer["ownerText"].toObject()["runs"].toArray().at(0).toObject()["text"].toString();
-            publishedTime = 
videoRenderer["publishedTimeText"].toObject()["simpleText"].toString();
-            viewCount = 
videoRenderer["shortViewCountText"].toObject()["simpleText"].toString();
-            thumbnail = 
videoRenderer["thumbnail"].toObject()["thumbnails"].toArray().at(0).toObject()["url"].toString();
+            const auto videoRenderer = 
obj.toObject()["videoRenderer"].toObject();
+            const auto playlistRenderer = 
obj.toObject()["playlistRenderer"].toObject();
 
-            url = YOUTUBE_URL "/watch?v=" + contentId;
-        }
-        else
-        {
-            title = 
playlistRenderer["title"].toObject()["simpleText"].toString();
-            contentId = playlistRenderer["playlistId"].toString();
-            if (title.isEmpty() || contentId.isEmpty())
-                continue;
+            const bool isVideo = !videoRenderer.isEmpty() && 
playlistRenderer.isEmpty();
 
-            user = 
playlistRenderer["longBylineText"].toObject()["runs"].toArray().at(0).toObject()["text"].toString();
-            thumbnail = playlistRenderer
-                ["thumbnailRenderer"].toObject()
-                ["playlistVideoThumbnailRenderer"].toObject()
-                ["thumbnail"].toObject()
-                ["thumbnails"].toArray().at(0).toObject()
-                ["url"].toString()
-            ;
+            QString title, contentId, length, user, publishedTime, viewCount, 
thumbnail, url;
 
-            url = YOUTUBE_URL "/playlist?list=" + contentId;
-        }
+            if (isVideo)
+            {
+                title = 
videoRenderer["title"].toObject()["runs"].toArray().at(0).toObject()["text"].toString();
+                contentId = videoRenderer["videoId"].toString();
+                if (title.isEmpty() || contentId.isEmpty())
+                    continue;
+
+                length = 
videoRenderer["lengthText"].toObject()["simpleText"].toString();
+                user = 
videoRenderer["ownerText"].toObject()["runs"].toArray().at(0).toObject()["text"].toString();
+                publishedTime = 
videoRenderer["publishedTimeText"].toObject()["simpleText"].toString();
+                viewCount = 
videoRenderer["shortViewCountText"].toObject()["simpleText"].toString();
+                thumbnail = 
videoRenderer["thumbnail"].toObject()["thumbnails"].toArray().at(0).toObject()["url"].toString();
+
+                url = YOUTUBE_URL "/watch?v=" + contentId;
+            }
+            else
+            {
+                title = 
playlistRenderer["title"].toObject()["simpleText"].toString();
+                contentId = playlistRenderer["playlistId"].toString();
+                if (title.isEmpty() || contentId.isEmpty())
+                    continue;
+
+                user = 
playlistRenderer["longBylineText"].toObject()["runs"].toArray().at(0).toObject()["text"].toString();
+                thumbnail = playlistRenderer
+                    ["thumbnailRenderer"].toObject()
+                    ["playlistVideoThumbnailRenderer"].toObject()
+                    ["thumbnail"].toObject()
+                    ["thumbnails"].toArray().at(0).toObject()
+                    ["url"].toString()
+                ;
+
+                url = YOUTUBE_URL "/playlist?list=" + contentId;
+            }
 
-        auto tWI = new QTreeWidgetItem(resultsW);
+            auto tWI = new QTreeWidgetItem(resultsW);
 
-        tWI->setText(0, title);
-        tWI->setText(1, isVideo ? length : tr("Playlist"));
-        tWI->setText(2, user);
+            tWI->setText(0, title);
+            tWI->setText(1, isVideo ? length : tr("Playlist"));
+            tWI->setText(2, user);
 
-        QString tooltip;
-        tooltip += QString("%1: %2\n").arg(resultsW->headerItem()->text(0), 
tWI->text(0));
-        tooltip += QString("%1: %2\n").arg(isVideo ? 
resultsW->headerItem()->text(1) : tr("Playlist"), isVideo ? tWI->text(1) : 
tr("yes"));
-        tooltip += QString("%1: %2\n").arg(resultsW->headerItem()->text(2), 
tWI->text(2));
-        tooltip += QString("%1: %2\n").arg(tr("Published time"), 
publishedTime);
-        tooltip += QString("%1: %2").arg(tr("View count"), viewCount);
-        tWI->setToolTip(0, tooltip);
+            QString tooltip;
+            tooltip += QString("%1: 
%2\n").arg(resultsW->headerItem()->text(0), tWI->text(0));
+            tooltip += QString("%1: %2\n").arg(isVideo ? 
resultsW->headerItem()->text(1) : tr("Playlist"), isVideo ? tWI->text(1) : 
tr("yes"));
+            tooltip += QString("%1: 
%2\n").arg(resultsW->headerItem()->text(2), tWI->text(2));
+            tooltip += QString("%1: %2\n").arg(tr("Published time"), 
publishedTime);
+            tooltip += QString("%1: %2").arg(tr("View count"), viewCount);
+            tWI->setToolTip(0, tooltip);
 
-        tWI->setData(0, Qt::UserRole, url);
-        tWI->setData(1, Qt::UserRole, !isVideo);
+            tWI->setData(0, Qt::UserRole, url);
+            tWI->setData(1, Qt::UserRole, !isVideo);
 
-        if (!isVideo)
-        {
-            tWI->setDisabled(true);
+            if (!isVideo)
+            {
+                tWI->setDisabled(true);
 
-            auto linkReply = net.start(url);
-            linkReply->setProperty("tWI", QVariant::fromValue((void *)tWI));
-            linkReplies += linkReply;
-        }
+                auto linkReply = net.start(url);
+                linkReply->setProperty("tWI", QVariant::fromValue((void 
*)tWI));
+                linkReplies += linkReply;
+            }
 
-        if (!thumbnail.isEmpty())
-        {
-            auto imageReply = net.start(thumbnail);
-            imageReply->setProperty("tWI", QVariant::fromValue((void *)tWI));
-            imageReplies += imageReply;
+            if (!thumbnail.isEmpty())
+            {
+                auto imageReply = net.start(thumbnail);
+                imageReply->setProperty("tWI", QVariant::fromValue((void 
*)tWI));
+                imageReplies += imageReply;
+            }
         }
     }
 
@@ -1048,7 +1054,7 @@ void YouTube::preparePlaylist(const QByteArray &data, 
QTreeWidgetItem *tWI)
     {
         const auto playlistRenderer = 
obj.toObject()["playlistVideoRenderer"].toObject();
 
-        const auto title = 
playlistRenderer["title"].toObject()["simpleText"].toString();
+        const auto title = 
playlistRenderer["title"].toObject()["runs"].toArray().at(0).toObject()["text"].toString();
         const auto videoId = playlistRenderer["videoId"].toString();
         if (title.isEmpty() || videoId.isEmpty())
             continue;
@@ -1080,7 +1086,7 @@ QJsonDocument YouTube::getYtInitialData(const QByteArray 
&data)
     if (idx2 < 0)
         return QJsonDocument();
 
-    auto jsonData = data.mid(idx, idx2 - idx);
+    auto jsonData = data.mid(idx, idx2 - idx).trimmed();
     if (jsonData.endsWith(';'))
         jsonData.chop(1);
 

Reply via email to