mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Fixed few bugs in playback
video res not having values, audio url missing ?, support new server setting that disables subs extraction
This commit is contained in:
parent
2003367a21
commit
88dd33d4ce
2 changed files with 21 additions and 6 deletions
|
@ -12,6 +12,7 @@ import xbmcvfs
|
||||||
|
|
||||||
import clientinfo
|
import clientinfo
|
||||||
import downloadutils
|
import downloadutils
|
||||||
|
import read_embyserver as embyserver
|
||||||
from utils import window, settings, language as lang
|
from utils import window, settings, language as lang
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
@ -28,6 +29,7 @@ class PlayUtils():
|
||||||
|
|
||||||
self.item = item
|
self.item = item
|
||||||
self.clientInfo = clientinfo.ClientInfo()
|
self.clientInfo = clientinfo.ClientInfo()
|
||||||
|
self.emby = embyserver.Read_EmbyServer()
|
||||||
|
|
||||||
self.userid = window('emby_currUser')
|
self.userid = window('emby_currUser')
|
||||||
self.server = window('emby_server%s' % self.userid)
|
self.server = window('emby_server%s' % self.userid)
|
||||||
|
@ -121,7 +123,7 @@ class PlayUtils():
|
||||||
mediatype = self.item['MediaType']
|
mediatype = self.item['MediaType']
|
||||||
|
|
||||||
if mediatype == "Audio":
|
if mediatype == "Audio":
|
||||||
playurl = "%s/emby/Audio/%s/stream" % (self.server, itemid)
|
playurl = "%s/emby/Audio/%s/stream?" % (self.server, itemid)
|
||||||
else:
|
else:
|
||||||
playurl = "%s/emby/Videos/%s/stream?static=true" % (self.server, itemid)
|
playurl = "%s/emby/Videos/%s/stream?static=true" % (self.server, itemid)
|
||||||
|
|
||||||
|
@ -289,7 +291,7 @@ class PlayUtils():
|
||||||
# Allow strm loading when direct streaming
|
# Allow strm loading when direct streaming
|
||||||
playurl = self.directPlay()
|
playurl = self.directPlay()
|
||||||
elif self.item['Type'] == "Audio":
|
elif self.item['Type'] == "Audio":
|
||||||
playurl = "%s/emby/Audio/%s/stream.mp3" % (self.server, self.item['Id'])
|
playurl = "%s/emby/Audio/%s/stream.mp3?" % (self.server, self.item['Id'])
|
||||||
else:
|
else:
|
||||||
playurl = "%s/emby/Videos/%s/stream?static=true" % (self.server, self.item['Id'])
|
playurl = "%s/emby/Videos/%s/stream?static=true" % (self.server, self.item['Id'])
|
||||||
|
|
||||||
|
@ -429,7 +431,7 @@ class PlayUtils():
|
||||||
|
|
||||||
default = stream['IsDefault']
|
default = stream['IsDefault']
|
||||||
forced = stream['IsForced']
|
forced = stream['IsForced']
|
||||||
downloadable = stream['IsTextSubtitleStream']
|
downloadable = stream['SupportsExternalStream']
|
||||||
|
|
||||||
if default:
|
if default:
|
||||||
track = "%s - Default" % track
|
track = "%s - Default" % track
|
||||||
|
@ -464,9 +466,10 @@ class PlayUtils():
|
||||||
# User selected subtitles
|
# User selected subtitles
|
||||||
selected = subtitleStreams[resp]
|
selected = subtitleStreams[resp]
|
||||||
selectSubsIndex = subtitleStreamsList[selected]
|
selectSubsIndex = subtitleStreamsList[selected]
|
||||||
|
settings = self.emby.get_server_transcoding_settings()
|
||||||
|
|
||||||
# Load subtitles in the listitem if downloadable
|
# Load subtitles in the listitem if downloadable
|
||||||
if selectSubsIndex in downloadableStreams:
|
if settings['EnableSubtitleExtraction'] and selectSubsIndex in downloadableStreams:
|
||||||
|
|
||||||
itemid = self.item['Id']
|
itemid = self.item['Id']
|
||||||
url = [("%s/Videos/%s/%s/Subtitles/%s/Stream.srt"
|
url = [("%s/Videos/%s/%s/Subtitles/%s/Stream.srt"
|
||||||
|
@ -680,6 +683,10 @@ class PlayUtils():
|
||||||
if settings('limitResolution') == "true":
|
if settings('limitResolution') == "true":
|
||||||
screenRes = self.getScreenResolution()
|
screenRes = self.getScreenResolution()
|
||||||
videoRes = self.getVideoResolution()
|
videoRes = self.getVideoResolution()
|
||||||
|
|
||||||
|
if not videoRes:
|
||||||
|
return False
|
||||||
|
|
||||||
return videoRes['width'] > screenRes['width'] or videoRes['height'] > screenRes['height']
|
return videoRes['width'] > screenRes['width'] or videoRes['height'] > screenRes['height']
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
@ -690,6 +697,9 @@ class PlayUtils():
|
||||||
'height' : wind.getHeight()}
|
'height' : wind.getHeight()}
|
||||||
|
|
||||||
def getVideoResolution(self):
|
def getVideoResolution(self):
|
||||||
return {'width' : self.item['MediaStreams'][0]['Width'],
|
try:
|
||||||
'height' : self.item['MediaStreams'][0]['Height']}
|
return {'width' : self.item['MediaStreams'][0]['Width'],
|
||||||
|
'height' : self.item['MediaStreams'][0]['Height']}
|
||||||
|
except KeyError as error:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
|
@ -647,3 +647,8 @@ class Read_EmbyServer():
|
||||||
for library in self.doUtils.downloadUrl(url):
|
for library in self.doUtils.downloadUrl(url):
|
||||||
if library['ItemId'] == view_id:
|
if library['ItemId'] == view_id:
|
||||||
return library['LibraryOptions']
|
return library['LibraryOptions']
|
||||||
|
|
||||||
|
def get_server_transcoding_settings(self):
|
||||||
|
|
||||||
|
url = self.get_emby_url('/System/Configuration/encoding')
|
||||||
|
return self.doUtils.downloadUrl(url)
|
||||||
|
|
Loading…
Reference in a new issue