mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Merge branch 'master' of https://github.com/MediaBrowser/Emby.Kodi
This commit is contained in:
commit
5176233a33
4 changed files with 25 additions and 8 deletions
|
@ -44,7 +44,8 @@ class ClientInfo():
|
||||||
|
|
||||||
if utils.settings('deviceNameOpt') == "false":
|
if utils.settings('deviceNameOpt') == "false":
|
||||||
# Use Kodi's deviceName
|
# Use Kodi's deviceName
|
||||||
deviceName = xbmc.getInfoLabel('System.FriendlyName').decode('utf-8')
|
deviceName = xbmc.getInfoLabel('System.FriendlyName')
|
||||||
|
deviceName = utils.normalize_string(deviceName)
|
||||||
else:
|
else:
|
||||||
deviceName = utils.settings('deviceName')
|
deviceName = utils.settings('deviceName')
|
||||||
deviceName = deviceName.replace("\"", "_")
|
deviceName = deviceName.replace("\"", "_")
|
||||||
|
|
|
@ -274,7 +274,6 @@ class DownloadUtils():
|
||||||
verify=verifyssl)
|
verify=verifyssl)
|
||||||
|
|
||||||
elif type == "POST":
|
elif type == "POST":
|
||||||
print url
|
|
||||||
r = requests.post(url,
|
r = requests.post(url,
|
||||||
json=postBody,
|
json=postBody,
|
||||||
headers=header,
|
headers=header,
|
||||||
|
|
|
@ -189,7 +189,7 @@ class PlaybackUtils():
|
||||||
|
|
||||||
# For transcoding only, ask for audio/subs pref
|
# For transcoding only, ask for audio/subs pref
|
||||||
if utils.window('emby_%s.playmethod' % playurl) == "Transcode":
|
if utils.window('emby_%s.playmethod' % playurl) == "Transcode":
|
||||||
playurl = playutils.audioSubsPref(playurl)
|
playurl = playutils.audioSubsPref(playurl, listitem)
|
||||||
utils.window('emby_%s.playmethod' % playurl, value="Transcode")
|
utils.window('emby_%s.playmethod' % playurl, value="Transcode")
|
||||||
|
|
||||||
listitem.setPath(playurl)
|
listitem.setPath(playurl)
|
||||||
|
@ -232,7 +232,7 @@ class PlaybackUtils():
|
||||||
playmethod = utils.window('%s.playmethod' % embyitem)
|
playmethod = utils.window('%s.playmethod' % embyitem)
|
||||||
# Only for direct play and direct stream
|
# Only for direct play and direct stream
|
||||||
subtitles = self.externalSubs(playurl)
|
subtitles = self.externalSubs(playurl)
|
||||||
if playmethod in ("DirectStream", "Transcode"):
|
if playmethod != "Transcode":
|
||||||
# Direct play automatically appends external
|
# Direct play automatically appends external
|
||||||
listitem.setSubtitles(subtitles)
|
listitem.setSubtitles(subtitles)
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ class PlayUtils():
|
||||||
# max bit rate supported by server (max signed 32bit integer)
|
# max bit rate supported by server (max signed 32bit integer)
|
||||||
return bitrate.get(videoQuality, 2147483)
|
return bitrate.get(videoQuality, 2147483)
|
||||||
|
|
||||||
def audioSubsPref(self, url):
|
def audioSubsPref(self, url, listitem):
|
||||||
# For transcoding only
|
# For transcoding only
|
||||||
# Present the list of audio to select from
|
# Present the list of audio to select from
|
||||||
audioStreamsList = {}
|
audioStreamsList = {}
|
||||||
|
@ -331,6 +331,7 @@ class PlayUtils():
|
||||||
audioStreamsChannelsList = {}
|
audioStreamsChannelsList = {}
|
||||||
subtitleStreamsList = {}
|
subtitleStreamsList = {}
|
||||||
subtitleStreams = ['No subtitles']
|
subtitleStreams = ['No subtitles']
|
||||||
|
downloadableStreams = []
|
||||||
selectAudioIndex = ""
|
selectAudioIndex = ""
|
||||||
selectSubsIndex = ""
|
selectSubsIndex = ""
|
||||||
playurlprefs = "%s" % url
|
playurlprefs = "%s" % url
|
||||||
|
@ -361,8 +362,8 @@ class PlayUtils():
|
||||||
audioStreams.append(track)
|
audioStreams.append(track)
|
||||||
|
|
||||||
elif 'Subtitle' in type:
|
elif 'Subtitle' in type:
|
||||||
if stream['IsExternal']:
|
'''if stream['IsExternal']:
|
||||||
continue
|
continue'''
|
||||||
try:
|
try:
|
||||||
track = "%s - %s" % (index, stream['Language'])
|
track = "%s - %s" % (index, stream['Language'])
|
||||||
except:
|
except:
|
||||||
|
@ -370,10 +371,14 @@ class PlayUtils():
|
||||||
|
|
||||||
default = stream['IsDefault']
|
default = stream['IsDefault']
|
||||||
forced = stream['IsForced']
|
forced = stream['IsForced']
|
||||||
|
downloadable = stream['IsTextSubtitleStream']
|
||||||
|
|
||||||
if default:
|
if default:
|
||||||
track = "%s - Default" % track
|
track = "%s - Default" % track
|
||||||
if forced:
|
if forced:
|
||||||
track = "%s - Forced" % track
|
track = "%s - Forced" % track
|
||||||
|
if downloadable:
|
||||||
|
downloadableStreams.append(index)
|
||||||
|
|
||||||
subtitleStreamsList[track] = index
|
subtitleStreamsList[track] = index
|
||||||
subtitleStreams.append(track)
|
subtitleStreams.append(track)
|
||||||
|
@ -401,7 +406,19 @@ class PlayUtils():
|
||||||
# User selected subtitles
|
# User selected subtitles
|
||||||
selected = subtitleStreams[resp]
|
selected = subtitleStreams[resp]
|
||||||
selectSubsIndex = subtitleStreamsList[selected]
|
selectSubsIndex = subtitleStreamsList[selected]
|
||||||
playurlprefs += "&SubtitleStreamIndex=%s" % selectSubsIndex
|
|
||||||
|
# Load subtitles in the listitem if downloadable
|
||||||
|
if selectSubsIndex in downloadableStreams:
|
||||||
|
|
||||||
|
itemid = item['Id']
|
||||||
|
url = [("%s/Videos/%s/%s/Subtitles/%s/Stream.srt"
|
||||||
|
% (self.server, itemid, itemid, selectSubsIndex))]
|
||||||
|
self.logMsg("Set up subtitles: %s %s" % (selectSubsIndex, url), 1)
|
||||||
|
listitem.setSubtitles(url)
|
||||||
|
else:
|
||||||
|
# Burn subtitles
|
||||||
|
playurlprefs += "&SubtitleStreamIndex=%s" % selectSubsIndex
|
||||||
|
|
||||||
else: # User backed out of selection
|
else: # User backed out of selection
|
||||||
playurlprefs += "&SubtitleStreamIndex=%s" % mediasources.get('DefaultSubtitleStreamIndex', "")
|
playurlprefs += "&SubtitleStreamIndex=%s" % mediasources.get('DefaultSubtitleStreamIndex', "")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue