diff options
-rw-r--r-- | src/player.vala | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/player.vala b/src/player.vala index 3bc2c36..a4fa5f0 100644 --- a/src/player.vala +++ b/src/player.vala @@ -111,7 +111,7 @@ public class Player : Object { private void _set_position(double pos) { try { - proxy.set_position(new ObjectPath(trackid), (int64)(pos * 1000000)); + proxy.set_position(new ObjectPath(get_str("mpris:trackid")), (int64)(pos * 1000000)); } catch (Error error) { critical(error.message); print("hello\n"); @@ -160,6 +160,7 @@ public class Player : Object { public bool can_control { get; private set; } // metadata + [CCode (notify = false)] public HashTable<string,Variant> metadata { owned get; private set; } public string trackid { owned get; private set; } @@ -255,9 +256,14 @@ public class Player : Object { artist = join_strv("xesam:artist", ", "); comments = join_strv("xesam:comments", "\n"); composer = join_strv("xesam:composer", ", "); + notify_property("metadata"); } } + public Variant? get_meta(string key) { + return metadata.lookup(key); + } + private string? get_str(string key) { if (metadata.get(key) == null) return null; @@ -313,7 +319,6 @@ public class Player : Object { }); proxy.g_properties_changed.connect(sync); - proxy.seeked.connect((pos) => position = (double)pos / 1000000); if (poll_position) { pollid = Timeout.add_seconds(1, () => { @@ -334,10 +339,6 @@ public class Player : Object { if (poll_position) Source.remove(pollid); } - - public string to_json() { - return Json.gobject_to_data(this, null); - } } public enum PlaybackStatus { |