mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 10:46:11 +00:00
code reduce
This commit is contained in:
parent
a80bb11349
commit
a864f390d3
1 changed files with 7 additions and 16 deletions
|
@ -237,18 +237,13 @@ class PlayUtils():
|
||||||
|
|
||||||
def directStream(self):
|
def directStream(self):
|
||||||
|
|
||||||
server = self.server
|
|
||||||
|
|
||||||
itemid = self.item['Id']
|
|
||||||
itemtype = self.item['Type']
|
|
||||||
|
|
||||||
if 'Path' in self.item and self.item['Path'].endswith('.strm'):
|
if 'Path' in self.item and self.item['Path'].endswith('.strm'):
|
||||||
# Allow strm loading when direct streaming
|
# Allow strm loading when direct streaming
|
||||||
playurl = self.directPlay()
|
playurl = self.directPlay()
|
||||||
elif itemtype == "Audio":
|
elif self.item['Type'] == "Audio":
|
||||||
playurl = "%s/emby/Audio/%s/stream.mp3" % (server, itemid)
|
playurl = "%s/emby/Audio/%s/stream.mp3" % (self.server, self.item['Id'])
|
||||||
else:
|
else:
|
||||||
playurl = "%s/emby/Videos/%s/stream?static=true" % (server, itemid)
|
playurl = "%s/emby/Videos/%s/stream?static=true" % (self.server, self.item['Id'])
|
||||||
|
|
||||||
return playurl
|
return playurl
|
||||||
|
|
||||||
|
@ -270,10 +265,8 @@ class PlayUtils():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def isTranscoding(self):
|
def isTranscoding(self):
|
||||||
|
|
||||||
canTranscode = self.item['MediaSources'][0]['SupportsTranscoding']
|
|
||||||
# Make sure the server supports it
|
# Make sure the server supports it
|
||||||
if not canTranscode:
|
if not self.item['MediaSources'][0]['SupportsTranscoding']:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -299,7 +292,6 @@ class PlayUtils():
|
||||||
def getBitrate(self):
|
def getBitrate(self):
|
||||||
|
|
||||||
# get the addon video quality
|
# get the addon video quality
|
||||||
videoQuality = utils.settings('videoBitrate')
|
|
||||||
bitrate = {
|
bitrate = {
|
||||||
|
|
||||||
'0': 664,
|
'0': 664,
|
||||||
|
@ -324,7 +316,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(utils.settings('videoBitrate'), 2147483)
|
||||||
|
|
||||||
def audioSubsPref(self, url, listitem):
|
def audioSubsPref(self, url, listitem):
|
||||||
|
|
||||||
|
@ -351,9 +343,8 @@ class PlayUtils():
|
||||||
for stream in mediastreams:
|
for stream in mediastreams:
|
||||||
# Since Emby returns all possible tracks together, have to sort them.
|
# Since Emby returns all possible tracks together, have to sort them.
|
||||||
index = stream['Index']
|
index = stream['Index']
|
||||||
type = stream['Type']
|
|
||||||
|
|
||||||
if 'Audio' in type:
|
if 'Audio' in stream['Type']:
|
||||||
codec = stream['Codec']
|
codec = stream['Codec']
|
||||||
channelLayout = stream.get('ChannelLayout', "")
|
channelLayout = stream.get('ChannelLayout', "")
|
||||||
|
|
||||||
|
@ -366,7 +357,7 @@ class PlayUtils():
|
||||||
audioStreamsList[track] = index
|
audioStreamsList[track] = index
|
||||||
audioStreams.append(track)
|
audioStreams.append(track)
|
||||||
|
|
||||||
elif 'Subtitle' in type:
|
elif 'Subtitle' in stream['Type']:
|
||||||
try:
|
try:
|
||||||
track = "%s - %s" % (index, stream['Language'])
|
track = "%s - %s" % (index, stream['Language'])
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in a new issue