I’ve banged my head against a wall for too long trying to get the Plex API to do something coherent with regard to ratings that I’ve given up on anything automated.
It increasingly felt like vendor lock-in, so I now embed the rating into the Genre tag, which seems to be the most widely readable/interoperable way to get this data across platforms.
-
NOTE 1: The following is admittedly a time-intensive project, depending on the size of your library.
-
NOTE 2: It is also an admittedly hacky way of getting around Plex’s poor handling of tags.
-
NOTE 3: As you’ll likely notice, I don’t personally use the genre tag for much of anything other than a transport for core data that aids in the creation of rating-based playlists. If you extensively populate the Genre tag with per-track classifications, they can get a little unwieldy.
-
Note 4: This may not satisfy your end-goal. It is primarily intended to highlight one possible solution as a jump-off point focused on reproducibility across self-hosted platforms, along with the power of scripting. If this is the case, please feel free to expand your question.
For each track, I have a script that automatically creates a user-defined TXXX tag titled “r_track_rating” and assigns the value to “0” if it’s empty. (r_ is just an easy reference for me as it’s my first name’s initial letter. This can be just about anything, but the whole string should always be lowercase as different file formats handle casing differently.)
$if($not(%r_track_rating%),$set(r_track_rating,0))
I then have scripts that I can choose from the context menu to apply the desired rating (e.g., 5, 4, 3, etc.).
$set(r_track_rating,5)
It ends up looking something like this (I also embed the artist’s country of origin and the year of release for easier playlist creation):
Note that there’s also some logic in the rating setting script that takes the r_track_rating (among others) and puts it into the standard Genre tag.
$noop(Set rtag)
$set(r_track_rating,5)
$noop( ######### CODE BLOCK BEGIN - GENRE SETTER ######### )
$noop( ######### CODE BLOCK BEGIN - GENRE SETTER ######### )
$noop( ######### CODE BLOCK BEGIN - GENRE SETTER ######### )
$noop(Clear GENRE tag to avoid duplicates)
$set(genre,)
$noop(Setters: VARIABLES)
$set(_01,⭐ %r_track_rating%)
$set(_02,🗓️ %r_year_added%)
$set(_03,🌍 %r_artist_country%)
$set(_04,%r_artist_local_mn%)
$set(_05,%r_artist_queer%)
$set(_06,%r_group_focus%)
$set(_07,%r_group_redacted%)
$set(_08,%r_group_j_cult%)
$set(_09,%r_group_christmas%)
$set(_10,%r_group_geil%)
$set(_11,%r_group_long_mix%)
$set(_12,%r_group_compilation%)
$set(_13,%r_group_soundtrack%)
$set(_14,%r_group_comedy%)
$noop(Getters: Assign GENRE tags from VARIABLES)
$copymerge(genre,_01)
$copymerge(genre,_02)
$copymerge(genre,_03)
$copymerge(genre,_04)
$copymerge(genre,_05)
$copymerge(genre,_06)
$copymerge(genre,_07)
$copymerge(genre,_08)
$copymerge(genre,_09)
$copymerge(genre,_10)
$copymerge(genre,_11)
$copymerge(genre,_12)
$copymerge(genre,_13)
$copymerge(genre,_14)
$noop(Flatten multivalue tags as Plex does not support them)
$set(genre,%genre%)
$noop( ######### CODE BLOCK END - GENRE SETTER ######### )
$noop( ######### CODE BLOCK END - GENRE SETTER ######### )
$noop( ######### CODE BLOCK END - GENRE SETTER ######### )
All of this gets you something like the following in Picard, with the Genre tag now populating data such as rating, release year, country, etc. :
And the following in Plex:
From there, Navidrome et al. should be able to read this rating, which you can use to create playlists of rated tracks, or rate the track within Navidrome.
Regarding importing ratings into MusicBrainz: this is another area I’ve paused pursuing myself as it personally feels a little clunky, doesn’t quite work how I expect it to, and means relying on another party to store this data. However, there may be others that have better ideas on how this can be accomplished.