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