Metadata Agent pulls latest data but doesn't update Plex

Hi,

I have written a Metadata Agent for sports that runs off thesportsdb, find it here: https://github.com/mmmmmtasty/SportScanner

I have an issue by which an episode is matched, but if anything on thesportsdb.com changes, for example the description, that change is detected by the agent, saved, but does not actually take effect in Plex. I can see that the change is saved to disk but it looks like it creates a NEW season to contain this information, doesn’t update the existing one.

Looking at the code:

episode = metadata.seasons[s].episodes[e]

So I now have an object that represents my episode. Then I pull the metadata for that episode, print it out and assign it to the episode object:

Log("SS: summary: {0}".format(summary)) episode.summary = summary

Looking at the log file I can see that the summary at this point is the NEW UPDATED summary from thesportsdb. At the end of the log file you can see that the information for the episode is serialised:

2016-04-03 19:28:34,546 (1770) : DEBUG (model:229) - Serializing to C:\Users\<User>\AppData\Local\Plex Media Server\Metadata\TV Shows\1\e66f0dcbcb4dbe92a934efa36f71737c480d508.bundle\Contents\com.plexapp.agents.sportscanner\Info.xml

If I go and check out this directory I can see that the updated information is saved here, but ONLY the items that have been updated exist in this directory, it does not seem to have updated the original show metadata on disk, just created a new set of metadata with the updated episodes in it. This update is NOT reflected in the Plex interface.

Do I need to be doing something special to make sure that I update the existing metadata rather than creating some new orphaned piece of metadata? I have looked through other agents and cannot see anything that I am doing differently…

Thanks so much for any help I can get here.

MmmmmTasty

Very very nice! Thanks a lot! I wish that they would add tennis on the db.
btw, unfortunately I can’t provide any input on your issue here.