Fix playback

artwork, subtitles
This commit is contained in:
angelblue05 2018-06-09 00:20:36 -05:00
parent f93fd75361
commit 4b2baa9165
2 changed files with 28 additions and 8 deletions

View file

@ -328,6 +328,7 @@ class PlaybackUtils(object):
all_artwork = self.artwork.get_all_artwork(self.item, parent_info=True) all_artwork = self.artwork.get_all_artwork(self.item, parent_info=True)
# Set artwork for listitem # Set artwork for listitem
if item_type == "Episode": if item_type == "Episode":
art = { art = {
'poster': "Series.Primary", 'poster': "Series.Primary",
'tvshow.poster': "Series.Primary", 'tvshow.poster': "Series.Primary",
@ -339,6 +340,16 @@ class PlaybackUtils(object):
'fanart_image': "Backdrop", 'fanart_image': "Backdrop",
'landscape': "Thumb", 'landscape': "Thumb",
'tvshow.landscape': "Thumb", 'tvshow.landscape': "Thumb",
'thumb': "Primary",
'fanart': "Backdrop"
}
elif item_type in ("Artist", "Audio", "MusicAlbum"):
art = {
'clearlogo': "Logo",
'discart': "Disc",
'fanart': "Backdrop",
'fanart_image': "Backdrop", # in case
'thumb': "Primary" 'thumb': "Primary"
} }
else: else:
@ -349,7 +360,8 @@ class PlaybackUtils(object):
'discart': "Disc", 'discart': "Disc",
'fanart_image': "Backdrop", 'fanart_image': "Backdrop",
'landscape': "Thumb", 'landscape': "Thumb",
'thumb': "Primary" 'thumb': "Primary",
'fanart': "Backdrop"
} }
for k_art, e_art in art.items(): for k_art, e_art in art.items():

View file

@ -43,6 +43,7 @@ class PlayUtils():
self.server = window('emby_server%s' % window('emby_currUser')) self.server = window('emby_server%s' % window('emby_currUser'))
self.play_session_id = str(create_id()).replace("-", "") self.play_session_id = str(create_id()).replace("-", "")
self.token = downloadutils.DownloadUtils().get_token()
def get_play_url(self, force_transcode=False): def get_play_url(self, force_transcode=False):
@ -139,10 +140,10 @@ class PlayUtils():
# Log filename, used by other addons eg subtitles which require the file name # Log filename, used by other addons eg subtitles which require the file name
window('embyfilename', value=self.get_direct_path(source)) window('embyfilename', value=self.get_direct_path(source))
if (not self.force_transcode and (self.is_strm(source) or self.is_h265(source) or if (not self.force_transcode and (self.is_strm(source) or self.is_h265(source) or (settings('playFromStream') == "false" and self.is_file_exists(source)))):
(source['SupportsDirectPlay'] and settings('playFromStream') == "false" and self.is_file_exists(source)))): # Append external subtitles
# Do nothing, path is updated with our verification if applies. if settings('enableExternalSubs') == "true":
pass self.set_external_subs(source, source['Path'])
else: else:
source['Path'] = self.get_http_path(source, True if not source['SupportsDirectStream'] else self.force_transcode) source['Path'] = self.get_http_path(source, True if not source['SupportsDirectStream'] else self.force_transcode)
@ -305,7 +306,7 @@ class PlayUtils():
url += "&MediaSourceId=%s" % source['Id'] url += "&MediaSourceId=%s" % source['Id']
url += "&PlaySessionId=%s" % self.play_session_id url += "&PlaySessionId=%s" % self.play_session_id
url += "&api_key=%s" % downloadutils.DownloadUtils().get_token() url += "&api_key=%s" % self.token
return url return url
@ -333,11 +334,18 @@ class PlayUtils():
if stream['Type'] == "Subtitle" and stream['IsExternal'] and stream['IsTextSubtitleStream']: if stream['Type'] == "Subtitle" and stream['IsExternal'] and stream['IsTextSubtitleStream']:
index = stream['Index'] index = stream['Index']
url = self.server + stream['DeliveryUrl'] if 'DeliveryUrl' in stream else stream.get('Path') if 'Path' in stream and xbmcvfs.exists(self.get_direct_path(stream)):
url = None if self.method == "DirectPlay" else self.get_direct_path(stream)
elif 'DeliveryUrl' in stream:
url = self.server + "/emby" + stream['DeliveryUrl']
else:
url = self.server + "/emby/Videos/%s/%s/Subtitles/%s/Stream.%s?api_key=%s" % (item_id, source['Id'], index, stream['Codec'], self.token)
log.info("Subtitle url: %s", url)
if url is None: if url is None:
continue continue
if 'Language' in stream and 'DeliveryUrl' in stream: if 'Language' in stream:
filename = "Stream.%s.%s" % (stream['Language'].encode('utf-8'), stream['Codec']) filename = "Stream.%s.%s" % (stream['Language'].encode('utf-8'), stream['Codec'])
try: try:
subs.append(self._download_external_subs(url, temp, filename)) subs.append(self._download_external_subs(url, temp, filename))