Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package QMPlay2 for openSUSE:Factory checked 
in at 2026-11-18 18:30:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/QMPlay2 (Old)
 and      /work/SRC/openSUSE:Factory/.QMPlay2.new.1251 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "QMPlay2"

Wed Nov 18 18:30:23 2026 rev:102 rq:1398229 version:26.08.02

Changes:
--------
--- /work/SRC/openSUSE:Factory/QMPlay2/QMPlay2.changes  2026-08-02 
23:15:06.517685106 +0200
+++ /work/SRC/openSUSE:Factory/.QMPlay2.new.1251/QMPlay2.changes        
2026-11-18 18:31:04.811646751 +0100
@@ -1,0 +2,6 @@
+Tue Nov 17 16:36:29 UTC 2026 - Simon Vogl <[email protected]>
+
+- Add 0002-fix-youtube-streams.patch to allow QMPlay2 to wait for
+  YouTube streams when using yt-dlp
+
+-------------------------------------------------------------------

New:
----
  0002-fix-youtube-streams.patch

----------(New B)----------
  New:
- Add 0002-fix-youtube-streams.patch to allow QMPlay2 to wait for
  YouTube streams when using yt-dlp
----------(New E)----------

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

Other differences:
------------------
++++++ QMPlay2.spec ++++++
--- /var/tmp/diff_new_pack.rl9WhA/_old  2026-11-18 18:31:05.996696956 +0100
+++ /var/tmp/diff_new_pack.rl9WhA/_new  2026-11-18 18:31:05.997696998 +0100
@@ -32,6 +32,8 @@
 Source:         %{name}-%{version}.%{_mtime}.%{_commit}.tar.gz
 # PATCH-FEATURE-OPENSUSE 0001-add-opensuse-customizations.patch -- Fix python 
executable detection and add branding
 Patch1:         0001-add-opensuse-customizations.patch
+# PATCH-FIX-UPSTREAM 0002-fix-youtube-streams.patch -- Fix YouTube stream 
waiting for yt-dlp
+Patch2:         0002-fix-youtube-streams.patch
 BuildRequires:  clang
 BuildRequires:  cmake >= 3.16
 BuildRequires:  lld
@@ -80,10 +82,7 @@
 BuildRequires:  pkgconfig(libswscale) >= 5.1.100
 BuildRequires:  pkgconfig(libva)
 BuildRequires:  pkgconfig(portaudio-2.0)
-# Enable rubberband support on openSUSE Tumbleweed and openSUSE Leap 15.5, 
SLE15SP5+
-%if 0%{?suse_version} >= 1699 || 0%{?sle_version} >= 150500
 BuildRequires:  pkgconfig(rubberband) >= 3.0.0
-%endif
 BuildRequires:  pkgconfig(shaderc)
 BuildRequires:  pkgconfig(taglib) >= 1.9
 BuildRequires:  pkgconfig(vdpau)

++++++ 0002-fix-youtube-streams.patch ++++++
diff --git a/src/modules/Extensions/YouTube.cpp 
b/src/modules/Extensions/YouTube.cpp
index 2812302f..c2ee6173 100644
--- a/src/modules/Extensions/YouTube.cpp
+++ b/src/modules/Extensions/YouTube.cpp
@@ -20,11 +20,13 @@
 
 #include <YouTubeDL.hpp>
 #include <LineEdit.hpp>
+#include <Functions.hpp>
 
 #include <QLoggingCategory>
 #include <QStringListModel>
 #include <QDesktopServices>
 #include <QJsonParseError>
+#include <QDeadlineTimer>
 #include <QActionGroup>
 #include <QTextDocument>
 #include <QJsonDocument>
@@ -37,6 +39,7 @@
 #include <QJsonArray>
 #include <QCompleter>
 #include <QClipboard>
+#include <QDateTime>
 #include <QMimeData>
 #include <QSpinBox>
 #include <QAction>
@@ -1271,6 +1274,8 @@ QStringList YouTube::getYouTubeVideo(const QString 
&param, const QString &url, I
 
     QHash<int, QPair<QStringList, QStringList>> itagsData;
 
+    double timeToWait = 0.0;
+
     for (auto &&formatVal : formats)
     {
         const auto format = formatVal.toObject();
@@ -1298,6 +1303,13 @@ QStringList YouTube::getYouTubeVideo(const QString 
&param, const QString &url, I
                 urlLanguages[url] = 
format[QStringLiteral("language")].toString();
                 urlNotes[url] = note;
             }
+            if (format.contains(QStringLiteral("available_at")))
+            {
+                if (const auto availableAt = 
format[QStringLiteral("available_at")].toDouble(); qIsFinite(availableAt))
+                {
+                    timeToWait = qMax(timeToWait, availableAt - 
QDateTime::currentMSecsSinceEpoch() / 1000.0);
+                }
+            }
         }
     }
 
@@ -1436,6 +1448,24 @@ QStringList YouTube::getYouTubeVideo(const QString 
&param, const QString &url, I
 
     result += o["description"].toString();
 
+    // Wait the number of seconds until the stream is promised to be available
+    if (timeToWait > 0.0)
+    {
+        const auto timeToWaitMs = qRound64((timeToWait + 1.0) * 1e3); // Add 
1s to be sure the time has elapsed on the server
+        const auto waitMsg = tr("Waiting %1 s as required by the 
stream").arg(qRound(timeToWaitMs / 1e3));
+        emit QMPlay2Core.statusBarMessage(waitMsg, timeToWaitMs);
+        qCDebug(youtube) << waitMsg;
+        QDeadlineTimer dt(timeToWaitMs);
+        do
+        {
+            if (youTubeDL.isAborted())
+            {
+                emit QMPlay2Core.statusBarMessage(QString(), 0);
+                break;
+            }
+            Functions::s_wait(qMin(0.1, dt.remainingTime() / 1e3));
+        } while (dt.remainingTime() > 0);
+    }
     return result;
 }
 

Reply via email to