diff options
author | Aylur <[email protected]> | 2024-09-17 15:37:00 +0000 |
---|---|---|
committer | Aylur <[email protected]> | 2024-09-17 15:37:00 +0000 |
commit | e240676a48e8ec13cdb7839b1198654ba03bc679 (patch) | |
tree | 740460b8a002c7a9ce90a79d4d9e3240b65a6226 /lib | |
parent | 71ee1ea4bf4edd790edb7067f8fb0ae6c450ce5e (diff) |
fix(mpris): length getter
the spec says length is supposed to be an int64
but spotify is returning a uint64
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mpris/player.vala | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/mpris/player.vala b/lib/mpris/player.vala index ed146f6..6764d2b 100644 --- a/lib/mpris/player.vala +++ b/lib/mpris/player.vala @@ -245,10 +245,16 @@ public class Player : Object { // metadata metadata = proxy.metadata; if (metadata != null) { - if (metadata.get("mpris:length") != null) - length = (double)metadata.get("mpris:length").get_uint64() / 1000000; - else + if (metadata.get("mpris:length") != null) { + var v = metadata.get("mpris:length"); + if (v.get_type_string() == "x") { + length = (double)v.get_int64() / 1000000; + } else if (v.get_type_string() == "t") { + length = (double)v.get_uint64() / 1000000; + } + } else { length = -1; + } trackid = get_str("mpris:trackid"); art_url = get_str("mpris:artUrl"); |