Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 7 123 ... LastLast
Results 1 to 10 of 65
  1. #1
    Senior Member
    Join Date
    Jul 2010
    Posts
    220

    [Announce] Ratings Light


    About the Ratings Light plugin


    Features

    • set track ratings (supports incremental rating changes)

      • in your browser using the default LMS or the Material skin web UI

      • on your Logitech devices or piCorePlayer (context menu)

      • using the IR remote of your (Logitech) device

      • in supported apps and plugins

    • import track ratings

      • batch rate all tracks in a playlist

      • using keywords in comment tags (auto-import after scan is possible)

    • export rated tracks to playlist files (as a backup or to import ratings in other apps)

    • browse rated tracks by artist or genre (with optional library view filter)

    • create (scheduled) backups of your ratings and restore your ratings from backups

    • keep track of your recently rated songs with a dedicated playlist or a plain text log file

    • Show (more) rated songs by an artist - only one click away from the song details page (webUI, Material) or the track context menu (Radio, Touch, piCorePlayer)

    • display track ratings in LMS menus (web UI and text) or on older devices using the Now Playing screensaver or the Music Information Screen plugin

    • provides mixes for Don't Stop The Music plugin

    • comes with a set of ratings-based smart playlists ready for use with the Dynamic Playlists plugin

    • skip tracks (unrated or rated below spec. rating) using the CustomSkip plugin


    Some features are not enabled by default. Please go to the plugin's settings page to enable them.



    Installation

    You should be able to install Ratings Light from LMS > settings > plugins.





    Bug report, manual installation

    Please include relevant server log entries, LMS version and OS (version) if you're reporting a bug. You'll find all of that on the settings > information page.


    If you want to test a new patch that hasn't made it into a release version yet or you need to install a previous version:

    • go to settings > plugins and uninstall the currently installed version of Ratings Light.

    • then go to settings > information. Near the bottom of the page you'll find several plugin folder paths. The path you want does not include the word Cache. Examples:

      • piCorePlayer: /usr/local/slimserver/Plugins

      • Mac: /Users/yourusername/Library/Application Support/Squeezebox/Plugins

    • now download the version you need:

      • the latest version of Ratings Light (incl. patches not yet released) is on github. Click the green Code button and download the zip archive. Move the folder called RatingsLight from that archive into the plugin folder mentioned above.

      • previously released versions are available here for a limited time after the release of a new version. Download the source code zip archive and move the folder called RatingsLight from that archive into the plugin folder mentioned above.

    • restart LMS


    BTW it usually takes a couple of hours before released versions show up on the official LMS plugins page.





    Note for developers

    The latest plugin code is on github.


    setrating cli command:

    • ['ratingslight', 'setrating', 'trackid', 'rating', 'incremental'] (expects a rating value in the range of 0 to 5, half-star ratings supported)

    • ['ratingslight', 'setratingpercent', 'trackid', 'rating', 'incremental'] (expects a rating value in the range of 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 current rating value.

    Example 1: 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.

    Example 2: You could use incremental rating changes with the KidsPlay plugin. Map this command to a button on your Boom or Radio 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:+;

    You can also get notified of track rating changes by subscribing to

    • applets: /slim/ratingslightchangedratingupdate

    • plugins: ['ratingslight', 'changedrating']





    Related

    If you don't mind using CLI commands and you've always wanted the Now Playing screen of your piCorePlayer, Squeezebox Touch or Radio to display track ratings, here's one way to do it.








    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.
    Last edited by afriend; 2021-04-15 at 02:51.

  2. #2
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    11,285
    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
    220
    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,285
    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
    619
    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
    220
    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.

  7. #7
    Senior Member flipflip's Avatar
    Join Date
    Apr 2006
    Location
    Swissaland
    Posts
    1,420
    Many thanks for the plugin!

    Can I map a button on the remote to set a rating? E.g "add.hold = <set-5-stars-on-current-track>"?

  8. #8
    Senior Member
    Join Date
    Jul 2010
    Posts
    220
    Quote Originally Posted by flipflip View Post
    Can I map a button on the remote to set a rating? E.g "add.hold = <set-5-stars-on-current-track>"?
    You mean by using a custom IR map? Right now there's no support for IR buttons. Trying to add even some basic support is going to be very tricky for me because I don't own a working IR for LMS (devices) that I could use for testing.
    I can't make any promises but if I come up with something I'll let you know here in this thread.

  9. #9
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    11,285
    Quote Originally Posted by afriend View Post
    Trying to add even some basic support is going to be very tricky for me because I don't own a working IR for LMS (devices) that I could use for testing.
    I can't make any promises but if I come up with something I'll let you know here in this thread.
    If SoftSqueeze still works you should be able to use that for testning, it emulates the old classic Squeezebox devices including the remote. Not sure IR button control is possible on the new devices (Touch/Radio), if I remember correctly they process the IR commands on the device so it isn’t possible to override them in a plugin.

    TrackStat implements IR functions to set rating when holding a number button if you like some code to look at. Let me know if you need help and I’ll try to see if I can remember how it worked.
    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 )

  10. #10
    Senior Member flipflip's Avatar
    Join Date
    Apr 2006
    Location
    Swissaland
    Posts
    1,420
    Good input, thanks!

    I'll have a look at the TrackStat implementation and I'll play with the ratings plugin code

    I vaguely remember "IR maps" and similar things from my time playing with the code. Loooong time ago...

    Any other input how this is best implemented is most welcome. "Custom IR map" doesn't sound too tempting really. I'd rather have this in some plugin code and ideally exposed to the settings interface.

    Somewhere in the forum I read that "LMS now comes with built-in rating support" and (I think) "[which] can be enabled in settings". I didn't find any reference to this besides some code, which appears to be some API for getting/setting track ratings.
    Am I right in assuming that there is no UI for getting/setting ratings in vanilla LMS? And hence we need to implement that ourselves? Which is what the Ratings Light plugin is all about?

    I do see my (Ratings Light) ratings in persist.db in table tracks_persistent. I guess that table is from vanilla LMS and the plugin is populating the "rating" field (column), right?

    Anyway, I will dig a bit deeper sometimes.

Posting Permissions

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