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
1 changed files with 29 additions and 27 deletions

View File

@ -101,7 +101,7 @@ class Actions(object):
if transcode and not seektime:
choice = self.resume_dialog(api.API(item, self.server).adjust_resume((resume or 0) / 10000000.0))
if choice is None:
raise Exception("User backed out of resume dialog.")
@ -118,7 +118,7 @@ class Actions(object):
self._set_additional_parts(item['Id'])
def _set_intros(self, item):
''' 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()
@ -214,7 +214,7 @@ class Actions(object):
path = "plugin://plugin.video.emby/?mode=play&id=%s&playlist=true" % item
listitem.setPath(path)
playlist.add(path, listitem, index)
index += 1
@ -302,12 +302,26 @@ class Actions(object):
obj['Video'] = API.video_streams(obj['Video'] or [], obj['Container'])
obj['Audio'] = API.audio_streams(obj['Audio'] or [])
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['RecursiveCount'] = obj['RecursiveCount'] 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']:
obj['Premiere'] = obj['Premiere'].split('T')[0]
@ -333,30 +347,17 @@ class Actions(object):
'tagline': obj['Tagline'],
'writer': obj['Writers'],
'premiered': obj['Premiere'],
'aired': obj['Premiere'],
'votes': obj['Votes'],
'dateadded': obj['DateAdded'],
'aired': obj['Year'],
'date': obj['FileDate'],
'dbid': obj['DbId']
}
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']:
metadata['premieredate'] = obj['Premiere']
metadata['date'] = obj['Premiere']
if obj['Type'] == 'Episode':
metadata.update({
'mediatype': "episode",
@ -366,7 +367,8 @@ class Actions(object):
'episode': obj['Index'] or 0,
'sortepisode': obj['Index'] or 0,
'lastplayed': obj['DatePlayed'],
'duration': obj['Runtime']
'duration': obj['Runtime'],
'aired': obj['Premiere'],
})
elif obj['Type'] == 'Season':
@ -414,7 +416,7 @@ class Actions(object):
'lastplayed': obj['DatePlayed'],
'duration': obj['Runtime']
})
elif obj['Type'] == 'BoxSet':
metadata['mediatype'] = "set"
listitem.setProperty('IsFolder', 'true')
@ -422,10 +424,10 @@ class Actions(object):
metadata.update({
'mediatype': "video",
'lastplayed': obj['DatePlayed'],
'year': obj['Year'],
'duration': obj['Runtime']
})
if is_video:
listitem.setProperty('totaltime', str(obj['Runtime']))
@ -642,7 +644,7 @@ class Actions(object):
'medium_landscape', 'medium_poster', 'small_fanartimage',
'medium_fanartimage', 'fanart_noindicators', 'discart',
'tvshow.poster'):
listitem.setProperty(art, path)
else:
listitem.setArt({art: path})
@ -699,14 +701,14 @@ class PlaylistWorker(threading.Thread):
def on_update(data, server):
''' Only for manually marking as watched/unwatched
'''
try:
kodi_id = data['item']['id']
media = data['item']['type']
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):
LOG.debug("Invalid playstate update")
@ -746,7 +748,7 @@ def on_play(data, server):
kodi_id = item['id']
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):
LOG.debug("Invalid playstate update")