Skip to content

CLI commands

AF-1 edited this page Dec 17, 2024 · 9 revisions

The setrating command

  • ['ratingslight', 'setratingpercent', 'trackid', 'rating', 'incremental']
    The recommended setratingpercent command expects a rating value in the range of 0 to 100.

    or

  • ['ratingslight', 'setrating', 'trackid', 'rating', 'incremental']
    The only difference to the command above is the rating scale: the setrating command expects a rating value in the range of 0 to 5.
    Half-star ratings like 3.5 are supported. Use a decimal point, not a comma.

Example:
The commands ['ratingslight', 'setratingpercent', 'track_id:12345', 'rating:70'] and ['ratingslight', 'setrating', 'track_id:12345', 'rating:3.5'] will both store a rating value of 70 (3.5 stars * 20) in the database for the track with the track id 12345.


Set incremental rating

Use the incremental parameter with + or - to add/subtract a rating value to/from the current rating value.

Example 1:
The command ['ratingslight', 'setratingpercent', 'track_id:12345', 'rating:20', 'incremental:+'] will add 1 star to the current rating value of the track with the track id 12345.

Example 2:
You could use incremental rating changes with the KidsPlay plugin. Map this command to a button on your Boom or Radio to decrease the current track's rating by 1 star:
ratingslight setratingpercent track_id:{CURRENT_TRACK_ID} rating:20 incremental:-;


The getrating command

['ratingslight', 'getrating', 'trackid']
Use the getrating command to retrieve the rating value (in the range of 0 to 100) for a track.




Subscribing to rating changes

You can also get notified of track rating changes in plugins and applets by subscribing to

  • applets: /slim/ratingslightchangedratingupdate
  • plugins: ['ratingslight', 'changedrating']

Clone this wiki locally