Friday, September 15, 2023

Ratings can be exported and saved to the files!

    

                

Ratings can be exported and saved to the files!


Even regular users of plex do not know how ratings they gave to tracks in the music library can be exported and saved in the files. In the past, I have used a workaround which meant to create a playlist with tracks of the same rating, exporting that playlist and import it to a tagger like mp3tag.

While this can be done, there is also the possibility to use a python script which fetches the ratings of the tracks be it in the whole library or just an album or a subset of the library like for example all tracks which were rated in the last week or so.  Once this is working, it is by far a faster method to backup all ratings!

Python is not so difficult as one would expect, especially if you can get mostly helpful hints from chatgpt and the like. For starters you might take a look at some scripts on github. But beware: they usually cannot be used out of the box and must be adapted to your specific use case. 

The wonderful world of filepaths and non-standardized tagging

Under "plex_for_music, you will find two scripts which may serve as a starting point. One is updating the files the ratings of which were updated in plex in the last days, weeks or months, the other takes a different approach and updates all files with plex user ratings in a given range of albums, for example all albums which have A as the first letter in their title. It might be a good idea to start with the latter one to initially update the whole library and then use the former to update from time to time. 

If you take a look at the codes you will see that the first thing you have to do is adapting it to your setting. If there is only one operating system involved, some of the transforming stuff can be deleted. Of course you may have your own folder structure and you have to adapt the script to it. Furthermore, the code to write the rating to the files is specific for the way media monkey works and if you don't use media monkey be aware that other players might take a different approach and change the code accordingly.