fixed autoplay episodes

This commit is contained in:
im85288 2015-05-03 17:26:04 +01:00
parent 08ea50bdca
commit 8de2eecdcf

View file

@ -139,6 +139,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")