I have an agent (primary agent) which looks for a local text file for metadata, if the text file is not present, it returns from the search with score = 0. I also set this agent with a fallback agent = com.plexapp.agents.thetvdb.
I expected the TVDB agent would be called for those files with score = 0, since those files usually have valid SxEx that would normally match TVDB.
But for some reason, TVDB never gets invoked. What am I doing wrong? How can I get TVDB agent to be used selectively?
Note that the intention is if I find the txt file with metadata, I don’t want to go to TVDB, otherwise it usually matches something totally different.
In theory that sounds right, based on this code in agentservice.py (System bundle):
<br />
# If the agent returned no results (or score too low), try to hit the fallback agent<br />
if len(result) == 0 or result[0].score < 85:<br />
fallback_identifier = self.agent_get_fallback_identifier(identifier, media_type)<br />
Your best bet might be to add some prints there, run PMS from the terminal, and see if that code is executing or not. Let us know if you see an issue and we'll address it!
I'm trying to make this work too...
import datetime, os, time, plistlib<br />
from mutagen.mp4 import MP4<br />
def Start():<br />
pass<br />
<br />
class movies(Agent.Movies):<br />
name = 'Movies'<br />
languages = [Locale.Language.English]<br />
fallback_agent = ['com.plexapp.agents.imdb']<br />
primary_provider = True<br />
#accepts_from = None<br />
#contributes_to = None<br />
<br />
def search(self, results, media, lang):<br />
filename = media.items[0].parts[0].file.decode('utf-8')<br />
(fileroot, ext) = os.path.splitext(os.path.basename(filename))<br />
if ext == ".m4v":<br />
tags = MP4(filename)<br />
try:<br />
imdbid = tags["\xa9cmt"][0]<br />
except: Log("No IMDB ID (Search): " + media.name)<br />
try:<br />
title = tags["\xa9nam"][0]<br />
except: Log("Exception in Title (Search): " + title)<br />
try:<br />
year = tags["\xa9day"][0]<br />
except: Log("Exception in Year (Search): " + title)<br />
results.Append(MetadataSearchResult(id=imdbid, name=title, year=year, lang=lang, score=100))<br />
else:<br />
results.Append(MetadataSearchResult(id='null', lang=lang, score=0))<br />
Log("Not .m4v file, using FreeBase agent instead")
I would expect that this code (which also has an "update" part) would parse all .m4vs but pass e.g. mkvs onto the Freebase agent. That is not happening, however...
I’ve asked James to check into it, but he’s on vacation so it might be a little while. I couldn’t find any examples in the wild. If you’re impatient, try adding some logs to the System bundle and see if you can figure out what’s going on 
Sorry, elan! I actually just solved this myself. I *think* that the solution was to remove the square brackets around the agent identifier:
accepts_from = "com.plexapp.agents.tvseries"
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.