Repository navigation
fix(mpris): publish a track id so absolute seeks reach spotatui - #809
Conversation
The MPRIS metadata had no mpris:trackid, so clients refused SetPosition (playerctl: "Could not get track id to set position"); relative seeks worked. Each track now gets /org/spotatui/track/<hash of its title, artists, album and length>, the same from every path that publishes it. A SetPosition carrying spotatui's id of another track is ignored, as the spec asks, so a seek sent just before a track change does not land in the next song. Clients that send NoTrack or an id of their own keep working as they did since LargeModGames#85. Fixes LargeModGames#808
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
Fixes #808. spotatui's MPRIS metadata had no
mpris:trackid, so clients refusedSetPosition(playerctl position 60: "Could not get track id to set position"). Relative seeks worked.track_object_path():/org/spotatui/track/<16 hex>from a hash of title, artists, album and length (DefaultHasher::new()has fixed keys, so it is stable). The same track gets the same id from every path that publishes it: the native player's track change and the driver's sync read the samenative_track_infofields; a remote device or a local file only has one path.build_metadata()sets it asmpris:trackidnext to the existing fields.set_position_targets_current(): aSetPositionwith spotatui's id of another track is ignored, as the spec asks, so a seek sent right before a track change does not land in the next song.NoTrackand ids of a client's own still go through: since fix(mpris): Fix position tracking and seeking #85, widgets and KDE Connect seek without a real id, and I didn't want to break them.All in
src/infra/mpris.rs, plus a CHANGELOG entry; no caller changes. macOS and Windows have no track-id concept and are untouched.Testing
cargo fmt --all -- --check: clean.cargo clippy -- -D warningsand with--no-default-featuresfortelemetry,tui,telemetry,telemetry,streamingand theguileg: clean.cargo test: 2037 passed, 0 failed, 7 ignored.cargo test --no-default-features --features telemetry,tui: 1555 passed.guileg: 1741 passed.tools/check_gates_ratchet.sh origin/main: ok.mpris.rs(stable id, different fields give different ids, no field run-together, valid id outside/org/mpris, the metadata carries it, the threeSetPositioncases). Without.trackid(…)inbuild_metadatathe metadata test fails.playerctlandbusctl --user call … SetPosition, on the local player and on a Sonos room (feat(spotify): play on Cast and Connect speakers on the LAN #795):mpris:trackid(/org/spotatui/track/…), andplayerctl position 60jumps to 1:00 (on the room:PUT /v1/me/player/seek?position_ms=60000).next, aSetPositionwith the previous track's id is ignored (no seek in the log), one withNoTrackand one with the current id both seek.mainwithout the fix,playerctl position 60still fails with "Could not get track id to set position".Additional notes
set_metadataalready passes. Two different tracks with identical title, artists, album and length would share an id; then a stale seek is simply not filtered, which is the old behavior.SetPositionoutside0..lengthis still clamped rather than ignored.Summary by CodeRabbit