I am reorganizing the code of my plugin - and as a result have moved some of it into the Contents/Services/Shared Code directory.
This now works fine, with one last crucial issue: I cannot use @route.
I.e., if I put the following in my shared code file:
@route('/video/mythrecordings/GetRecordingInfo', allow_sync=True)
def RecordingInfo(chanId, startTime, seriesInetRef = None):
Log('RecordingInfo')
...etc...
I get the following error in my log:
2015-03-05 12:14:29,286 (7f518affd700) : DEBUG (services:362) - Loaded services
2015-03-05 12:14:29,290 (7f518a7fc700) : DEBUG (services:433) - Loading 2 shared code modules
2015-03-05 12:14:29,399 (7f518a7fc700) : CRITICAL (services:441) - Error loading shared code (most recent call last):
File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/services.py", line 435, in _setup_shared_code_sandbox
sandbox.execute(code)
File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 256, in execute
exec(code) in self.environment
File "", line 2, in
File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 333, in __import__
return mod.load_module(_name)
File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 44, in load_module
module = RestrictedModule(name, path, sandbox)
File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/loader.py", line 30, in __init__
exec(code) in self.__dict__
File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/MythRecordings.bundle/Contents/Services/Shared Code/plexmythui.pys", line 257, in
@route('/video/mythrecordings/GetRecordingInfo', allow_sync=True)
NameError: name 'route' is not defined
If I remove the @route, the error goes away, and the code works - but I'm unable to sync anymore.
I probably just need to import something, but my Python knowledge is to feeble to figure it out.
I tried from routes import route, which I found in the Framework bundle - put that went totally pear shaped.