Skip to content

Instantly share code, notes, and snippets.

@mikew
Last active December 14, 2015 02:09
Show Gist options
  • Select an option

  • Save mikew/5011984 to your computer and use it in GitHub Desktop.

Select an option

Save mikew/5011984 to your computer and use it in GitHub Desktop.
How to get Log, Dict, XML, et al from Plex plugin __init__.py to Shared/Libraries
# Contents/Code/__init__.py
import bridge
import library
to_export = dict(Log = Log, Dict = Dict)
bridge.init(**to_export)
def Start():
library.test()
# Contents/Libraries/Shared/bridge.py
config = dict()
def init(**kwargs):
global config
for key, value in kwargs.iteritems():
if key in config: continue
config[key] = value
# Contents/Libraries/Shared/library.py
import bridge
def test():
# this will log to com.plexapp.plugin.foo.log
bridge.config['Dict']['foo'] = 'bar'
bridge.config['Log']('Dict[foo] is %s' % config['Dict']['foo'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment