Fix information screen and Plex option not working

- Fixes #440
This commit is contained in:
croneter 2018-04-03 16:53:59 +02:00
parent 01d1d342aa
commit 14ef7ae247

View file

@ -193,47 +193,40 @@ def GetSubFolders(nodeindex):
##### LISTITEM SETUP FOR VIDEONODES ##### ##### LISTITEM SETUP FOR VIDEONODES #####
def createListItem(item, append_show_title=False, append_sxxexx=False): def createListItem(item, append_show_title=False, append_sxxexx=False):
log.debug('createListItem called with append_show_title %s, append_sxxexx '
'%s, item: %s', append_show_title, append_sxxexx, item)
title = item['title'] title = item['title']
li = ListItem(title) li = ListItem(title)
li.setProperty('IsPlayable', "true") li.setProperty('IsPlayable', 'true')
metadata = { metadata = {
'duration': str(item['runtime']/60), 'duration': str(item['runtime']/60),
'Plot': item['plot'], 'Plot': item['plot'],
'Playcount': item['playcount'] 'Playcount': item['playcount']
} }
if "episode" in item: if 'episode' in item:
episode = item['episode'] episode = item['episode']
metadata['Episode'] = episode metadata['Episode'] = episode
if 'season' in item:
if "season" in item:
season = item['season'] season = item['season']
metadata['Season'] = season metadata['Season'] = season
if season and episode: if season and episode:
li.setProperty('episodeno', "s%.2de%.2d" % (season, episode)) li.setProperty('episodeno', 's%.2de%.2d' % (season, episode))
if append_sxxexx is True: if append_sxxexx is True:
title = "S%.2dE%.2d - %s" % (season, episode, title) title = 'S%.2dE%.2d - %s' % (season, episode, title)
if 'firstaired' in item:
if "firstaired" in item:
metadata['Premiered'] = item['firstaired'] metadata['Premiered'] = item['firstaired']
if 'showtitle' in item:
if "showtitle" in item:
metadata['TVshowTitle'] = item['showtitle'] metadata['TVshowTitle'] = item['showtitle']
if append_show_title is True: if append_show_title is True:
title = item['showtitle'] + ' - ' + title title = item['showtitle'] + ' - ' + title
if 'rating' in item:
if "rating" in item: metadata['Rating'] = str(round(float(item['rating']), 1))
metadata['Rating'] = str(round(float(item['rating']),1)) if 'director' in item:
metadata['Director'] = item['director']
if "director" in item: if 'writer' in item:
metadata['Director'] = " / ".join(item['director']) metadata['Writer'] = item['writer']
if 'cast' in item:
if "writer" in item:
metadata['Writer'] = " / ".join(item['writer'])
if "cast" in item:
cast = [] cast = []
castandrole = [] castandrole = []
for person in item['cast']: for person in item['cast']:
@ -244,16 +237,17 @@ def createListItem(item, append_show_title=False, append_sxxexx=False):
metadata['CastAndRole'] = castandrole metadata['CastAndRole'] = castandrole
metadata['Title'] = title metadata['Title'] = title
metadata['mediatype'] = 'episode'
metadata['dbid'] = str(item['episodeid'])
li.setLabel(title) li.setLabel(title)
li.setInfo(type='Video', infoLabels=metadata)
li.setInfo(type="Video", infoLabels=metadata)
li.setProperty('resumetime', str(item['resume']['position'])) li.setProperty('resumetime', str(item['resume']['position']))
li.setProperty('totaltime', str(item['resume']['total'])) li.setProperty('totaltime', str(item['resume']['total']))
li.setArt(item['art']) li.setArt(item['art'])
li.setThumbnailImage(item['art'].get('thumb','')) li.setThumbnailImage(item['art'].get('thumb', ''))
li.setArt({'icon': 'DefaultTVShows.png'}) li.setArt({'icon': 'DefaultTVShows.png'})
li.setProperty('dbid', str(item['episodeid'])) li.setProperty('fanart_image', item['art'].get('tvshow.fanart', ''))
li.setProperty('fanart_image', item['art'].get('tvshow.fanart',''))
try: try:
li.addContextMenuItems([(lang(30032), 'XBMC.Action(Info)',)]) li.addContextMenuItems([(lang(30032), 'XBMC.Action(Info)',)])
except TypeError: except TypeError:
@ -262,7 +256,6 @@ def createListItem(item, append_show_title=False, append_sxxexx=False):
for key, value in item['streamdetails'].iteritems(): for key, value in item['streamdetails'].iteritems():
for stream in value: for stream in value:
li.addStreamInfo(key, stream) li.addStreamInfo(key, stream)
return li return li
##### GET NEXTUP EPISODES FOR TAGNAME ##### ##### GET NEXTUP EPISODES FOR TAGNAME #####