altdesktop / playerctl

🎧 mpris media player command-line controller for vlc, mpv, RhythmBox, web browsers, cmus, mpd, spotify and others.
GNU Lesser General Public License v3.0
2.43k stars 79 forks source link

Issues with mpris:length #234

Closed yaflow-droid closed 2 years ago

yaflow-droid commented 3 years ago

The player I am using is spotify.

When trying to execute the command playerctl metadata --format="{{duration(mpris:length)}} -p spotify", I'm getting this error:

Could not execute command: function position can only be called on int64 values

I also tried playerctl metadata --format={{duration(mpris:length - position)}} -p spotify and I'm getting this error

Could not execute command: Got unsuported operand types for -: 't' and 'x'

acrisci commented 3 years ago

Spotify is giving me mpris:length in type t (uint64) instead of x which is against spec. I can work around this by allowing that type to be an arg to the function and generalizing the - operand to work between any number types.

king-gizzard commented 3 years ago

is there a workaround that can be applied to the playerctl cli as is? i'd be willing to try and help with this issue otherwise, but - fair warning - am quite inexperienced when it comes to contribution/collaboration.

acrisci commented 3 years ago

Sure just make this work with type t.

https://github.com/altdesktop/playerctl/blob/c892ea2f90674bba987add6ad76042696f51c20a/playerctl/playerctl-formatter.c#L471-L510