I have noticed a problem with rating some custom albums I have. The album in question has multiple songs which are from various artists. They have no track information, and most have disc=1 or unset. I notice that whenever I set the rating for one of the songs with no track+disc, all the other songs with the same track+disc pair have the same rating, and similarly for the no track + disc=1 songs.
I looked into the DB and found that these songs have no rating or rating_count set in their metadata_items row, but there are two entries in the metadata_item_settings table with guid: “com.plexapp.agents.none://32767/1/-1?lang=xn” (the disc=1 rating, the “32767” is the id for the album itself) and “com.plexapp.agents.none://32767/0/-1?lang=xn” (the disc unset rating). So clicking the rating button is only updating the rating for the all songs which have the same track+disc value within that album.
Is there any way that this behavior can be changed so that the actual individual track gets the rating, and not the disc+track pair within the given album? This is unexpected behavior as a user, as I only saw that these ratings are being duplicated across the whole album upon refreshing the screen.
Quick update for anyone else who has come across this problem and wants to repair albums with missing track / disc information. Songs in collections that have duplicated guids can be found using the following SQL query. For Linux the database is SQLite and for me was located at /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db. The SQL query has a join included so the “parent” information (e.g. the album name) is readily available. Keep in mind that I am not sure how stable Plex’s DB schema is, or whether my assumptions about it are correct, but it seems to be doing the trick for me right now.
SELECT
t2.parent_title,
t1.guid_count,
*
FROM (
SELECT
*
FROM (
SELECT
*,
COUNT(*) OVER (PARTITION BY guid) guid_count
FROM metadata_items
)
WHERE guid_count > 1
ORDER BY guid
) AS t1
LEFT JOIN (
SELECT
id AS parent_table_id,
title AS parent_title
FROM metadata_items
) AS t2
ON t2.parent_table_id = t1.parent_id;
Experiencing this problem as well. 1667 tracks affected… For example: Singles that are in the root folder but in an album as well, different album versions (UK + Japan), etc.
Not sure how to solve this without spending a lot of hours cleaning up the library - and even then I’m not sure if I can solve all of them -, so if anyone has an automatic (script) solution, please let me know!