diff options
author | Bastien Nocera <hadess@hadess.net> | 2022-10-17 14:41:04 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2022-10-17 14:42:50 +0200 |
commit | e16f4e1085f1db3dad86ddd77253950cd37e7e84 (patch) | |
tree | 42180eedcc8963e3d618453aa39ec2b483ce6de9 /src/plugins/mpris/totem-mpris.c | |
parent | 7029d1f12cc2d8735c71acef561026e65f4d19fd (diff) | |
download | totem-e16f4e1085f1db3dad86ddd77253950cd37e7e84.tar.gz |
mpris: Fix artist not showing in gnome-shell
https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata/#xesam:artist
defines xesam:artist as a string list, rather than a string.
Fix this so the artist appears correctly when set.
Closes: #542
Diffstat (limited to 'src/plugins/mpris/totem-mpris.c')
-rw-r--r-- | src/plugins/mpris/totem-mpris.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/plugins/mpris/totem-mpris.c b/src/plugins/mpris/totem-mpris.c index e454590d8..df9396bb1 100644 --- a/src/plugins/mpris/totem-mpris.c +++ b/src/plugins/mpris/totem-mpris.c @@ -251,10 +251,13 @@ static const GDBusInterfaceVTable root_vtable = /* MPRIS player interface */ -const char *str_metadata[] = { - "xesam:title", - "xesam:artist", - "xesam:album", +struct { + const char *property; + gboolean is_strv; +} str_metadata[] = { + { "xesam:title", FALSE }, + { "xesam:artist", TRUE }, + { "xesam:album", FALSE } }; static void @@ -277,13 +280,23 @@ calculate_metadata (TotemMprisPlugin *pi, for (i = 0; i < G_N_ELEMENTS (str_metadata); i++) { const char *str; - str = g_hash_table_lookup (pi->metadata, str_metadata[i]); + str = g_hash_table_lookup (pi->metadata, str_metadata[i].property); if (!str) continue; - g_variant_builder_add (builder, - "{sv}", - str_metadata[i], - g_variant_new_string (str)); + if (!str_metadata[i].is_strv) { + g_variant_builder_add (builder, + "{sv}", + str_metadata[i].property, + g_variant_new_string (str)); + } else { + const char *strv[] = { NULL }; + + strv[0] = str; + g_variant_builder_add (builder, + "{sv}", + str_metadata[i].property, + g_variant_new_strv (strv, 1)); + } } } |