playerctl icon indicating copy to clipboard operation
playerctl copied to clipboard

In metadata --follow, reset position to 0 when track changes

Open xPMo opened this issue 7 months ago • 1 comments

The players I am using are Strawberry and Finamp. These do not output MediaPlayer2.Player Seeked events when the track changes, so when using player metadata --follow, playerctl will continue to increment the position rather than reset it to 0.

hecking the MPRIS spec, I believe this is incorrect.

This signal does not need to be emitted when playback starts or when the track changes, unless the track is starting at an unexpected position. An expected position would be the last known one when going from Paused to Playing, and 0 when going from Stopped to Playing.

(Thanks for playerctl(d), it's been an awesome project for so many years!)

xPMo avatar Jun 09 '25 13:06 xPMo

Hmm, I think this should work already... https://github.com/altdesktop/playerctl/blob/b19a71cb9dba635df68d271bd2b3f6a99336a223/playerctl/playerctl-player.c#L192

Not sure why it isn't.

EDIT: Ah, dug through debug logs; they just don't set a track ID at all:
// From busctl --user monitor -j --match="type='signal',path='/org/mpris/MediaPlayer2'"
{
  "type": "signal",
  "endian": "l",
  "flags": 0,
  "version": 1,
  "cookie": 501,
  "timestamp-realtime": 1749477854940538,
  "sender": ":1.2795",
  "path": "/org/mpris/MediaPlayer2",
  "interface": "org.freedesktop.DBus.Properties",
  "member": "PropertiesChanged",
  "payload": {
    "type": "sa{sv}as",
    "data": [
      "org.mpris.MediaPlayer2.Player",
      {
        "Metadata": {
          "type": "a{sv}",
          "data": {
            "xesam:title": {
              "type": "s",
              "data": "Safe Return"
            },
            "mpris:length": {
              "type": "x",
              "data": 409547750
            },
            "xesam:artist": {
              "type": "as",
              "data": [
                "Tetsukazu Nakanishi"
              ]
            },
            "mpris:artUrl": {
              "type": "s",
              "data": "file:///run/user/1000/doc/6572e66d/finamp/Finamp/Scitron%20Digital%20Contents/b5a576cd-bf60-4d93-8f68-0d0571799f6e.jpg"
            },
            "xesam:album": {
              "type": "s",
              "data": "Ace Combat 04: Shattered Skies Original Soundtrack"
            }
          }
        }
      },
      []
    ]
  }
}

xPMo avatar Jun 09 '25 13:06 xPMo