Bug 405762 - xesam:artist is not read as List
Summary: xesam:artist is not read as List
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Media Player (show other bugs)
Version: master
Platform: Neon Linux
: NOR normal
Target Milestone: 1.0
Assignee: Kai Uwe Broulik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-22 19:08 UTC by Janek
Modified: 2019-10-18 07:02 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.17.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janek 2019-03-22 19:08:39 UTC
The MPRIS specification defines the xesam:artist property as being a String Array, not a string, see https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata/#index6h4.

However, the mediacontroller only shows the artist field when it is a plain string, which results in this error in the console when launching plasmawindowed org.kde.plasma.mediacontroller while a specification-conform MediaPlayer runs:

file:///usr/share/plasma/plasmoids/org.kde.plasma.mediacontroller/contents/ui/main.qml:52:5: Unable to assign QStringList to QString

And does not show any artist.
Comment 1 K900 2019-10-17 14:27:50 UTC
Moved this to the right component (I hope). Can confirm it's still an issue on plasma-workspace 5.17.0.
Comment 2 Kai Uwe Broulik 2019-10-17 14:45:46 UTC
What player are you using? VLC gives me a string.
I can fix that but I'd like to test with an actual player that does it, as to not break those that don't
Comment 3 K900 2019-10-17 15:37:59 UTC
I've got a custom script that pulls data from a web page and feeds it into MRPIS, and I have it follow the FDO spec. 

Clementine seems to use a list too: https://github.com/clementine-player/Clementine/blob/17d95b7833fd0f8b7547d70a6dbf3367be31b85e/src/core/song.cpp#L1176 (despite only ever having a single artist per track).

So does Rhythmbox: https://github.com/GNOME/rhythmbox/blob/4abbd528da0a32d0c343a22d5dfb2c5e98c489f5/plugins/mpris/rb-mpris-plugin.c#L557 (but, again, only with a single track - note the last argument to add_string_property_2, which is "gboolean as_list").

VLC seems to also use a single item list? https://github.com/videolan/vlc/blob/f83434ac6488e5cee32e191f9a89859254156b0e/modules/control/dbus/dbus.c#L1305

It seems like there's some sort of auto-cast involved - doing `console.log(currentMetadata["xesam:artist"])` gives me `[Artist Name]`, but the applet still processes it correctly. Adding more than one artist breaks things though.
Comment 4 K900 2019-10-17 15:49:47 UTC
A friend submitted a draft patch that seems to fix this: https://phabricator.kde.org/D24740

However, I can't actually find a single player that _does_ report xesam:artist as a single string, so it's possible that a correct patch could be a lot simpler.
Comment 5 Kai Uwe Broulik 2019-10-18 07:02:42 UTC
Git commit 1be4bb880fdeea93381eb45846a7d487e58beb93 by Kai Uwe Broulik, on behalf of Denis Sheremet.
Committed on 18/10/2019 at 07:02.
Pushed by broulik into branch 'Plasma/5.17'.

[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.
FIXED-IN: 5.17.1

Differential Revision: https://phabricator.kde.org/D24740

M  +15   -1    applets/mediacontroller/contents/ui/main.qml

https://commits.kde.org/plasma-workspace/1be4bb880fdeea93381eb45846a7d487e58beb93