From 1be4bb880fdeea93381eb45846a7d487e58beb93 Mon Sep 17 00:00:00 2001 From: Denis Sheremet Date: Fri, 18 Oct 2019 09:02:11 +0200 Subject: [PATCH] [Media Controller] Multiple artists support According to the spec, xesam:artist should be a string array, but majority of players uses string instead. This patch adds support for both string array and string options to allow new software development according to the spec but also maintain compatibility with existing solutions. BUG: 405762 FIXED-IN: 5.17.1 Differential Revision: https://phabricator.kde.org/D24740 --- applets/mediacontroller/contents/ui/main.qml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/applets/mediacontroller/contents/ui/main.qml b/applets/mediacontroller/contents/ui/main.qml index 4b694ed81..57263ceb2 100644 --- a/applets/mediacontroller/contents/ui/main.qml +++ b/applets/mediacontroller/contents/ui/main.qml @@ -49,7 +49,21 @@ Item { var lastUrlPart = xesamUrl.substring(lastSlashPos + 1) return decodeURIComponent(lastUrlPart) } - property string artist: currentMetadata ? currentMetadata["xesam:artist"] || "" : "" + property string artist: { + if (!currentMetadata) { + return "" + } + var xesamArtist = currentMetadata["xesam:artist"] + if (!xesamArtist) { + return ""; + } + + if (typeof xesamArtist == "string") { + return xesamArtist + } else { + return xesamArtist.join(", ") + } + } property string albumArt: currentMetadata ? currentMetadata["mpris:artUrl"] || "" : "" readonly property string identity: !root.noPlayer ? mpris2Source.currentData.Identity || mpris2Source.current : ""