Skip to content
This repository has been archived by the owner on Jun 7, 2019. It is now read-only.

Ratings Support

Jason Gray edited this page Jul 30, 2017 · 9 revisions

The MPRISv2 spec defines userRating as "A user-specified rating. This should be in the range 0.0 to 1.0" Ratings are read only according to MPRISv2 spec, there is no method provided in the spec for setting ratings. Many players provide the userRating in the tracks metadata. This extension will show the ratings of any player that provides them according to spec, but the ability to set ratings has to be implemented on a player by player basis generally by the developer of the player or by the interested party. See Setting Ratings for the easiest way to do that.

With the exception of versions of Pithos that have the support for setting ratings via MPRIS, ratings are represented in the extension UI as a truncated 5 star scale.

Number of stars = truncate(userRating * 5). 1.0 = 5 stars, 0.9 and 0.8 = 4 stars, 0.7 and 0.6 = 3 stars, 0.5 and 0.4 = 2 stars, 0.3 and 0.2 = 1 star, 0.1 and 0.0 = 0 stars.

In versions of Pithos that have the support for setting ratings via MPRIS ratings follow the Pithos/Pandora rating system and function much like ratings in the Pithos UI.

Players with support for setting ratings

Nuvola Player: via Nuvola specific MPRIS Methods
Rhythmbox: via a Rhythmbox specific DBus interface
Quod Libet: via the command line
Lollypop: via the command line or in newer versions via the ExtensionSetRatings interface
Pithos: via a Pithos specific MPRIS Extension

Setting Ratings

The easiest way to enable the ability for this extension to set ratings in your player of choice is to ask them to implement this simple non-standard ratings interface:

Interface

  • org.mpris.MediaPlayer2.ExtensionSetRatings

Methods

  • SetRating(TrackId, Rating) (o, d) -> nothing

  • Rating will be in the range of 0.0 to 1.0.

Properties

  • HasRatingsExtension() () -> Boolean

  • Should always return True so that a client can tell that the interface exists at player discovery.

<node>\
    <interface name="org.mpris.MediaPlayer2.ExtensionSetRatings">\
        <method name="SetRating">\
            <arg type="o" direction="in" />\
            <arg type="d" direction="in" />\
        </method>\
        <property name="HasRatingsExtension" type="b" access="read" />\
    </interface>\
</node>

Note:

Players MUST include "mpris:trackid" in each track's metadata(they should already be doing that as per spec).