-
Notifications
You must be signed in to change notification settings - Fork 754
Draft: Add MPRIS support #1341
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
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
|
For anyone who finds this PR useful, I've rebased it on the latest dev branch. You can find it here: https://github.com/paulfariello/librespot/tree/mpris. Has any decision been made regarding the integration? (cf #1341 (comment)) For what it's worth, I use I also guess that clients could easily drop their MPRIS implementation if librespot were to provide it. |
That's great, thanks so much for posting it here!
I'd be in favor. I was under the impression that the original author wanted to do more work on it first. What do you think? |
|
Sorry for the long silence here! I've definitely put this on the back burner; I think it's unlikely that I'll wrap it up soon. @paulfariello I've seen that you've also added a few small improvements to your branch already: If you'd be interested in moving this forward starting from my code in a new PR, please go ahead! I'm not quite sure anymore what I still wanted to do here. Here's a few things I'm thinking of right now when scrolling through the code again:
|
|
Thanks @wisp3rwind. I've opened a new PR #1596, will try to fix as much TODOs as possible. |
I've been playing around with adding MPRIS support to librespot, i.e. have it implement the
org.mpris.MediaPlayer2interface 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
PlayerEvents and sendingspirccommands.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:
zbusrequired for the feature.) Should it be configurable whether the MPRIS service runs from the command line?spirccommand 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!