Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Jul 2010
    Posts
    160

    [Announce] Ratings Light

    About the Ratings Light plugin


    Enabled by default:

    • set track ratings. Supports half-star ratings and incremental rating changes.
    • display track ratings in LMS context menu or on older devices using the Music Information Screen plugin
    • skip tracks (unrated or rated below spec. rating) using the CustomSkip plugin



    Can be enabled in settings:

    • B]import[/B] track ratings using keywords in comment tags of files (auto-import after rescan is an option)
    • export rated tracks to playlist files (e.g. for import in other apps)
    • browse rated tracks by artist or genre (adds a menu folder with submenus)


    If it's not in the main repo install by adding this repo URL: https://raw.githubusercontent.com/AF...epo/public.xml



    Plugins and apps that support Ratings Light:

    • Material Skin (>= v2.1.0)
    • iPeng (not yet)






    Use ratings with other plugins (examples):

    - You could use incremental rating changes with the KidsPlay plugin. Map this command to a button on the Boom or Classic to increase the current track's rating by 1 star (replace + with - to decrease rating):
    Code:
    ratingslight setrating track_id:{CURRENT_TRACK_ID} rating:1 incremental:+; show "line2:-> Rating: +1 star" duration:1 centered:1;
    - Use the Dynamic Playlist plugin to listen to dynamic playlists based on ratings. Example playlist definitions here.






    Note for developers interested in setting ratings with Ratings Light:

    Please let me know if/when your plugin/app supports setting ratings with Ratings Light so I can add it to the list. Thank you.

    • The plugin code is here.
    • setratings command: ['ratingslight','setrating','track_id','rating']
    • Ratings Light expects a rating value in the range of 0 to 5 (half-star ratings supported). Just like TrackStat it will convert it (by multiplying with 20) to store it in the LMS database using the standard LMS rating scale from 0 to 100.
    • Example: the command ['ratingslight','setrating','track_id:12345','rating:3.5'] will store a rating value of 70 (3.5 stars * 20) in the database for the track with the track_id:12345.

    • incremental rating: use the incremental parameter with + or - to add/subtract a rating value to/from the existing rating value.
    • Example: the command ['ratingslight','setrating','track_id:12345','rating:1','incremental:+'] will add 1 star to the current rating value of the track with the track_id:12345.








    One minor known issue

    The (optional) menus for browsing rated tracks by artist or genre are provided by LMS (extended browse modes). Under certain circumstances you may see albums listed for an artist (artists menu) or artists for a genre (genres menu) that shouldn't be there. There's nothing I can do about it because LMS creates and provides these menus.

    Easy solution: just go one level down, i.e. Show all tracks (artists menu) or Show all albums (genres menu), and the problem has vanished. That's the way I do it.
    Or you could completely rebuild these menus with CustomBrowse which uses its own browse logic and menus (instead of the ones provided by LMS) and therefore doesn't have this bug.
    In case this issue ever gets resolved I'll update this page.




    To-Do (2021)
    Last edited by afriend; 2021-01-13 at 08:21.

  2. #2
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    11,163
    The setRating function will probably not work for implementing the “trackstat setrating” command due to this if statement:
    Code:
    if ($request->isNotCommand([['ratingslight'],['setrating']])) {
    You can do an “and” with a similar statement for isNotCommand with trackstat setrating and it should work properly.

    If you want to make it work properly if TrackStat also is installed you could put an if statement around the addDispatch calls that register TrackStat CLI commands so they are only registered if TrackStat isn’t installed. You can see the isPluginsInstalled function in some of my plugins for an example how to check if a plugin is installed. If you want to have additional logic in setrating if TrackStat is installed you can implement a setTrackStatRating function and TrackStat will call your plugin when a rating is set through TrackStat, you can see the TrackStatPlaylist plugin for an example of this https://github.com/erland/lms-tracks.../src/Plugin.pm

    Just mentioning all this since your logic around comment tags and playlists generation potentially could be useful for someone even if TrackStat is installed.

    You might want to check with pippin how iPeng handles ratings, not sure if it checks if trackstat setrating is available or explicitly checks if TrackStat plugin is installed. Might be other third party apps that also sets ratings via TrackStat that you might want to verify compatibility with.

    By the way, it’s great to see more third party developers are interested to add functionality around ratings :-)
    Erland Isaksson (My homepage)
    Developer of many plugins/applets
    Starting with LMS 8.0 I no longer support my plugins/applets (see here for more information )

  3. #3
    Senior Member
    Join Date
    Jul 2010
    Posts
    160
    Quote Originally Posted by erland View Post
    The setRating function will probably not work for implementing the “trackstat setrating” command due to this if statement:
    Code:
    if ($request->isNotCommand([['ratingslight'],['setrating']])) {
    You can do an “and” with a similar statement for isNotCommand with trackstat setrating and it should work properly.

    If you want to make it work properly if TrackStat also is installed you could put an if statement around the addDispatch calls that register TrackStat CLI commands so they are only registered if TrackStat isn’t installed. You can see the isPluginsInstalled function in some of my plugins for an example how to check if a plugin is installed. If you want to have additional logic in setrating if TrackStat is installed you can implement a setTrackStatRating function and TrackStat will call your plugin when a rating is set through TrackStat, you can see the TrackStatPlaylist plugin for an example of this https://github.com/erland/lms-tracks.../src/Plugin.pm

    Just mentioning all this since your logic around comment tags and playlists generation potentially could be useful for someone even if TrackStat is installed.

    You might want to check with pippin how iPeng handles ratings, not sure if it checks if trackstat setrating is available or explicitly checks if TrackStat plugin is installed. Might be other third party apps that also sets ratings via TrackStat that you might want to verify compatibility with.

    By the way, it’s great to see more third party developers are interested to add functionality around ratings :-)
    Tack så mycket för your kind words. The mess with the request/command check happened because I hastily brought back the TrackStat dispatches - which I now deleted again. I think I will do it your way and ask developers if they consider supporting the setrating function of Ratings Light.
    But honestly, apart from your plugins, iPeng and Material I have no idea which plugins or apps support rating. I will try to get in touch with pippin for sure.

    And thanks for the hint. I will definitely keep the setTrackStatRating function in mind if I add some logic that should to be applied to tracks just after the rating has happened (that's the idea behind that, no?).

    Can I just ask one question? I wanted to include a menu for browsing artists and genres that have rated tracks. Browsing them like this might be nice. But I always get some wong/empty entries on the lower levels (artists menu -> albums or for genres -> artists). While the plugin already contains the (disabled) code, I described the problem more in detail here and included a link to some demo files that allow reproducing the problem in a minute. Since you probably have a lot of experience with menus (and CustomBrowse actually doesn't have this problem) I thought I'd ask. I wouldn't like to include the menus with this bug. Thank you!

  4. #4
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    11,163
    Quote Originally Posted by afriend View Post
    And thanks for the hint. I will definitely keep the setTrackStatRating function in mind if I add some logic that should to be applied to tracks just after the rating has happened (that's the idea behind that, no?).
    Yes, that’s the idea.
    Erland Isaksson (My homepage)
    Developer of many plugins/applets
    Starting with LMS 8.0 I no longer support my plugins/applets (see here for more information )

  5. #5
    Senior Member cparker's Avatar
    Join Date
    Oct 2005
    Location
    Hampshire, United Kingdom
    Posts
    617
    Quote Originally Posted by afriend View Post
    Note for developers interested in setting ratings with Ratings Light:
    just call ['ratingslight','setrating','trackid','rating'] with a rating value from 0 to 5. Half-star ratings like 3.5 are supported.
    Hey,

    Couple of questions;
    1) On user side, how does the rating system manage, if you have previously used TrackStat 1-10 star ratings on your music library?

    2) On dev side, for my plugins I read the TS setting and determine whether 1 to 5 or 1 to 10 ratings are being used. (Code below) As I have mix settings to drop tracks that have been rated 2x stars or below for example, so they don't get played, so just wondering how to manage Ratings Light?

    Code:
    	## trackstat.plugin.pm line 1940
    	my $ts_prefs               = preferences('plugin.TrackStat');
    	#rating_10scale == 0 if 1to5
    	#rating_10scale == 1 if 1to10
    
    	my $rating_scale = $ts_prefs->get('rating_10scale');
    3) Finally is Ratings Light a direct replacement for TrackStat?

    Thanks for your work
    www.spicefly.com - ** Spicefly SugarCube ** - A hassle free acoustic journey through your music library using MusicIP. Plus the finest MusicIP installation guides, enhanced MIP Interface and SpyGlass MIP the Windows Automated MusicIP Headless Installer.

  6. #6
    Senior Member
    Join Date
    Jul 2010
    Posts
    160
    Quote Originally Posted by cparker View Post
    1) On user side, how does the rating system manage, if you have previously used TrackStat 1-10 star ratings on your music library?
    If other apps or plugins (like Material) use Ratings Light to set a track's rating they will send a rating value between 0 and 5 to Ratings Light which it will multiply by 20 and write to the LMS persistent database (using the standard LMS 0-100 rating scale).
    So if a plugin sends a rating value of 2.5 Ratings Light will write a rating value of 50 to the LMS database. Even if for some reason you needed to write a very odd rating value like 69 you'd just send 3,45 (69/20) to Ratings Light and it would write 69 to the LMS database. It just expects the incoming value to be between 0 and 5, all else is up to the plugin sending the rating request.

    Quote Originally Posted by cparker View Post
    2) On dev side, for my plugins I read the TS setting and determine whether 1 to 5 or 1 to 10 ratings are being used. (Code below) As I have mix settings to drop tracks that have been rated 2x stars or below for example, so they don't get played, so just wondering how to manage Ratings Light?
    Basically Ratings Light is only involved in setting ratings (and maybe showing them in a track's context menu or providing help for displaying them with the Music Information Screen plugin on older devices like Boom or Classic).
    If plugins want to query or display ratings they can simply get the rating value directly from the LMS database.
    So in your example if you wanted to drop tracks that have been rated 2x stars or below you'd query the LMS database and drop all tracks for which LMS returns a rating value <=40 (according to the standard LMS 0-100 rating scale).

    Quote Originally Posted by cparker View Post
    3) Finally is Ratings Light a direct replacement for TrackStat?
    There is some overlap between what both plugins do: helping other plugins to set track ratings, displaying the rating in the LMS track context menu and offering a titleformat that allows the display of ratings on older devices like Boom or Classic.
    To see what Ratings Light does check out the list in the first post.
    TrackStat offers functionality like finding data if you have moved your library and statistics related functions. It also maintains its own database and is closely linked to Erland's other plugins.

    So in the end it depends on what exactly you want your rating plugin to do for you.
    Last edited by afriend; 2020-12-14 at 07:33.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •