Skip to content
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

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft

Conversation

wisp3rwind
Copy link

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 tool playerctl, 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 sending spirc 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, run cargo 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:

  • Would you generally consider this in scope for the project, i.e. could this be merged upstream?
  • Should this be enabled by default? (There's a new dependency on zbus required for the feature.) Should it be configurable whether the MPRIS service runs from the command line?
  • Any concerns regarding the new 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!

@wisp3rwind wisp3rwind marked this pull request as draft September 18, 2024 13:05
@roderickvd
Copy link
Member

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).

@wisp3rwind
Copy link
Author

For completeness sake, I believe ncspot also has MPRIS support: https://github.com/hrkfdn/ncspot

Thanks for the pointer, I wasn't aware of ncspot before!

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).

Sounds good!

- 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
@JockeTF
Copy link

JockeTF commented Oct 1, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants