playerctl icon indicating copy to clipboard operation
playerctl copied to clipboard

`mpris:length` returns an `s` when i think it should return whatever `x` is

Open mavenried opened this issue 1 year ago • 1 comments

The player I am using is [io].

playerctl metadata --format "Total length: {{ duration(mpris:length) }}"

This command (mentioned in the readme) returns an error on my machine Specifically, this one :-

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

i'm using it to rice my waybar to make a player widget from scratch

mavenried avatar Sep 13 '24 09:09 mavenried

Looks like this was mostly-fixed? With playerctl v2.4.1, I'm getting correct responses for mpris:length:

$ playerctl metadata
vlc   mpris:trackid             '/org/videolan/vlc/playlist/4'
vlc   xesam:url                 xxREDACTEDxx
vlc   vlc:time                  670
vlc   mpris:length              670112000
vlc   vlc:length                670112
vlc   vlc:publisher             5

$ playerctl metadata --format '{{ duration(mpris:length) }}'
11:10

$ playerctl metadata --format '{{ duration(position) }}'    
4:47

It is still a bit odd, though. The man page claims duration() only works for position and mpris:length. However, I can call it on vlc:length as well... it just gets the value wrong, due to the different scaling:

$ playerctl metadata --format '{{ duration(vlc:length) }}'
0:00

ferdnyc avatar Oct 08 '25 03:10 ferdnyc