Want PlexThemeMusic to contribute to my Custom Metadata Agent

I was wondering if there is anything special that needs to happen from a coding perspective in order to get the PlexThemeMusic agent to contribute to my custom SageTV scanner?  I have created the following in the BMTAgentTVShows.bundle init.py:

 

 

class BMTAgentTVShows(Agent.TV_Shows):
  name = 'SageTV BMT Agent (TV Shows)'
  languages = [Locale.Language.English]
  primary_provider = False
  accepts_from = ['com.plexapp.agents.plexthememusic']
 
 
The above allows the thememusic to show up under the Settings->Agents section for TVShows.  I also now have the ability to re order it within my custom metadata agent section in the Webui.
 
I see that the ThemeMusic is getting called as it should, but always results with the following error:
 
013-03-20 11:55:41,904 (-4faed000) :  INFO (agentkit:914) - Searching for matches for {'guid': 'com.plexapp.agents.bmtagenttvshows://15009632?lang=en', 'force': True, 'primary_agent': 'com.plexapp.agents.bmtagenttvshows'}
2013-03-20 11:55:41,905 (-4faed000) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.bmtagenttvshows://15009632?lang=en
2013-03-20 11:55:41,905 (-4faed000) :  DEBUG (model:223) - Deserializing from /Users/mreid/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/f80481029bf8f10ad8621bc2566929da6b0c8aa.bundle/Contents/com.plexapp.agents.bmtagenttvshows/Info.xml
2013-03-20 11:55:41,909 (-4faed000) :  DEBUG (runtime:896) - Response: [200] str, 608 bytes
2013-03-20 11:55:41,916 (-4faed000) :  DEBUG (runtime:700) - Handling request GET /:/plugins/com.plexapp.agents.plexthememusic/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKNwpzMgplbnM0CmxhbmdiMXM1CmZvcmNlbnMxMApwYXJlbnRHVUlEczcKVFZfU2hvd3MxMAptZWRpYV90eXBlczMKMzA2czQKZGJpZHM1Mwpjb20ucGxleGFwcC5hZ2VudHMuYm10YWdlbnR0dnNob3dzOi8vMTUwMDk2MzI%40bGFuZz1lbnM0Cmd1aWRzOAoxNTAwOTYzMnMyCmlkcjAK
2013-03-20 11:55:41,917 (-4faed000) :  DEBUG (runtime:796) - Found route matching /:/plugins/com.plexapp.agents.plexthememusic/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKNwpzMgplbnM0CmxhbmdiMXM1CmZvcmNlbnMxMApwYXJlbnRHVUlEczcKVFZfU2hvd3MxMAptZWRpYV90eXBlczMKMzA2czQKZGJpZHM1Mwpjb20ucGxleGFwcC5hZ2VudHMuYm10YWdlbnR0dnNob3dzOi8vMTUwMDk2MzI@bGFuZz1lbnM0Cmd1aWRzOAoxNTAwOTYzMnMyCmlkcjAK
2013-03-20 11:55:41,918 (-4faed000) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.bmtagenttvshows://15009632?lang=en
2013-03-20 11:55:41,918 (-4faed000) :  ERROR (model:194) - Cannot read model from /Users/mreid/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/f80481029bf8f10ad8621bc2566929da6b0c8aa.bundle/Contents/com.plexapp.agents.plexthememusic
2013-03-20 11:55:41,919 (-4faed000) :  DEBUG (networking:172) - Requesting 'http://127.0.0.1:32400/library/metadata/306/tree'
2013-03-20 11:55:41,930 (-4faed000) :  DEBUG (networking:172) - Requesting 'http://tvthemes.plexapp.com/15009632.mp3'
2013-03-20 11:55:42,022 (-4faed000) :  ERROR (networking:219) - Error opening URL 'http://tvthemes.plexapp.com/15009632.mp3'
2013-03-20 11:55:42,023 (-4faed000) :  DEBUG (model:218) - Serializing to /Users/mreid/Library/Application Support/Plex Media Server/Metadata/TV Shows/7/f80481029bf8f10ad8621bc2566929da6b0c8aa.bundle/Contents/com.plexapp.agents.plexthememusic/Info.xml
2013-03-20 11:55:42,026 (-4faed000) :  DEBUG (runtime:896) - Response: [200] str, 16 bytes

 

Any ideas, or is there something i am potentially overlooking from a code perspective?

 

 

The PlexThemeMusic agent can only work if it gets a TVDB id as input. The primary agent is responsible for looking up this id.

All secondary agents have to work with the id provided by the primary agent.

The PlexThemeMusic agent can only work if it gets a TVDB id as input. The primary agent is responsible for looking up this id.

All secondary agents have to work with the id provided by the primary agent.

Awesome, Thank you for your response, that helps a lot.

Actually, I should have asked you this before also.  What is the metadata item called in the TVShows container which holds the TVDBID for a TV Episode?  I was looking at the documentation but i don't see it there...

The primary agent determines the id, it is then available to the secondary agent. Inside the search method, you have it available as media.primary_metadata.id. In the update method it's available as metadata.id.

Edit: I just notice that your agent is not a primary agent (primary_provider = False), but I don't see contributes_to = ['com.plexapp.agents.xxx']

To what other agent(s) does your agent contribute metadata?

That was a copy paste error on my part.  IT should be the Primary.

also my search function is not allowing for media.primary_metadata.id.  It is telling me:

 media.primary_metadata.id = extrainfo.get('MediaProviderDataID')
AttributeError: 'NoneType' object has no attribute 'id'

You cannot set media.primary_metadata.id, the value is coming from another agent and you can use the value to do your own search.

That makes sense.  I actually got it to work via the update method metadata.id.  Thanks again for your help on this.  It is much appreciated.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.