Skip to content

Conversation

paulfariello
Copy link

@paulfariello paulfariello commented Sep 23, 2025

Taking back on @wisp3rwind work for adding MPRIS support #1341.

  • Rebased on recent dev branch
  • ensure cargo fmt and cargo clippy passes on each commit
  • fix a few todos
  • send signal when position changed
  • return error when MPRIS command are done in wrong context or internal fails
  • handle position
  • handle identity
  • choose biggest art url
  • ensure metadata are always up to date or at least not invalid
  • notify on various property change

Not sure about:

  • Sending current state of player for all new listener (59767ce)

@paulfariello paulfariello force-pushed the mpris branch 7 times, most recently from f4a3b30 to 5e8fc7d Compare September 25, 2025 15:20
@paulfariello paulfariello force-pushed the mpris branch 2 times, most recently from 7fc4159 to f6481fd Compare September 30, 2025 15:13
@paulfariello paulfariello changed the title Draft: Add MPRIS support Add MPRIS support Sep 30, 2025
@paulfariello
Copy link
Author

@roderickvd this PR can probably be considered ready. The only missing feature is to handle the track list. It can probably be done in another PR.

Right now, CI is failing but doesn't seems to be related to this specific PR.

Do you have an opinion concerning 59767ce which is a broader modification than just MPRIS support?

Copy link
Contributor

@wisp3rwind wisp3rwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for moving this forward!

I've looked through the PR superficially; here are a few comments. I didn't really check the actual implementation of MPRIS commands.

src/main.rs Outdated
.optopt(
POSITION_UPDATE_SHORT,
POSITION_UPDATE,
"Update position interval in ms",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe explain that this is about player events and thereby also MPRIS? I feel like without that context, it be quite unclear what the purpose of this option is?

Personally, I'd prefer the option to be --position-update-interval to make it really explicit, but it does become very long that way...

Copy link
Author

@paulfariello paulfariello Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 40ec0a3

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need it configurable? I'm not so sure if we want that...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either we want it configurable or we should choose a sensible default value other than 0 (which prevent position to be updated).


let position_update_interval = opt_str(POSITION_UPDATE).as_deref().map(|position_update| {
match position_update.parse::<u64>() {
Ok(value) => Duration::from_millis(value),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also add a lower bound here? Either by returning an error if lower, or maybe better by simply taking the value.min(MIN_INTERVAL)? (Not sure what value should be, a few ms at least?) Or at least require it to be nonzero?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea, what sensible value should we use? 100ms seems quite sensible lower bound.

@roderickvd
Copy link
Member

@roderickvd this PR can probably be considered ready. The only missing feature is to handle the track list. It can probably be done in another PR.

Thanks! I saw you processed quite a bit of comments after, so ping me when you feel you're ready for another round of review.

Do you have an opinion concerning 59767ce which is a broader modification than just MPRIS support?

What'd be the negatives? 😄 No honestly. It seems like an improvement to me, but let me know if I should be aware of any downsides.

@roderickvd
Copy link
Member

Don't forget to add a changelog entry.

@paulfariello
Copy link
Author

Don't forget to add a changelog entry.

Done in 0a5c3aa

@paulfariello
Copy link
Author

@roderickvd this PR can probably be considered ready. The only missing feature is to handle the track list. It can probably be done in another PR.

Thanks! I saw you processed quite a bit of comments after, so ping me when you feel you're ready for another round of review.

AFAICT I've rework everything raised by comment. Should be ok for a last review.

Do you have an opinion concerning 59767ce which is a broader modification than just MPRIS support?

What'd be the negatives? 😄 No honestly. It seems like an improvement to me, but let me know if I should be aware of any downsides.

If you don't see any negatives then let's go with that :)

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