… in Media Manager anymore.
Hi guys,I need some help. I'm fine with regexes, with XPath and all that stuff, but Plex' internal structure is still very hard to read for me, even after hours of reading other source files and endless trial and error.
The weird thing is - during my testing I at one point had my Agent shown in Media Manager, but as it did not work as I wanted it too, I continued coding and now it won't even show up.
Basics: I want to write a TV Shows agent - for rather specific files in my possession, that I see best fit in a TV Shows section.
All I need in that Agent would be the filename of the current file to analyze. I copied that part over from the *LocalMedia.bundle*
Here is what I am doing: Plex and PMS are not running. I create a copy of *TVRage.bundle* and name it **TheTestAgent.bundle**.
That way I can be sure that the directory/file structure/names are correct.
In the bundle there are the two files with content as follows:
**Contents/Info.plist**
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleDevelopmentRegion</key><br />
<string>English</string><br />
<key>CFBundleExecutable</key><br />
<string>The Test Agent</string><br />
<key>CFBundleIdentifier</key><br />
<string>com.plexapp.agents.thetestagent</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundleShortVersionString</key><br />
<string>1.0</string><br />
<key>CFBundleSignature</key><br />
<string>????</string><br />
<key>CFBundleVersion</key><br />
<string>1.0</string><br />
<key>PlexFrameworkVersion</key><br />
<string>2</string><br />
<key>PlexPluginMode</key><br />
<string>AlwaysOn</string><br />
</dict><br />
</plist><br />
**Contents/Code/__init__.py**
import re<br />
<br />
def Start():<br />
HTTP.CacheTime = CACHE_1HOUR #* 24<br />
<br />
class TheTestAgent(Agent.TV_Shows):<br />
name = 'The Test Agent'<br />
languages = [Locale.Language.English]<br />
primary_provider = True<br />
<br />
def search(self, results, media, lang):<br />
results.Append(MetadataSearchResult(id = 'null', score = 100))<br />
<br />
def update(self, metadata, media, lang):<br />
filename = media.items[0].parts[0].file.decode('utf-8')<br />
basename = os.path.basename(filename)<br />
<br />
myID = re.findall(r'[^0-9]([0-9]{4,5})[^0-9\-]', basename)[0]<br />
<br />
if 'Test Show One' in filename:<br />
metadata.title = 'AAAAALAAAAAAAARM ' + basename<br />
elif 'The Second Test' in filename:<br />
metadata.title = 'lol LOL lol ' + basename<br />
episode = metadata.seasons[2011].episodes[1]<br />
episode.title = 'testepisode' + myID<br />
else:<br />
metadata.title = 'le fail'
Very basic and simple, as I could not even get past the "let's see if I got this right and then start coding"-stage.
Most of the code is copied from the LocalMedia.bundle's __init__.py
Can anyone tell why I can't select/see this agent when creating a TV Shows section in Media Manager?
Is there a log file somewhere that would help me debugging this?