Mpris2: Add new property to read/write the rating #1246
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is to create shortcuts to set the rating and/or to set it from scripts.
This feature was wished for in these threads:
https://forum.strawberrymusicplayer.org/topic/99/shortcuts-for-ratings
https://forum.strawberrymusicplayer.org/topic/326/set-ratings-per-dbus-shortcut
https://forum.strawberrymusicplayer.org/topic/879/expose-rating-of-songs-to-automation-shortcuts
This is technically out of spec for the mpris specification. But since it does not modify any of the original methods it should be fine. If you prefer I could move this to a different bus name like
org.strawberry.Player.Rating
or something.Currently it can for example be accessed like this:
qdbus org.mpris.MediaPlayer2.strawberry /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Rating
to get the rating of the currently playing song (As float from 0-1)Or
qdbus org.mpris.MediaPlayer2.strawberry /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Rating 0.6
to set the rating to a float, here 0.6. (from 0-1)