Add error message for PKC playback failure

This commit is contained in:
tomkat83 2017-02-02 08:30:40 +01:00
parent a782075236
commit f82aa0511d

View file

@ -9,7 +9,7 @@ from urlparse import parse_qsl
from xbmc import translatePath, sleep, executebuiltin
from xbmcaddon import Addon
from xbmcgui import ListItem, Dialog
from xbmcgui import ListItem
from xbmcplugin import setResolvedUrl
_addon = Addon(id='plugin.video.plexkodiconnect')
@ -32,7 +32,8 @@ sys_path.append(_base_resource)
###############################################################################
import entrypoint
from utils import window, pickl_window, reset, passwordsXML, language as lang
from utils import window, pickl_window, reset, passwordsXML, language as lang,\
dialog
from pickler import unpickle_me
from PKC_listitem import convert_PKC_to_listitem
@ -45,7 +46,6 @@ log = logging.getLogger("PLEX.default")
###############################################################################
ARGV = argv
HANDLE = int(argv[1])
@ -54,9 +54,9 @@ class Main():
# MAIN ENTRY POINT
# @utils.profiling()
def __init__(self):
log.debug("Full sys.argv received: %s" % ARGV)
log.debug("Full sys.argv received: %s" % argv)
# Parse parameters
params = dict(parse_qsl(ARGV[2][1:]))
params = dict(parse_qsl(argv[2][1:]))
try:
mode = params['mode']
itemid = params.get('id', '')
@ -67,15 +67,20 @@ class Main():
if mode == 'play':
# Put the request into the "queue"
while window('plex_play_new_item'):
sleep(20)
sleep(50)
window('plex_play_new_item',
value='%s%s' % (mode, ARGV[2]))
value='%s%s' % (mode, argv[2]))
# Wait for the result
while not pickl_window('plex_result'):
sleep(20)
sleep(50)
result = unpickle_me()
if result is None:
log.error('Error encountered, aborting')
dialog('notification',
heading='{plex}',
message=lang(30128),
icon='{error}',
time=3000)
setResolvedUrl(HANDLE, False, ListItem())
elif result.listitem:
listitem = convert_PKC_to_listitem(result.listitem)
@ -102,8 +107,8 @@ class Main():
'Plex_Node': entrypoint.Plex_Node
}
if "/extrafanart" in ARGV[0]:
plexpath = ARGV[2][1:]
if "/extrafanart" in argv[0]:
plexpath = argv[2][1:]
plexid = params.get('id')
entrypoint.getExtraFanArt(plexid, plexpath)
entrypoint.getVideoFiles(plexid, plexpath)
@ -114,8 +119,8 @@ class Main():
window('plex_runLibScan', value='fanart')
# Called by e.g. 3rd party plugin video extras
if ("/Extras" in ARGV[0] or "/VideoFiles" in ARGV[0] or
"/Extras" in ARGV[2]):
if ("/Extras" in argv[0] or "/VideoFiles" in argv[0] or
"/Extras" in argv[2]):
plexId = params.get('id', None)
entrypoint.getVideoFiles(plexId, params)
@ -153,7 +158,7 @@ class Main():
folderid = params['folderid']
modes[mode](itemid, folderid)
elif mode == "companion":
modes[mode](itemid, params=ARGV[2])
modes[mode](itemid, params=argv[2])
elif mode == 'Plex_Node':
modes[mode](params.get('id'),
params.get('viewOffset'),
@ -167,10 +172,9 @@ class Main():
elif mode in ("manualsync", "repair"):
if window('plex_online') != "true":
# Server is not online, do not run the sync
Dialog().ok(
lang(29999),
"Unable to run the sync, the add-on is not connected "
"to a Plex server.")
dialog('ok',
heading=lang(29999),
message=lang(39205))
log.error("Not connected to a PMS.")
else:
if mode == 'repair':