mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
fixed autoplay episodes
This commit is contained in:
parent
08ea50bdca
commit
8de2eecdcf
1 changed files with 8 additions and 5 deletions
|
@ -138,6 +138,10 @@ class Player( xbmc.Player ):
|
|||
|
||||
self.logMsg("reportPlayback Called", 2)
|
||||
xbmcplayer = self.xbmcplayer
|
||||
|
||||
if not xbmcplayer.isPlaying():
|
||||
self.logMsg("reportPlayback: Not playing anything so returning", 0)
|
||||
return
|
||||
|
||||
currentFile = xbmcplayer.getPlayingFile()
|
||||
data = self.played_information.get(currentFile)
|
||||
|
@ -325,14 +329,11 @@ class Player( xbmc.Player ):
|
|||
def autoPlayPlayback(self):
|
||||
currentFile = xbmc.Player().getPlayingFile()
|
||||
data = self.played_information.get(currentFile)
|
||||
|
||||
# only report playback if emby has initiated the playback (item_id has value)
|
||||
if(data != None and data.get("item_id") != None):
|
||||
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
|
||||
item_id = data.get("item_id")
|
||||
type = data.get("Type")
|
||||
|
||||
# if its an episode see if autoplay is enabled
|
||||
if addonSettings.getSetting("autoPlaySeason")=="true" and type=="Episode":
|
||||
WINDOW = xbmcgui.Window( 10000 )
|
||||
|
@ -347,8 +348,10 @@ class Player( xbmc.Player ):
|
|||
seasonId = MB3Episode["SeasonId"]
|
||||
url = "{server}/mediabrowser/Users/{UserId}/Items?ParentId=%s&ImageTypeLimit=1&Limit=1&SortBy=SortName&SortOrder=Ascending&Filters=IsUnPlayed&IncludeItemTypes=Episode&IsVirtualUnaired=false&Recursive=true&IsMissing=False&format=json" % seasonId
|
||||
jsonData = self.doUtils.downloadUrl(url)
|
||||
|
||||
if(jsonData != ""):
|
||||
seasonData = json.loads(jsonData)
|
||||
seasonData = jsonData
|
||||
|
||||
if seasonData.get("Items") != None:
|
||||
item = seasonData.get("Items")[0]
|
||||
pDialog.create("Auto Play next episode", str(item.get("ParentIndexNumber")) + "x" + str(item.get("IndexNumber")) + ". " + item["Name"] + " found","Cancel to stop automatic play")
|
||||
|
@ -369,5 +372,5 @@ class Player( xbmc.Player ):
|
|||
xbmc.sleep(500)
|
||||
playTime = xbmc.Player().getTime()
|
||||
totalTime = xbmc.Player().getTotalTime()
|
||||
|
||||
|
||||
PlaybackUtils().PLAYAllEpisodes(seasonData.get("Items"))
|
Loading…
Reference in a new issue