Compatibility with Kodi Krypton Alpha 2
This commit is contained in:
parent
1136178381
commit
25c777bcad
2 changed files with 61 additions and 66 deletions
|
@ -28,11 +28,6 @@ import variables as v
|
||||||
###############################################################################
|
###############################################################################
|
||||||
LOG = getLogger("PLEX." + __name__)
|
LOG = getLogger("PLEX." + __name__)
|
||||||
|
|
||||||
try:
|
|
||||||
HANDLE = int(argv[1])
|
|
||||||
ARGV_0 = argv[0]
|
|
||||||
except IndexError:
|
|
||||||
pass
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,7 +120,7 @@ def directory_item(label, path, folder=True):
|
||||||
{"fanart": "special://home/addons/plugin.video.plexkodiconnect/fanart.jpg"})
|
{"fanart": "special://home/addons/plugin.video.plexkodiconnect/fanart.jpg"})
|
||||||
listitem.setArt(
|
listitem.setArt(
|
||||||
{"landscape":"special://home/addons/plugin.video.plexkodiconnect/fanart.jpg"})
|
{"landscape":"special://home/addons/plugin.video.plexkodiconnect/fanart.jpg"})
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url=path,
|
url=path,
|
||||||
listitem=listitem,
|
listitem=listitem,
|
||||||
isFolder=folder)
|
isFolder=folder)
|
||||||
|
@ -136,7 +131,7 @@ def show_main_menu(content_type=None):
|
||||||
Shows the main PKC menu listing with all libraries, Channel, settings, etc.
|
Shows the main PKC menu listing with all libraries, Channel, settings, etc.
|
||||||
"""
|
"""
|
||||||
LOG.debug('Do main listing with content_type: %s', content_type)
|
LOG.debug('Do main listing with content_type: %s', content_type)
|
||||||
xbmcplugin.setContent(HANDLE, 'files')
|
xbmcplugin.setContent(int(argv[1]), 'files')
|
||||||
# Get emby nodes from the window props
|
# Get emby nodes from the window props
|
||||||
plexprops = window('Plex.nodes.total')
|
plexprops = window('Plex.nodes.total')
|
||||||
if plexprops:
|
if plexprops:
|
||||||
|
@ -177,7 +172,7 @@ def show_main_menu(content_type=None):
|
||||||
"plugin://%s?mode=refreshplaylist" % v.ADDON_ID)
|
"plugin://%s?mode=refreshplaylist" % v.ADDON_ID)
|
||||||
directory_item(lang(39204),
|
directory_item(lang(39204),
|
||||||
"plugin://%s?mode=manualsync" % v.ADDON_ID)
|
"plugin://%s?mode=manualsync" % v.ADDON_ID)
|
||||||
xbmcplugin.endOfDirectory(HANDLE)
|
xbmcplugin.endOfDirectory(int(argv[1]))
|
||||||
|
|
||||||
|
|
||||||
def switch_plex_user():
|
def switch_plex_user():
|
||||||
|
@ -275,7 +270,7 @@ def next_up_episodes(tagname, limit):
|
||||||
count = 0
|
count = 0
|
||||||
# if the addon is called with nextup parameter,
|
# if the addon is called with nextup parameter,
|
||||||
# we return the nextepisodes list of the given tagname
|
# we return the nextepisodes list of the given tagname
|
||||||
xbmcplugin.setContent(HANDLE, 'episodes')
|
xbmcplugin.setContent(int(argv[1]), 'episodes')
|
||||||
# First we get a list of all the TV shows - filtered by tag
|
# First we get a list of all the TV shows - filtered by tag
|
||||||
params = {
|
params = {
|
||||||
'sort': {'order': "descending", 'method': "lastplayed"},
|
'sort': {'order': "descending", 'method': "lastplayed"},
|
||||||
|
@ -324,13 +319,13 @@ def next_up_episodes(tagname, limit):
|
||||||
'limits': {"end": 1}
|
'limits': {"end": 1}
|
||||||
}
|
}
|
||||||
for episode in js.get_episodes(params):
|
for episode in js.get_episodes(params):
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url=episode['file'],
|
url=episode['file'],
|
||||||
listitem=create_listitem(episode))
|
listitem=create_listitem(episode))
|
||||||
count += 1
|
count += 1
|
||||||
if count == limit:
|
if count == limit:
|
||||||
break
|
break
|
||||||
xbmcplugin.endOfDirectory(handle=HANDLE)
|
xbmcplugin.endOfDirectory(handle=int(argv[1]))
|
||||||
|
|
||||||
|
|
||||||
def in_progress_episodes(tagname, limit):
|
def in_progress_episodes(tagname, limit):
|
||||||
|
@ -340,7 +335,7 @@ def in_progress_episodes(tagname, limit):
|
||||||
count = 0
|
count = 0
|
||||||
# if the addon is called with inprogressepisodes parameter,
|
# if the addon is called with inprogressepisodes parameter,
|
||||||
# we return the inprogressepisodes list of the given tagname
|
# we return the inprogressepisodes list of the given tagname
|
||||||
xbmcplugin.setContent(HANDLE, 'episodes')
|
xbmcplugin.setContent(int(argv[1]), 'episodes')
|
||||||
# First we get a list of all the in-progress TV shows - filtered by tag
|
# First we get a list of all the in-progress TV shows - filtered by tag
|
||||||
params = {
|
params = {
|
||||||
'sort': {'order': "descending", 'method': "lastplayed"},
|
'sort': {'order': "descending", 'method': "lastplayed"},
|
||||||
|
@ -366,13 +361,13 @@ def in_progress_episodes(tagname, limit):
|
||||||
"lastplayed"]
|
"lastplayed"]
|
||||||
}
|
}
|
||||||
for episode in js.get_episodes(params):
|
for episode in js.get_episodes(params):
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url=episode['file'],
|
url=episode['file'],
|
||||||
listitem=create_listitem(episode))
|
listitem=create_listitem(episode))
|
||||||
count += 1
|
count += 1
|
||||||
if count == limit:
|
if count == limit:
|
||||||
break
|
break
|
||||||
xbmcplugin.endOfDirectory(handle=HANDLE)
|
xbmcplugin.endOfDirectory(handle=int(argv[1]))
|
||||||
|
|
||||||
|
|
||||||
def recent_episodes(mediatype, tagname, limit):
|
def recent_episodes(mediatype, tagname, limit):
|
||||||
|
@ -382,7 +377,7 @@ def recent_episodes(mediatype, tagname, limit):
|
||||||
count = 0
|
count = 0
|
||||||
# if the addon is called with recentepisodes parameter,
|
# if the addon is called with recentepisodes parameter,
|
||||||
# we return the recentepisodes list of the given tagname
|
# we return the recentepisodes list of the given tagname
|
||||||
xbmcplugin.setContent(HANDLE, 'episodes')
|
xbmcplugin.setContent(int(argv[1]), 'episodes')
|
||||||
append_show_title = settings('RecentTvAppendShow') == 'true'
|
append_show_title = settings('RecentTvAppendShow') == 'true'
|
||||||
append_sxxexx = settings('RecentTvAppendSeason') == 'true'
|
append_sxxexx = settings('RecentTvAppendSeason') == 'true'
|
||||||
# First we get a list of all the TV shows - filtered by tag
|
# First we get a list of all the TV shows - filtered by tag
|
||||||
|
@ -412,13 +407,13 @@ def recent_episodes(mediatype, tagname, limit):
|
||||||
listitem = create_listitem(episode,
|
listitem = create_listitem(episode,
|
||||||
append_show_title=append_show_title,
|
append_show_title=append_show_title,
|
||||||
append_sxxexx=append_sxxexx)
|
append_sxxexx=append_sxxexx)
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url=episode['file'],
|
url=episode['file'],
|
||||||
listitem=listitem)
|
listitem=listitem)
|
||||||
count += 1
|
count += 1
|
||||||
if count == limit:
|
if count == limit:
|
||||||
break
|
break
|
||||||
xbmcplugin.endOfDirectory(handle=HANDLE)
|
xbmcplugin.endOfDirectory(handle=int(argv[1]))
|
||||||
|
|
||||||
|
|
||||||
def get_video_files(plex_id, params):
|
def get_video_files(plex_id, params):
|
||||||
|
@ -442,14 +437,14 @@ def get_video_files(plex_id, params):
|
||||||
|
|
||||||
if plex_id is None:
|
if plex_id is None:
|
||||||
LOG.info('No Plex ID found, abort getting Extras')
|
LOG.info('No Plex ID found, abort getting Extras')
|
||||||
return xbmcplugin.endOfDirectory(HANDLE)
|
return xbmcplugin.endOfDirectory(int(argv[1]))
|
||||||
|
|
||||||
item = GetPlexMetadata(plex_id)
|
item = GetPlexMetadata(plex_id)
|
||||||
try:
|
try:
|
||||||
path = item[0][0][0].attrib['file']
|
path = item[0][0][0].attrib['file']
|
||||||
except (TypeError, IndexError, AttributeError, KeyError):
|
except (TypeError, IndexError, AttributeError, KeyError):
|
||||||
LOG.error('Could not get file path for item %s', plex_id)
|
LOG.error('Could not get file path for item %s', plex_id)
|
||||||
return xbmcplugin.endOfDirectory(HANDLE)
|
return xbmcplugin.endOfDirectory(int(argv[1]))
|
||||||
# Assign network protocol
|
# Assign network protocol
|
||||||
if path.startswith('\\\\'):
|
if path.startswith('\\\\'):
|
||||||
path = path.replace('\\\\', 'smb://')
|
path = path.replace('\\\\', 'smb://')
|
||||||
|
@ -464,20 +459,20 @@ def get_video_files(plex_id, params):
|
||||||
for directory in dirs:
|
for directory in dirs:
|
||||||
item_path = try_encode(join(root, directory))
|
item_path = try_encode(join(root, directory))
|
||||||
listitem = ListItem(item_path, path=item_path)
|
listitem = ListItem(item_path, path=item_path)
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url=item_path,
|
url=item_path,
|
||||||
listitem=listitem,
|
listitem=listitem,
|
||||||
isFolder=True)
|
isFolder=True)
|
||||||
for file in files:
|
for file in files:
|
||||||
item_path = try_encode(join(root, file))
|
item_path = try_encode(join(root, file))
|
||||||
listitem = ListItem(item_path, path=item_path)
|
listitem = ListItem(item_path, path=item_path)
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url=file,
|
url=file,
|
||||||
listitem=listitem)
|
listitem=listitem)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
LOG.error('Kodi cannot access folder %s', path)
|
LOG.error('Kodi cannot access folder %s', path)
|
||||||
xbmcplugin.endOfDirectory(HANDLE)
|
xbmcplugin.endOfDirectory(int(argv[1]))
|
||||||
|
|
||||||
|
|
||||||
@catch_exceptions(warnuser=False)
|
@catch_exceptions(warnuser=False)
|
||||||
|
@ -493,7 +488,7 @@ def extra_fanart(plex_id, plex_path):
|
||||||
plex_id = plex_path.split("/")[-2]
|
plex_id = plex_path.split("/")[-2]
|
||||||
if not plex_id:
|
if not plex_id:
|
||||||
LOG.error('Could not get a plex_id, aborting')
|
LOG.error('Could not get a plex_id, aborting')
|
||||||
return xbmcplugin.endOfDirectory(HANDLE)
|
return xbmcplugin.endOfDirectory(int(argv[1]))
|
||||||
|
|
||||||
# We need to store the images locally for this to work
|
# We need to store the images locally for this to work
|
||||||
# because of the caching system in xbmc
|
# because of the caching system in xbmc
|
||||||
|
@ -505,7 +500,7 @@ def extra_fanart(plex_id, plex_path):
|
||||||
xml = GetPlexMetadata(plex_id)
|
xml = GetPlexMetadata(plex_id)
|
||||||
if xml is None:
|
if xml is None:
|
||||||
LOG.error('Could not download metadata for %s', plex_id)
|
LOG.error('Could not download metadata for %s', plex_id)
|
||||||
return xbmcplugin.endOfDirectory(HANDLE)
|
return xbmcplugin.endOfDirectory(int(argv[1]))
|
||||||
|
|
||||||
api = API(xml[0])
|
api = API(xml[0])
|
||||||
backdrops = api.artwork()['Backdrop']
|
backdrops = api.artwork()['Backdrop']
|
||||||
|
@ -514,7 +509,7 @@ def extra_fanart(plex_id, plex_path):
|
||||||
art_file = try_encode(join(fanart_dir, "fanart%.3d.jpg" % count))
|
art_file = try_encode(join(fanart_dir, "fanart%.3d.jpg" % count))
|
||||||
listitem = ListItem("%.3d" % count, path=art_file)
|
listitem = ListItem("%.3d" % count, path=art_file)
|
||||||
xbmcplugin.addDirectoryItem(
|
xbmcplugin.addDirectoryItem(
|
||||||
handle=HANDLE,
|
handle=int(argv[1]),
|
||||||
url=art_file,
|
url=art_file,
|
||||||
listitem=listitem)
|
listitem=listitem)
|
||||||
copyfile(backdrop, try_decode(art_file))
|
copyfile(backdrop, try_decode(art_file))
|
||||||
|
@ -525,10 +520,10 @@ def extra_fanart(plex_id, plex_path):
|
||||||
for file in files:
|
for file in files:
|
||||||
art_file = try_encode(join(root, file))
|
art_file = try_encode(join(root, file))
|
||||||
listitem = ListItem(file, path=art_file)
|
listitem = ListItem(file, path=art_file)
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url=art_file,
|
url=art_file,
|
||||||
listitem=listitem)
|
listitem=listitem)
|
||||||
xbmcplugin.endOfDirectory(HANDLE)
|
xbmcplugin.endOfDirectory(int(argv[1]))
|
||||||
|
|
||||||
|
|
||||||
def on_deck_episodes(viewid, tagname, limit):
|
def on_deck_episodes(viewid, tagname, limit):
|
||||||
|
@ -540,7 +535,7 @@ def on_deck_episodes(viewid, tagname, limit):
|
||||||
tagname: Name of the Plex library, e.g. "My Movies"
|
tagname: Name of the Plex library, e.g. "My Movies"
|
||||||
limit: Max. number of items to retrieve, e.g. 50
|
limit: Max. number of items to retrieve, e.g. 50
|
||||||
"""
|
"""
|
||||||
xbmcplugin.setContent(HANDLE, 'episodes')
|
xbmcplugin.setContent(int(argv[1]), 'episodes')
|
||||||
append_show_title = settings('OnDeckTvAppendShow') == 'true'
|
append_show_title = settings('OnDeckTvAppendShow') == 'true'
|
||||||
append_sxxexx = settings('OnDeckTvAppendSeason') == 'true'
|
append_sxxexx = settings('OnDeckTvAppendSeason') == 'true'
|
||||||
if settings('OnDeckTVextended') == 'false':
|
if settings('OnDeckTVextended') == 'false':
|
||||||
|
@ -552,14 +547,14 @@ def on_deck_episodes(viewid, tagname, limit):
|
||||||
if counter == 300:
|
if counter == 300:
|
||||||
LOG.error('Aborting On Deck view, we were not authenticated '
|
LOG.error('Aborting On Deck view, we were not authenticated '
|
||||||
'for the PMS')
|
'for the PMS')
|
||||||
xbmcplugin.endOfDirectory(HANDLE, False)
|
xbmcplugin.endOfDirectory(int(argv[1]), False)
|
||||||
return
|
return
|
||||||
sleep(100)
|
sleep(100)
|
||||||
xml = downloadutils.DownloadUtils().downloadUrl(
|
xml = downloadutils.DownloadUtils().downloadUrl(
|
||||||
'{server}/library/sections/%s/onDeck' % viewid)
|
'{server}/library/sections/%s/onDeck' % viewid)
|
||||||
if xml in (None, 401):
|
if xml in (None, 401):
|
||||||
LOG.error('Could not download PMS xml for view %s', viewid)
|
LOG.error('Could not download PMS xml for view %s', viewid)
|
||||||
xbmcplugin.endOfDirectory(HANDLE, False)
|
xbmcplugin.endOfDirectory(int(argv[1]), False)
|
||||||
return
|
return
|
||||||
direct_paths = settings('useDirectPaths') == '1'
|
direct_paths = settings('useDirectPaths') == '1'
|
||||||
counter = 0
|
counter = 0
|
||||||
|
@ -572,14 +567,14 @@ def on_deck_episodes(viewid, tagname, limit):
|
||||||
listitem.setProperty('resumetime', str(api.resume_point()))
|
listitem.setProperty('resumetime', str(api.resume_point()))
|
||||||
path = api.path(force_first_media=False, direct_paths=direct_paths)
|
path = api.path(force_first_media=False, direct_paths=direct_paths)
|
||||||
xbmcplugin.addDirectoryItem(
|
xbmcplugin.addDirectoryItem(
|
||||||
handle=HANDLE,
|
handle=int(argv[1]),
|
||||||
url=path,
|
url=path,
|
||||||
listitem=listitem)
|
listitem=listitem)
|
||||||
counter += 1
|
counter += 1
|
||||||
if counter == limit:
|
if counter == limit:
|
||||||
break
|
break
|
||||||
xbmcplugin.endOfDirectory(
|
xbmcplugin.endOfDirectory(
|
||||||
handle=HANDLE,
|
handle=int(argv[1]),
|
||||||
cacheToDisc=settings('enableTextureCache') == 'true')
|
cacheToDisc=settings('enableTextureCache') == 'true')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -597,7 +592,7 @@ def on_deck_episodes(viewid, tagname, limit):
|
||||||
items = js.get_tv_shows(params)
|
items = js.get_tv_shows(params)
|
||||||
if not items:
|
if not items:
|
||||||
# Now items retrieved - empty directory
|
# Now items retrieved - empty directory
|
||||||
xbmcplugin.endOfDirectory(handle=HANDLE)
|
xbmcplugin.endOfDirectory(handle=int(argv[1]))
|
||||||
return
|
return
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
|
@ -649,14 +644,14 @@ def on_deck_episodes(viewid, tagname, limit):
|
||||||
listitem = create_listitem(episode,
|
listitem = create_listitem(episode,
|
||||||
append_show_title=append_show_title,
|
append_show_title=append_show_title,
|
||||||
append_sxxexx=append_sxxexx)
|
append_sxxexx=append_sxxexx)
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url=episode['file'],
|
url=episode['file'],
|
||||||
listitem=listitem,
|
listitem=listitem,
|
||||||
isFolder=False)
|
isFolder=False)
|
||||||
count += 1
|
count += 1
|
||||||
if count >= limit:
|
if count >= limit:
|
||||||
break
|
break
|
||||||
xbmcplugin.endOfDirectory(handle=HANDLE)
|
xbmcplugin.endOfDirectory(handle=int(argv[1]))
|
||||||
|
|
||||||
|
|
||||||
def watchlater():
|
def watchlater():
|
||||||
|
@ -665,10 +660,10 @@ def watchlater():
|
||||||
"""
|
"""
|
||||||
if window('plex_token') == '':
|
if window('plex_token') == '':
|
||||||
LOG.error('No watch later - not signed in to plex.tv')
|
LOG.error('No watch later - not signed in to plex.tv')
|
||||||
return xbmcplugin.endOfDirectory(HANDLE, False)
|
return xbmcplugin.endOfDirectory(int(argv[1]), False)
|
||||||
if window('plex_restricteduser') == 'true':
|
if window('plex_restricteduser') == 'true':
|
||||||
LOG.error('No watch later - restricted user')
|
LOG.error('No watch later - restricted user')
|
||||||
return xbmcplugin.endOfDirectory(HANDLE, False)
|
return xbmcplugin.endOfDirectory(int(argv[1]), False)
|
||||||
|
|
||||||
xml = downloadutils.DownloadUtils().downloadUrl(
|
xml = downloadutils.DownloadUtils().downloadUrl(
|
||||||
'https://plex.tv/pms/playlists/queue/all',
|
'https://plex.tv/pms/playlists/queue/all',
|
||||||
|
@ -676,16 +671,16 @@ def watchlater():
|
||||||
headerOptions={'X-Plex-Token': window('plex_token')})
|
headerOptions={'X-Plex-Token': window('plex_token')})
|
||||||
if xml in (None, 401):
|
if xml in (None, 401):
|
||||||
LOG.error('Could not download watch later list from plex.tv')
|
LOG.error('Could not download watch later list from plex.tv')
|
||||||
return xbmcplugin.endOfDirectory(HANDLE, False)
|
return xbmcplugin.endOfDirectory(int(argv[1]), False)
|
||||||
|
|
||||||
LOG.info('Displaying watch later plex.tv items')
|
LOG.info('Displaying watch later plex.tv items')
|
||||||
xbmcplugin.setContent(HANDLE, 'movies')
|
xbmcplugin.setContent(int(argv[1]), 'movies')
|
||||||
direct_paths = settings('useDirectPaths') == '1'
|
direct_paths = settings('useDirectPaths') == '1'
|
||||||
for item in xml:
|
for item in xml:
|
||||||
__build_item(item, direct_paths)
|
__build_item(item, direct_paths)
|
||||||
|
|
||||||
xbmcplugin.endOfDirectory(
|
xbmcplugin.endOfDirectory(
|
||||||
handle=HANDLE,
|
handle=int(argv[1]),
|
||||||
cacheToDisc=settings('enableTextureCache') == 'true')
|
cacheToDisc=settings('enableTextureCache') == 'true')
|
||||||
|
|
||||||
|
|
||||||
|
@ -698,16 +693,16 @@ def channels():
|
||||||
xml[0].attrib
|
xml[0].attrib
|
||||||
except (ValueError, AttributeError, IndexError, TypeError):
|
except (ValueError, AttributeError, IndexError, TypeError):
|
||||||
LOG.error('Could not download Plex Channels')
|
LOG.error('Could not download Plex Channels')
|
||||||
return xbmcplugin.endOfDirectory(HANDLE, False)
|
return xbmcplugin.endOfDirectory(int(argv[1]), False)
|
||||||
|
|
||||||
LOG.info('Displaying Plex Channels')
|
LOG.info('Displaying Plex Channels')
|
||||||
xbmcplugin.setContent(HANDLE, 'files')
|
xbmcplugin.setContent(int(argv[1]), 'files')
|
||||||
for method in v.SORT_METHODS_DIRECTORY:
|
for method in v.SORT_METHODS_DIRECTORY:
|
||||||
xbmcplugin.addSortMethod(HANDLE, getattr(xbmcplugin, method))
|
xbmcplugin.addSortMethod(int(argv[1]), getattr(xbmcplugin, method))
|
||||||
for item in xml:
|
for item in xml:
|
||||||
__build_folder(item)
|
__build_folder(item)
|
||||||
xbmcplugin.endOfDirectory(
|
xbmcplugin.endOfDirectory(
|
||||||
handle=HANDLE,
|
handle=int(argv[1]),
|
||||||
cacheToDisc=settings('enableTextureCache') == 'true')
|
cacheToDisc=settings('enableTextureCache') == 'true')
|
||||||
|
|
||||||
|
|
||||||
|
@ -724,7 +719,7 @@ def browse_plex(key=None, plex_section_id=None):
|
||||||
xml[0].attrib
|
xml[0].attrib
|
||||||
except (ValueError, AttributeError, IndexError, TypeError):
|
except (ValueError, AttributeError, IndexError, TypeError):
|
||||||
LOG.error('Could not browse to %s', key)
|
LOG.error('Could not browse to %s', key)
|
||||||
return xbmcplugin.endOfDirectory(HANDLE, False)
|
return xbmcplugin.endOfDirectory(int(argv[1]), False)
|
||||||
|
|
||||||
photos = False
|
photos = False
|
||||||
movies = False
|
movies = False
|
||||||
|
@ -763,45 +758,45 @@ def browse_plex(key=None, plex_section_id=None):
|
||||||
|
|
||||||
# Set the correct content type
|
# Set the correct content type
|
||||||
if movies is True:
|
if movies is True:
|
||||||
xbmcplugin.setContent(HANDLE, 'movies')
|
xbmcplugin.setContent(int(argv[1]), 'movies')
|
||||||
sort_methods = v.SORT_METHODS_MOVIES
|
sort_methods = v.SORT_METHODS_MOVIES
|
||||||
elif clips is True:
|
elif clips is True:
|
||||||
xbmcplugin.setContent(HANDLE, 'movies')
|
xbmcplugin.setContent(int(argv[1]), 'movies')
|
||||||
sort_methods = v.SORT_METHODS_CLIPS
|
sort_methods = v.SORT_METHODS_CLIPS
|
||||||
elif photos is True:
|
elif photos is True:
|
||||||
xbmcplugin.setContent(HANDLE, 'images')
|
xbmcplugin.setContent(int(argv[1]), 'images')
|
||||||
sort_methods = v.SORT_METHODS_PHOTOS
|
sort_methods = v.SORT_METHODS_PHOTOS
|
||||||
elif tvshows is True:
|
elif tvshows is True:
|
||||||
xbmcplugin.setContent(HANDLE, 'tvshows')
|
xbmcplugin.setContent(int(argv[1]), 'tvshows')
|
||||||
sort_methods = v.SORT_METHOD_TVSHOWS
|
sort_methods = v.SORT_METHOD_TVSHOWS
|
||||||
elif episodes is True:
|
elif episodes is True:
|
||||||
xbmcplugin.setContent(HANDLE, 'episodes')
|
xbmcplugin.setContent(int(argv[1]), 'episodes')
|
||||||
sort_methods = v.SORT_METHODS_EPISODES
|
sort_methods = v.SORT_METHODS_EPISODES
|
||||||
elif songs is True:
|
elif songs is True:
|
||||||
xbmcplugin.setContent(HANDLE, 'songs')
|
xbmcplugin.setContent(int(argv[1]), 'songs')
|
||||||
sort_methods = v.SORT_METHODS_SONGS
|
sort_methods = v.SORT_METHODS_SONGS
|
||||||
elif artists is True:
|
elif artists is True:
|
||||||
xbmcplugin.setContent(HANDLE, 'artists')
|
xbmcplugin.setContent(int(argv[1]), 'artists')
|
||||||
sort_methods = v.SORT_METHODS_ARTISTS
|
sort_methods = v.SORT_METHODS_ARTISTS
|
||||||
elif albums is True:
|
elif albums is True:
|
||||||
xbmcplugin.setContent(HANDLE, 'albums')
|
xbmcplugin.setContent(int(argv[1]), 'albums')
|
||||||
sort_methods = v.SORT_METHODS_ALBUMS
|
sort_methods = v.SORT_METHODS_ALBUMS
|
||||||
elif musicvideos is True:
|
elif musicvideos is True:
|
||||||
xbmcplugin.setContent(HANDLE, 'musicvideos')
|
xbmcplugin.setContent(int(argv[1]), 'musicvideos')
|
||||||
sort_methods = v.SORT_METHODS_MOVIES
|
sort_methods = v.SORT_METHODS_MOVIES
|
||||||
else:
|
else:
|
||||||
xbmcplugin.setContent(HANDLE, 'files')
|
xbmcplugin.setContent(int(argv[1]), 'files')
|
||||||
sort_methods = v.SORT_METHODS_DIRECTORY
|
sort_methods = v.SORT_METHODS_DIRECTORY
|
||||||
|
|
||||||
for method in sort_methods:
|
for method in sort_methods:
|
||||||
xbmcplugin.addSortMethod(HANDLE, getattr(xbmcplugin, method))
|
xbmcplugin.addSortMethod(int(argv[1]), getattr(xbmcplugin, method))
|
||||||
|
|
||||||
# Set the Kodi title for this view
|
# Set the Kodi title for this view
|
||||||
title = xml.attrib.get('librarySectionTitle', xml.attrib.get('title1'))
|
title = xml.attrib.get('librarySectionTitle', xml.attrib.get('title1'))
|
||||||
xbmcplugin.setPluginCategory(HANDLE, title)
|
xbmcplugin.setPluginCategory(int(argv[1]), title)
|
||||||
|
|
||||||
xbmcplugin.endOfDirectory(
|
xbmcplugin.endOfDirectory(
|
||||||
handle=HANDLE,
|
handle=int(argv[1]),
|
||||||
cacheToDisc=settings('enableTextureCache') == 'true')
|
cacheToDisc=settings('enableTextureCache') == 'true')
|
||||||
|
|
||||||
|
|
||||||
|
@ -818,7 +813,7 @@ def __build_folder(xml_element, plex_section_id=None):
|
||||||
listitem = ListItem(xml_element.attrib.get('title'))
|
listitem = ListItem(xml_element.attrib.get('title'))
|
||||||
listitem.setArt({'thumb': xml_element.attrib.get('thumb'),
|
listitem.setArt({'thumb': xml_element.attrib.get('thumb'),
|
||||||
'poster': xml_element.attrib.get('art')})
|
'poster': xml_element.attrib.get('art')})
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url="%s?%s" % (url, urlencode(params)),
|
url="%s?%s" % (url, urlencode(params)),
|
||||||
isFolder=True,
|
isFolder=True,
|
||||||
listitem=listitem)
|
listitem=listitem)
|
||||||
|
@ -844,7 +839,7 @@ def __build_item(xml_element, direct_paths):
|
||||||
url = api.path(direct_paths=direct_paths)
|
url = api.path(direct_paths=direct_paths)
|
||||||
if api.resume_point():
|
if api.resume_point():
|
||||||
listitem.setProperty('resumetime', str(api.resume_point()))
|
listitem.setProperty('resumetime', str(api.resume_point()))
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url=url,
|
url=url,
|
||||||
listitem=listitem)
|
listitem=listitem)
|
||||||
|
|
||||||
|
@ -853,20 +848,20 @@ def extras(plex_id):
|
||||||
"""
|
"""
|
||||||
Lists all extras for plex_id
|
Lists all extras for plex_id
|
||||||
"""
|
"""
|
||||||
xbmcplugin.setContent(HANDLE, 'movies')
|
xbmcplugin.setContent(int(argv[1]), 'movies')
|
||||||
xml = GetPlexMetadata(plex_id)
|
xml = GetPlexMetadata(plex_id)
|
||||||
try:
|
try:
|
||||||
xml[0].attrib
|
xml[0].attrib
|
||||||
except (TypeError, IndexError, KeyError):
|
except (TypeError, IndexError, KeyError):
|
||||||
xbmcplugin.endOfDirectory(HANDLE)
|
xbmcplugin.endOfDirectory(int(argv[1]))
|
||||||
return
|
return
|
||||||
for item in API(xml[0]).extras():
|
for item in API(xml[0]).extras():
|
||||||
api = API(item)
|
api = API(item)
|
||||||
listitem = api.create_listitem()
|
listitem = api.create_listitem()
|
||||||
xbmcplugin.addDirectoryItem(handle=HANDLE,
|
xbmcplugin.addDirectoryItem(handle=int(argv[1]),
|
||||||
url=api.path(),
|
url=api.path(),
|
||||||
listitem=listitem)
|
listitem=listitem)
|
||||||
xbmcplugin.endOfDirectory(HANDLE)
|
xbmcplugin.endOfDirectory(int(argv[1]))
|
||||||
|
|
||||||
|
|
||||||
def create_new_pms():
|
def create_new_pms():
|
||||||
|
|
|
@ -85,7 +85,7 @@ _DB_VIDEO_VERSION = {
|
||||||
15: 93, # Isengard
|
15: 93, # Isengard
|
||||||
16: 99, # Jarvis
|
16: 99, # Jarvis
|
||||||
17: 107, # Krypton
|
17: 107, # Krypton
|
||||||
18: 109 # Leia
|
18: 110 # Leia
|
||||||
}
|
}
|
||||||
DB_VIDEO_PATH = try_decode(xbmc.translatePath(
|
DB_VIDEO_PATH = try_decode(xbmc.translatePath(
|
||||||
"special://database/MyVideos%s.db" % _DB_VIDEO_VERSION[KODIVERSION]))
|
"special://database/MyVideos%s.db" % _DB_VIDEO_VERSION[KODIVERSION]))
|
||||||
|
@ -96,7 +96,7 @@ _DB_MUSIC_VERSION = {
|
||||||
15: 52, # Isengard
|
15: 52, # Isengard
|
||||||
16: 56, # Jarvis
|
16: 56, # Jarvis
|
||||||
17: 60, # Krypton
|
17: 60, # Krypton
|
||||||
18: 70 # Leia
|
18: 72 # Leia
|
||||||
}
|
}
|
||||||
DB_MUSIC_PATH = try_decode(xbmc.translatePath(
|
DB_MUSIC_PATH = try_decode(xbmc.translatePath(
|
||||||
"special://database/MyMusic%s.db" % _DB_MUSIC_VERSION[KODIVERSION]))
|
"special://database/MyMusic%s.db" % _DB_MUSIC_VERSION[KODIVERSION]))
|
||||||
|
|
Loading…
Reference in a new issue