aboutsummaryrefslogtreecommitdiff
path: root/src/mpris2-controller.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/mpris2-controller.vala')
-rw-r--r--src/mpris2-controller.vala26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index d5152c2..166d7f4 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -121,9 +121,9 @@ public class Mpris2Controller : GLib.Object
if(meta_v != null){
GLib.HashTable<string, Value?> changed_updates = clean_metadata();
- MetadataMenuitem meta = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem;
- meta.reset(MetadataMenuitem.attributes_format());
-
+ //MetadataMenuitem meta = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem;
+ //meta.reset(MetadataMenuitem.attributes_format());
+ this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format());
this.owner.custom_items[PlayerController.widget_order.METADATA].update(changed_updates,
MetadataMenuitem.attributes_format());
this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format());
@@ -138,12 +138,18 @@ public class Mpris2Controller : GLib.Object
private GLib.HashTable<string, Value?> clean_metadata()
{
GLib.HashTable<string, Value?> changed_updates = this.player.Metadata;
- string[] artists = (string[])this.player.Metadata.lookup("xesam:artist");
- string display_artists = string.joinv(", ", artists);
- changed_updates.replace("xesam:artist", display_artists);
- debug("artist : %s", display_artists);
- int64 duration = this.player.Metadata.lookup("mpris:length").get_int64();
- changed_updates.replace("mpris:length", duration/1000000);
+ Value? artist_v = this.player.Metadata.lookup("xesam:artist");
+ if(artist_v != null){
+ string[] artists = (string[])this.player.Metadata.lookup("xesam:artist");
+ string display_artists = string.joinv(", ", artists);
+ changed_updates.replace("xesam:artist", display_artists);
+ debug("artist : %s", display_artists);
+ }
+ Value? length_v = this.player.Metadata.lookup("mpris:length");
+ if(length_v != null){
+ int64 duration = this.player.Metadata.lookup("mpris:length").get_int64();
+ changed_updates.replace("mpris:length", duration/1000000);
+ }
return changed_updates;
}
@@ -171,7 +177,7 @@ public class Mpris2Controller : GLib.Object
debug("initial update - play state %i", status);
(this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(status);
- var cleaned_metadata = this.clean_metadata();
+ GLib.HashTable<string, Value?> cleaned_metadata = this.clean_metadata();
this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata,
MetadataMenuitem.attributes_format());
this.owner.custom_items[PlayerController.widget_order.SCRUB].update(cleaned_metadata,