fixed video listitem issues for krypton

This commit is contained in:
Sebastian S 2019-01-15 07:42:43 +01:00
parent 9b8574b6a6
commit 749d0e92e4

View file

@ -101,7 +101,7 @@ class Actions(object):
if transcode and not seektime: if transcode and not seektime:
choice = self.resume_dialog(api.API(item, self.server).adjust_resume((resume or 0) / 10000000.0)) choice = self.resume_dialog(api.API(item, self.server).adjust_resume((resume or 0) / 10000000.0))
if choice is None: if choice is None:
raise Exception("User backed out of resume dialog.") raise Exception("User backed out of resume dialog.")
@ -118,7 +118,7 @@ class Actions(object):
self._set_additional_parts(item['Id']) self._set_additional_parts(item['Id'])
def _set_intros(self, item): def _set_intros(self, item):
''' if we have any play them when the movie/show is not being resumed. ''' if we have any play them when the movie/show is not being resumed.
''' '''
intros = TheVoid('GetIntros', {'ServerId': self.server_id, 'Id': item['Id']}).get() intros = TheVoid('GetIntros', {'ServerId': self.server_id, 'Id': item['Id']}).get()
@ -214,7 +214,7 @@ class Actions(object):
path = "plugin://plugin.video.emby/?mode=play&id=%s&playlist=true" % item path = "plugin://plugin.video.emby/?mode=play&id=%s&playlist=true" % item
listitem.setPath(path) listitem.setPath(path)
playlist.add(path, listitem, index) playlist.add(path, listitem, index)
index += 1 index += 1
@ -302,12 +302,26 @@ class Actions(object):
obj['Video'] = API.video_streams(obj['Video'] or [], obj['Container']) obj['Video'] = API.video_streams(obj['Video'] or [], obj['Container'])
obj['Audio'] = API.audio_streams(obj['Audio'] or []) obj['Audio'] = API.audio_streams(obj['Audio'] or [])
obj['Streams'] = API.media_streams(obj['Video'], obj['Audio'], obj['Subtitles']) obj['Streams'] = API.media_streams(obj['Video'], obj['Audio'], obj['Subtitles'])
obj['Artwork']['Primary'] = obj['Artwork']['Primary'] or "special://home/addons/plugin.video.emby/icon.png"
obj['Artwork']['Thumb'] = obj['Artwork']['Thumb'] or "special://home/addons/plugin.video.emby/fanart.jpg"
obj['Artwork']['Backdrop'] = obj['Artwork']['Backdrop'] or ["special://home/addons/plugin.video.emby/fanart.jpg"]
obj['ChildCount'] = obj['ChildCount'] or 0 obj['ChildCount'] = obj['ChildCount'] or 0
obj['RecursiveCount'] = obj['RecursiveCount'] or 0 obj['RecursiveCount'] = obj['RecursiveCount'] or 0
obj['Unwatched'] = obj['Unwatched'] or 0 obj['Unwatched'] = obj['Unwatched'] or 0
obj['Artwork']['Backdrop'] = obj['Artwork']['Backdrop'] or []
obj['Artwork']['Thumb'] = obj['Artwork']['Thumb'] or ""
if obj['Type'] == 'Video' and not obj['Type'] == 'Trailer':
obj['Artwork']['Primary'] = obj['Artwork']['Primary'] or "special://home/addons/plugin.video.emby/icon.png"
else:
obj['Artwork']['Primary'] = obj['Artwork']['Primary'] or obj['Artwork']['Thumb'] or (obj['Artwork']['Backdrop'][0] if len(obj['Artwork']['Backdrop']) else "special://home/addons/plugin.video.emby/fanart.jpg")
obj['Artwork']['Primary'] += "&KodiTrailer=true" if obj['Type'] == 'Trailer' else "&KodiCinemaMode=true"
obj['Artwork']['Backdrop'] = [obj['Artwork']['Primary']]
self.set_artwork(obj['Artwork'], listitem, obj['Type'])
if obj['Type'] == 'Video' or obj['Type'] == 'Trailer':
listitem.setArt({'poster': ""}) # Clear the poster value for intros / trailers to prevent issues in skins
listitem.setIconImage('DefaultVideo.png')
listitem.setThumbnailImage(obj['Artwork']['Primary'])
if obj['Premiere']: if obj['Premiere']:
obj['Premiere'] = obj['Premiere'].split('T')[0] obj['Premiere'] = obj['Premiere'].split('T')[0]
@ -333,30 +347,17 @@ class Actions(object):
'tagline': obj['Tagline'], 'tagline': obj['Tagline'],
'writer': obj['Writers'], 'writer': obj['Writers'],
'premiered': obj['Premiere'], 'premiered': obj['Premiere'],
'aired': obj['Premiere'],
'votes': obj['Votes'], 'votes': obj['Votes'],
'dateadded': obj['DateAdded'], 'dateadded': obj['DateAdded'],
'aired': obj['Year'],
'date': obj['FileDate'], 'date': obj['FileDate'],
'dbid': obj['DbId'] 'dbid': obj['DbId']
} }
listitem.setCast(API.get_actors()) listitem.setCast(API.get_actors())
if obj['Type'] == 'Video':
listitem.setIconImage('DefaultVideo.png')
listitem.setThumbnailImage(obj['Artwork']['Primary'] or obj['Artwork']['Thumb'])
else:
listitem.setIconImage(obj['Artwork']['Thumb'])
listitem.setThumbnailImage(obj['Artwork']['Primary'])
self.set_artwork(obj['Artwork'], listitem, obj['Type'])
if not obj['Artwork']['Backdrop']:
listitem.setArt({'fanart': obj['Artwork']['Primary']})
if obj['Premiere']: if obj['Premiere']:
metadata['premieredate'] = obj['Premiere']
metadata['date'] = obj['Premiere'] metadata['date'] = obj['Premiere']
if obj['Type'] == 'Episode': if obj['Type'] == 'Episode':
metadata.update({ metadata.update({
'mediatype': "episode", 'mediatype': "episode",
@ -366,7 +367,8 @@ class Actions(object):
'episode': obj['Index'] or 0, 'episode': obj['Index'] or 0,
'sortepisode': obj['Index'] or 0, 'sortepisode': obj['Index'] or 0,
'lastplayed': obj['DatePlayed'], 'lastplayed': obj['DatePlayed'],
'duration': obj['Runtime'] 'duration': obj['Runtime'],
'aired': obj['Premiere'],
}) })
elif obj['Type'] == 'Season': elif obj['Type'] == 'Season':
@ -414,7 +416,7 @@ class Actions(object):
'lastplayed': obj['DatePlayed'], 'lastplayed': obj['DatePlayed'],
'duration': obj['Runtime'] 'duration': obj['Runtime']
}) })
elif obj['Type'] == 'BoxSet': elif obj['Type'] == 'BoxSet':
metadata['mediatype'] = "set" metadata['mediatype'] = "set"
listitem.setProperty('IsFolder', 'true') listitem.setProperty('IsFolder', 'true')
@ -422,10 +424,10 @@ class Actions(object):
metadata.update({ metadata.update({
'mediatype': "video", 'mediatype': "video",
'lastplayed': obj['DatePlayed'], 'lastplayed': obj['DatePlayed'],
'year': obj['Year'],
'duration': obj['Runtime'] 'duration': obj['Runtime']
}) })
if is_video: if is_video:
listitem.setProperty('totaltime', str(obj['Runtime'])) listitem.setProperty('totaltime', str(obj['Runtime']))
@ -642,7 +644,7 @@ class Actions(object):
'medium_landscape', 'medium_poster', 'small_fanartimage', 'medium_landscape', 'medium_poster', 'small_fanartimage',
'medium_fanartimage', 'fanart_noindicators', 'discart', 'medium_fanartimage', 'fanart_noindicators', 'discart',
'tvshow.poster'): 'tvshow.poster'):
listitem.setProperty(art, path) listitem.setProperty(art, path)
else: else:
listitem.setArt({art: path}) listitem.setArt({art: path})
@ -699,14 +701,14 @@ class PlaylistWorker(threading.Thread):
def on_update(data, server): def on_update(data, server):
''' Only for manually marking as watched/unwatched ''' Only for manually marking as watched/unwatched
''' '''
try: try:
kodi_id = data['item']['id'] kodi_id = data['item']['id']
media = data['item']['type'] media = data['item']['type']
playcount = int(data['playcount']) playcount = int(data['playcount'])
LOG.info(" [ update/%s ] kodi_id: %s media: %s", playcount, kodi_id, media) LOG.info(" [ update/%s ] kodi_id: %s media: %s", playcount, kodi_id, media)
except (KeyError, TypeError): except (KeyError, TypeError):
LOG.debug("Invalid playstate update") LOG.debug("Invalid playstate update")
@ -746,7 +748,7 @@ def on_play(data, server):
kodi_id = item['id'] kodi_id = item['id']
media = item['type'] media = item['type']
LOG.info(" [ play ] kodi_id: %s media: %s", kodi_id, media) LOG.info(" [ play ] kodi_id: %s media: %s", kodi_id, media)
except (KeyError, TypeError): except (KeyError, TypeError):
LOG.debug("Invalid playstate update") LOG.debug("Invalid playstate update")