moved out next up play logic to seperate addon

This commit is contained in:
im85288 2015-06-01 01:16:55 +01:00
parent 0268b9b92e
commit 44286e2764
3 changed files with 0 additions and 56 deletions

View file

@ -345,47 +345,3 @@ class Player( xbmc.Player ):
# Will be called when user stops xbmc playing a file # Will be called when user stops xbmc playing a file
self.logMsg("onPlayBackStopped", 0) self.logMsg("onPlayBackStopped", 0)
self.stopAll() 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)

View file

@ -31,8 +31,6 @@
<setting id="disableCoverArt" type="bool" label="30157" default="false" visible="true" enable="true" /> <setting id="disableCoverArt" type="bool" label="30157" default="false" visible="true" enable="true" />
<setting id="ignoreSpecialsNextEpisodes" type="bool" label="Ignore specials in next episodes" visible="true" enable="true" default="false" /> <setting id="ignoreSpecialsNextEpisodes" type="bool" label="Ignore specials in next episodes" visible="true" enable="true" default="false" />
<setting id="showSpecialInfoDialog" type="bool" label="Show special Emby infodialog on play" default="false" visible="false" /> <setting id="showSpecialInfoDialog" type="bool" label="Show special Emby infodialog on play" default="false" visible="false" />
<setting id="autoPlaySeason" type="bool" label="30246" default="false" visible="true" enable="true" />
<setting id="autoPlaySeasonTime" type="number" label="30247" default="20" visible="eq(-1,true)" enable="true" />
</category> </category>
<category label="30022"> <category label="30022">
<setting id="logLevel" type="enum" label="30004" values="None|Info|Debug" default="0" /> <setting id="logLevel" type="enum" label="30004" values="None|Info|Debug" default="0" />

View file

@ -123,16 +123,6 @@ class Service():
player.reportPlayback() player.reportPlayback()
except: pass except: pass
lastProgressUpdate = datetime.today() 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: except Exception, e:
self.logMsg("Exception in Playback Monitor Service: %s" % e) self.logMsg("Exception in Playback Monitor Service: %s" % e)