-
Notifications
You must be signed in to change notification settings - Fork 625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Add MPRIS support #1341
base: dev
Are you sure you want to change the base?
Draft: Add MPRIS support #1341
Conversation
Thanks for proposing it! For completeness sake, I believe ncspot also has MPRIS support: https://github.com/hrkfdn/ncspot Let's entertain some open discussion on why or why not this could belong to librespot, before I bias the discussion with my own thoughts (which are not set in stone either). |
Thanks for the pointer, I wasn't aware of ncspot before!
Sounds good! |
I'm interested in this! I've been migrating from spotifyd since librespot does most of what I need on its own. The lack of MPRIS is a bit of a downer since that does a lot of heavy lifting for integration with everything. Remote controls and media buttons just work whenever something implements MPRIS. |
I'm thinking it'd be good if we could feature-gate this. So the additional dependencies are optional for anyone not needing MPRIS. |
There already is, see the In any case; I think this needs more work before it should be merged. I'll change the PR state from Draft to ready once I think it makes sense to review it properly. |
Perfect! Missed that. |
I was testing this out today, but |
- which is just a tokio::sync::mpsc sender, so this should be safe - prep for MPRIS support, which will use this to control playback
- preparation for MPRIS support - now that the data is there, also yield from player_event_handler
- preparation for MPRIS support
- following the spec at https://specifications.freedesktop.org/mpris-spec/latest/ - some properties/commands are not fully supported, yet
I've been playing around with adding MPRIS support to librespot, i.e. have it implement the
org.mpris.MediaPlayer2
interface on DBus. Other software (such as the CLI toolplayerctl
, or a service managing a smart speaker, as for example in HifiBerryOS or similar projects) can use this to obtain playback status, metadata and to control the player.This is achieved by hooking into the existing
PlayerEvent
s and sendingspirc
commands.Currently, this is a working implementation (at least I've tested manually using
playerctl
), but a few things are missing (at least doc + changelog updates, runcargo fmt
+cargo clippy
, only compile this on systems which support DBus, check implementation again against the MPRIS specification).Thus, I'm not really asking for detailed feedback yet, but I'd be curious to know:
zbus
required for the feature.) Should it be configurable whether the MPRIS service runs from the command line?spirc
command that I added?The PR adds quite a lot of code, but this is almost exclusively contained in the new MPRIS task. Changes to existing components are quite minimal.
Thanks!