2016-01-12 02:53:41 +11:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2016-10-23 02:15:10 +11:00
|
|
|
###############################################################################
|
2017-09-10 23:09:32 +10:00
|
|
|
from os import path as os_path
|
|
|
|
from sys import path as sys_path
|
2016-01-12 02:53:41 +11:00
|
|
|
|
2017-09-10 23:09:32 +10:00
|
|
|
from xbmcaddon import Addon
|
2017-09-10 23:17:35 +10:00
|
|
|
from xbmc import translatePath, sleep, log, LOGERROR
|
2017-09-10 23:09:32 +10:00
|
|
|
from xbmcgui import Window
|
2016-01-12 02:53:41 +11:00
|
|
|
|
2017-09-10 23:09:32 +10:00
|
|
|
_addon = Addon(id='plugin.video.plexkodiconnect')
|
2016-10-23 02:15:10 +11:00
|
|
|
try:
|
|
|
|
_addon_path = _addon.getAddonInfo('path').decode('utf-8')
|
|
|
|
except TypeError:
|
|
|
|
_addon_path = _addon.getAddonInfo('path').decode()
|
|
|
|
try:
|
2017-09-10 23:09:32 +10:00
|
|
|
_base_resource = translatePath(os_path.join(
|
2016-10-23 02:15:10 +11:00
|
|
|
_addon_path,
|
|
|
|
'resources',
|
|
|
|
'lib')).decode('utf-8')
|
|
|
|
except TypeError:
|
2017-09-10 23:09:32 +10:00
|
|
|
_base_resource = translatePath(os_path.join(
|
2016-10-23 02:15:10 +11:00
|
|
|
_addon_path,
|
|
|
|
'resources',
|
|
|
|
'lib')).decode()
|
2017-09-10 23:09:32 +10:00
|
|
|
sys_path.append(_base_resource)
|
2016-04-07 16:34:01 +10:00
|
|
|
|
2017-09-10 23:09:32 +10:00
|
|
|
from pickler import unpickle_me, pickl_window
|
2016-01-12 02:53:41 +11:00
|
|
|
|
2016-10-23 02:15:10 +11:00
|
|
|
###############################################################################
|
2016-08-30 02:44:27 +10:00
|
|
|
|
2016-10-23 02:15:10 +11:00
|
|
|
if __name__ == "__main__":
|
2017-09-10 23:09:32 +10:00
|
|
|
win = Window(10000)
|
|
|
|
while win.getProperty('plex_command'):
|
|
|
|
sleep(20)
|
|
|
|
win.setProperty('plex_command', 'CONTEXT_menu')
|
|
|
|
while not pickl_window('plex_result'):
|
|
|
|
sleep(50)
|
|
|
|
result = unpickle_me()
|
|
|
|
if result is None:
|
2017-09-10 23:17:35 +10:00
|
|
|
log('PLEX.%s: Error encountered, aborting' % __name__, level=LOGERROR)
|