From c28a97c973bd1490da3eb1c49b4df724280e39a7 Mon Sep 17 00:00:00 2001
From: Bart Ribbers <bribbers@disroot.org>
Date: Thu, 30 Sep 2021 21:56:39 +0200
Subject: [PATCH] testing/haruna: fix mpris video title

---
 ...nly-show-filename-if-theres-no-title.patch | 37 +++++++++++++++++++
 testing/haruna/APKBUILD                       |  7 +++-
 2 files changed, 42 insertions(+), 2 deletions(-)
 create mode 100644 testing/haruna/0001-Fixmpris-only-show-filename-if-theres-no-title.patch

diff --git a/testing/haruna/0001-Fixmpris-only-show-filename-if-theres-no-title.patch b/testing/haruna/0001-Fixmpris-only-show-filename-if-theres-no-title.patch
new file mode 100644
index 000000000000..398df6d669a6
--- /dev/null
+++ b/testing/haruna/0001-Fixmpris-only-show-filename-if-theres-no-title.patch
@@ -0,0 +1,37 @@
+From 82f73fd89bbb37d703fc387f5249471f0ff7bd45 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?George=20Florea=20B=C4=83nu=C8=99?= <georgefb899@gmail.com>
+Date: Thu, 30 Sep 2021 19:30:28 +0300
+Subject: [PATCH] fix(mpris): only show filename if there's no title
+
+BUG: 443157
+---
+ src/mpris2/mediaplayer2player.cpp | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/src/mpris2/mediaplayer2player.cpp b/src/mpris2/mediaplayer2player.cpp
+index ac13726..ca34d7c 100644
+--- a/src/mpris2/mediaplayer2player.cpp
++++ b/src/mpris2/mediaplayer2player.cpp
+@@ -125,12 +125,15 @@ QVariantMap MediaPlayer2Player::Metadata()
+                     m_mpv->getProperty("duration").toDouble() * 1000 * 1000);
+     metadata.insert(QStringLiteral("mpris:trackid"),
+                     QVariant::fromValue<QDBusObjectPath>(QDBusObjectPath("/org/kde/haruna")));
+-    metadata.insert(QStringLiteral("xesam:title"),
+-                    m_mpv->getProperty("filename").toString());
++
++    auto mpvMediaTitle = m_mpv->getProperty("media-title").toString();
++    auto mpvFilename = m_mpv->getProperty("filename").toString();
++    auto title = mpvMediaTitle.isEmpty() || mpvMediaTitle.isNull() ? mpvFilename : mpvMediaTitle;
++    metadata.insert(QStringLiteral("xesam:title"), title);
++
+     QUrl url(m_mpv->getProperty("path").toString());
+     url.setScheme("file");
+-    metadata.insert(QStringLiteral("xesam:url"),
+-                    url.toString());
++    metadata.insert(QStringLiteral("xesam:url"), url.toString());
+ 
+     return metadata;
+ }
+-- 
+GitLab
+
diff --git a/testing/haruna/APKBUILD b/testing/haruna/APKBUILD
index 7a42ca7079d1..e26a67d9df05 100644
--- a/testing/haruna/APKBUILD
+++ b/testing/haruna/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Bart Ribbers <bribbers@disroot.org>
 pkgname=haruna
 pkgver=0.7.2
-pkgrel=0
+pkgrel=1
 # armhf blocked by extra-cmake-modules
 # s390x and riscv64 blocked by polkit -> kio
 arch="all !armhf !s390x !riscv64"
@@ -31,7 +31,9 @@ makedepends="
 	kirigami2-dev
 	kxmlgui-dev
 	"
-source="https://download.kde.org/stable/haruna/haruna-$pkgver.tar.xz"
+source="https://download.kde.org/stable/haruna/haruna-$pkgver.tar.xz
+	0001-Fixmpris-only-show-filename-if-theres-no-title.patch
+	"
 subpackages="$pkgname-doc $pkgname-lang"
 
 build() {
@@ -53,4 +55,5 @@ package() {
 
 sha512sums="
 a9fcef594c19452d84574ecc61625ff6c662c227ddca7b574a22277e7e52d1292de0040c0ee37054c13e5561b2e8f0bc27bae061d18443a548f4ed1dc64d8831  haruna-0.7.2.tar.xz
+24c9913fbc1373594d8d89e98dc085d061343a5f7735d1cf51787980a65c4f7242cfe28bb27f0547e429c74dcc9a2904e100c2ac952eaec675d13e838adf1c01  0001-Fixmpris-only-show-filename-if-theres-no-title.patch
 "
-- 
GitLab