mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-12 21:26:10 +00:00
fix for intros/cinema mode bug
This commit is contained in:
parent
033c2540e9
commit
75828e7eec
1 changed files with 30 additions and 22 deletions
|
@ -48,18 +48,6 @@ class PlaybackUtils():
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
# For split movies
|
|
||||||
if u'PartCount' in result:
|
|
||||||
partcount = result[u'PartCount']
|
|
||||||
# Get additional parts/playurl
|
|
||||||
url = "{server}/mediabrowser/Videos/%s/AdditionalParts" % id
|
|
||||||
parts = self.downloadUtils.downloadUrl(url)
|
|
||||||
partsId = [id]
|
|
||||||
for part in parts[u'Items']:
|
|
||||||
partId = part[u'Id']
|
|
||||||
partsId.append(partId)
|
|
||||||
self.PLAYAllItems(partsId, startPositionTicks=None)
|
|
||||||
|
|
||||||
userData = result['UserData']
|
userData = result['UserData']
|
||||||
resume_result = 0
|
resume_result = 0
|
||||||
seekTime = 0
|
seekTime = 0
|
||||||
|
@ -68,16 +56,36 @@ class PlaybackUtils():
|
||||||
reasonableTicks = int(userData.get("PlaybackPositionTicks")) / 1000
|
reasonableTicks = int(userData.get("PlaybackPositionTicks")) / 1000
|
||||||
seekTime = reasonableTicks / 10000
|
seekTime = reasonableTicks / 10000
|
||||||
|
|
||||||
# check for any intros - if we have any play them when the movie/show is not being resumed
|
itemsToPlay = []
|
||||||
url = "{server}/mediabrowser/Users/{UserId}/Items/%s/Intros?format=json&ImageTypeLimit=1&Fields=Etag" % id
|
# Check for intros
|
||||||
intros = self.downloadUtils.downloadUrl(url)
|
if seekTime == 0:
|
||||||
if(intros != "" and intros.get("Items") != None and seekTime == 0):
|
# if we have any play them when the movie/show is not being resumed
|
||||||
introsId = []
|
# We can add the option right here
|
||||||
for intro in intros[u'Items']:
|
url = "{server}/mediabrowser/Users/{UserId}/Items/%s/Intros?format=json&ImageTypeLimit=1&Fields=Etag" % id
|
||||||
introid = intro[u'Id']
|
intros = self.downloadUtils.downloadUrl(url)
|
||||||
introsId.append(introid)
|
if intros[u'TotalRecordCount'] == 0:
|
||||||
introsId.append(id)
|
pass
|
||||||
return self.PLAYAllItems(introsId, startPositionTicks=None)
|
else:
|
||||||
|
for intro in intros[u'Items']:
|
||||||
|
introId = intro[u'Id']
|
||||||
|
itemsToPlay.append(introId)
|
||||||
|
|
||||||
|
# Add original item
|
||||||
|
itemsToPlay.append(id)
|
||||||
|
|
||||||
|
# For split movies
|
||||||
|
if u'PartCount' in result:
|
||||||
|
partcount = result[u'PartCount']
|
||||||
|
# Get additional parts/playurl
|
||||||
|
url = "{server}/mediabrowser/Videos/%s/AdditionalParts" % id
|
||||||
|
parts = self.downloadUtils.downloadUrl(url)
|
||||||
|
for part in parts[u'Items']:
|
||||||
|
partId = part[u'Id']
|
||||||
|
itemsToPlay.append(partId)
|
||||||
|
|
||||||
|
if len(itemsToPlay) > 1:
|
||||||
|
# Let's play the playlist
|
||||||
|
return self.AddToPlaylist(itemsToPlay)
|
||||||
|
|
||||||
playurl = PlayUtils().getPlayUrl(server, id, result)
|
playurl = PlayUtils().getPlayUrl(server, id, result)
|
||||||
if playurl == False:
|
if playurl == False:
|
||||||
|
|
Loading…
Reference in a new issue