From 44286e27646fe4db85bbfc563dc12aca7b3962dc Mon Sep 17 00:00:00 2001 From: im85288 Date: Mon, 1 Jun 2015 01:16:55 +0100 Subject: [PATCH] moved out next up play logic to seperate addon --- resources/lib/Player.py | 44 ----------------------------------------- resources/settings.xml | 2 -- service.py | 10 ---------- 3 files changed, 56 deletions(-) diff --git a/resources/lib/Player.py b/resources/lib/Player.py index 5f8dc484..d566cd69 100644 --- a/resources/lib/Player.py +++ b/resources/lib/Player.py @@ -345,47 +345,3 @@ class Player( xbmc.Player ): # Will be called when user stops xbmc playing a file self.logMsg("onPlayBackStopped", 0) self.stopAll() - - - 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 ) - username = WINDOW.getProperty('currUser') - userid = WINDOW.getProperty('userId%s' % username) - server = WINDOW.getProperty('server%s' % username) - # add remaining unplayed episodes if applicable - MB3Episode = ReadEmbyDB().getItem(item_id) - userData = MB3Episode["UserData"] - if userData!=None and userData["Played"]==True: - pDialog = xbmcgui.DialogProgress() - 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 = jsonData - if seasonData.get("Items") != None: - item = seasonData.get("Items")[0] - item = ReadEmbyDB().getItem(item["Id"]) - nextUpPage = NextUpInfo("NextUpInfo.xml", addonSettings.getAddonInfo('path'), "default", "720p") - nextUpPage.setItem(item) - playTime = xbmc.Player().getTime() - totalTime = xbmc.Player().getTotalTime() - nextUpPage.show() - playTime = xbmc.Player().getTime() - totalTime = xbmc.Player().getTotalTime() - while xbmc.Player().isPlaying() and (totalTime-playTime > 1) and not nextUpPage.isCancel() and not nextUpPage.isWatchNow(): - xbmc.sleep(100) - playTime = xbmc.Player().getTime() - totalTime = xbmc.Player().getTotalTime() - nextUpPage.close() - if not nextUpPage.isCancel(): - PlaybackUtils().PLAY(item) - diff --git a/resources/settings.xml b/resources/settings.xml index c7008982..58e99f5b 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -31,8 +31,6 @@ - - diff --git a/service.py b/service.py index 2d99b0db..80a9d82b 100644 --- a/service.py +++ b/service.py @@ -123,16 +123,6 @@ class Service(): player.reportPlayback() except: pass lastProgressUpdate = datetime.today() - # only try autoplay when there's 20 seconds or less remaining and only once! - addonSettings = xbmcaddon.Addon(id='plugin.video.emby') - - # if its an episode see if autoplay is enabled - if addonSettings.getSetting("autoPlaySeason")=="true": - notificationtime = addonSettings.getSetting("autoPlaySeasonTime") - if (totalTime - playTime <= int(notificationtime) and (lastFile==None or lastFile!=currentFile)): - lastFile = currentFile - player.autoPlayPlayback() - self.logMsg("Netflix style autoplay succeeded.", 2) except Exception, e: self.logMsg("Exception in Playback Monitor Service: %s" % e)