I’m trying to move my movie library over to IMDB ratings, so I set the ratings source to IMDB and refreshed metadata for that entire library. Quite a few movies still used TMDB ratings.
I refreshed everything again. Imagine my surprise when some movies that used to have IMDB ratings now have TMDB ratings instead!
Reading the log files and going through the PlexMovie.bundle code reveals the following:
-
The agent always begins by reading TMDB data, then overwrites that data with IMDB data for those fields that were not explicitly set to use TMDB as a source.
-
Sometimes the agent succeeds in reading from TMDB but fails to read anything from IMDB, resulting in the following messages in com.plexapp.agents.imdb.log:
Plex_Movie_FAILED - Error obtaining Plex movie data for [index]: <urlopen error ('The read operation timed out',)>
- This means that the TMDB values are still there, and are never “overwritten” by IMDB values in the new metadata object being constructed in memory. The problem is that the agent doesn’t terminate the update. It continues, resulting in followup exceptions and log messages because the ‘movie’ variable is undefined/None so the agent can’t extract the expected information from it:
Error obtaining extras for 0468569: 'NoneType' object has no attribute 'xpath'
Error obtaining Rotten tomato data for 0468569: 'NoneType' object has no attribute 'xpath'
Then it saves the TMDB-based data, causing the old IMDB-based information that already existed in my library to be overwritten:
Serializing to /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Metadata/Movies/1/5c3ebc654f842202387b9b25177ff74255acf8d.bundle/Contents/com.plexapp.agents.imdb/Info.xml
Since I’m likely to get at least some IMDB timeouts every time I refresh the metadata for an entire library, it seems this is never going to work unless I manually refresh exactly those entries that failed. If I schedule metadata to be refreshed periodically I’m also likely to get entries that oscillate between IMDB and TMDB.
Unless the cache takes care of this to some extent, so that we eventually reach a fixpoint? In any case, this seems like a clear bug. The agent already raises a RuntimeWarning if there is a response that doesn’t contain a title; it just ignores the case where there is no response at all.