summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-06-27 15:09:17 +0200
committerAylur <[email protected]>2024-06-27 15:09:17 +0200
commit889d42624d60dd05858a62a8be6a4fd8f60f7180 (patch)
tree629d398a878c993f053f2d136d50052abe9cf337
parent0a34dd3ba7106fb281d019a91515e3adac51958b (diff)
cleanup
* remove leftover to_json * add get_meta * fix notify::metadata signal
-rw-r--r--src/player.vala13
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 {