diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-01-27 10:04:36 -0600 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-01-27 10:04:36 -0600 |
commit | 1529af0e1224f04616054095742b698d8814cec4 (patch) | |
tree | fd3cf04a9daaa057904f40c68a9f6d75c1ece907 | |
parent | f5aba239f02110c6f0ba2a6c88349c6e59771f65 (diff) | |
parent | f19af83dd99f095ad5ebe317000ac5bf2031a038 (diff) | |
download | ayatana-indicator-sound-1529af0e1224f04616054095742b698d8814cec4.tar.gz ayatana-indicator-sound-1529af0e1224f04616054095742b698d8814cec4.tar.bz2 ayatana-indicator-sound-1529af0e1224f04616054095742b698d8814cec4.zip |
playlist work merged
-rw-r--r-- | src/mpris2-controller.vala | 55 | ||||
-rw-r--r-- | src/transport-menu-item.vala | 3 |
2 files changed, 36 insertions, 22 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index fc61c12..a7b3de1 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -93,6 +93,16 @@ public class Mpris2Controller : GLib.Object if ( playlist_v != null && this.owner.use_playlists == true ){ this.fetch_active_playlist(); } + Variant? playlist_count_v = changed_properties.lookup("PlaylistCount"); + if ( playlist_count_v != null && this.owner.use_playlists == true ){ + this.fetch_playlists(); + this.fetch_active_playlist(); + } + Variant? playlist_orderings_v = changed_properties.lookup("Orderings"); + if ( playlist_orderings_v != null && this.owner.use_playlists == true ){ + this.fetch_playlists(); + this.fetch_active_playlist(); + } } private bool ensure_correct_playback_status(){ @@ -107,16 +117,20 @@ public class Mpris2Controller : GLib.Object GLib.HashTable<string, Variant?> changed_updates = this.player.Metadata; Variant? 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); + Variant? v_artists = this.player.Metadata.lookup("xesam:artist"); + debug("artists is of type %s", v_artists.get_type_string ()); + string display_artists; + if(v_artists.get_type_string() == "s"){ + debug("SPOTIFY is that you ?"); + display_artists = v_artists.get_string(); + } + else{ + string[] artists = v_artists.dup_strv(); + display_artists = string.joinv(", ", artists); + } changed_updates.replace("xesam:artist", display_artists); debug("artist : %s", (string)changed_updates.lookup("xesam:artist")); } - Variant? 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; } @@ -161,6 +175,19 @@ public class Mpris2Controller : GLib.Object } } + + public bool connected() + { + return (this.player != null && this.mpris2_root != null); + } + + public void expose() + { + if(this.connected() == true){ + this.mpris2_root.Raise.begin(); + } + } + public void fetch_playlists() { PlaylistDetails[] current_playlists = this.playlists.GetPlaylists(0, @@ -176,7 +203,6 @@ public class Mpris2Controller : GLib.Object warning(" Playlists are on but its returning no current_playlists" ); this.owner.use_playlists = false; } - return; } private void fetch_active_playlist() @@ -188,19 +214,6 @@ public class Mpris2Controller : GLib.Object playlists_item.update_active_playlist ( this.playlists.ActivePlaylist.details ); } - - public bool connected() - { - return (this.player != null && this.mpris2_root != null); - } - - public void expose() - { - if(this.connected() == true){ - this.mpris2_root.Raise.begin(); - } - } - public void activate_playlist (ObjectPath path) { try{ diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index e93f0bb..b8f55b5 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -44,7 +44,8 @@ public class TransportMenuitem : PlayerItem { debug("UPDATING THE TRANSPORT DBUSMENUITEM PLAY STATE WITH VALUE %i", (int)update); - this.property_set_int(MENUITEM_PLAY_STATE, update); + int temp = (int)update; + this.property_set_int(MENUITEM_PLAY_STATE, temp); } public override void handle_event(string name, |