Use direct file paths for on deck shows if enabled

- Fixes #30
This commit is contained in:
tomkat83 2016-05-12 20:43:53 +02:00
parent 5ec167d398
commit 04c415604d

View file

@ -1229,10 +1229,8 @@ def getRecentEpisodes(viewid, mediatype, tagname, limit):
# 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(int(sys.argv[1]), 'episodes') xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
appendShowTitle = True if \ appendShowTitle = utils.settings('RecentTvAppendShow') == 'true'
utils.settings('RecentTvAppendShow') == 'true' else False appendSxxExx = utils.settings('RecentTvAppendSeason') == 'true'
appendSxxExx = True if \
utils.settings('RecentTvAppendSeason') == 'true' else False
# 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
query = { query = {
'jsonrpc': "2.0", 'jsonrpc': "2.0",
@ -1510,10 +1508,8 @@ def getOnDeck(viewid, mediatype, tagname, limit):
limit: Max. number of items to retrieve, e.g. 50 limit: Max. number of items to retrieve, e.g. 50
""" """
xbmcplugin.setContent(int(sys.argv[1]), 'episodes') xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
appendShowTitle = True if \ appendShowTitle = utils.settings('OnDeckTvAppendShow') == 'true'
utils.settings('OnDeckTvAppendShow') == 'true' else False appendSxxExx = utils.settings('OnDeckTvAppendSeason') == 'true'
appendSxxExx = True if \
utils.settings('OnDeckTvAppendSeason') == 'true' else False
if utils.settings('OnDeckTVextended') == 'false': if utils.settings('OnDeckTVextended') == 'false':
# Chances are that this view is used on Kodi startup # Chances are that this view is used on Kodi startup
# Wait till we've connected to a PMS. At most 30s # Wait till we've connected to a PMS. At most 30s
@ -1521,13 +1517,12 @@ def getOnDeck(viewid, mediatype, tagname, limit):
while utils.window('plex_authenticated') != 'true': while utils.window('plex_authenticated') != 'true':
counter += 1 counter += 1
if counter >= 300: if counter >= 300:
break return xbmcplugin.endOfDirectory(int(sys.argv[1]), False)
xbmc.sleep(100) xbmc.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):
return xbmcplugin.endOfDirectory(int(sys.argv[1])) return xbmcplugin.endOfDirectory(int(sys.argv[1]))
url = "plugin://plugin.video.plexkodiconnect.tvshows/"
params = { params = {
'mode': "play" 'mode': "play"
} }
@ -1538,16 +1533,23 @@ def getOnDeck(viewid, mediatype, tagname, limit):
appendSxxExx=appendSxxExx) appendSxxExx=appendSxxExx)
API.AddStreamInfo(listitem) API.AddStreamInfo(listitem)
pbutils.PlaybackUtils(item).setArtwork(listitem) pbutils.PlaybackUtils(item).setArtwork(listitem)
params['id'] = API.getRatingKey() if utils.settings('useDirectPaths') == 'true':
params['dbid'] = listitem.getProperty('dbid') url = API.getFilePath()
else:
params = {
'mode': "play",
'id': API.getRatingKey(),
'dbid': listitem.getProperty('dbid')
}
url = "plugin://plugin.video.plexkodiconnect.tvshows/?%s" \
% urllib.urlencode(params)
xbmcplugin.addDirectoryItem( xbmcplugin.addDirectoryItem(
handle=int(sys.argv[1]), handle=int(sys.argv[1]),
url="%s?%s" % (url, urllib.urlencode(params)), url=url,
listitem=listitem) listitem=listitem)
return xbmcplugin.endOfDirectory( return xbmcplugin.endOfDirectory(
handle=int(sys.argv[1]), handle=int(sys.argv[1]),
cacheToDisc=True if utils.settings('enableTextureCache') == 'true' cacheToDisc=utils.settings('enableTextureCache') == 'true')
else False)
# 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