Fix resume when using play-to

This commit is contained in:
angelblue05 2016-02-03 19:06:12 -06:00
parent dc12f05ba8
commit c4608b38e1
3 changed files with 19 additions and 13 deletions

View file

@ -200,5 +200,4 @@ class KodiMonitor(xbmc.Monitor):
utils.window('emby_onWake', value="true")
elif method == "Playlist.OnClear":
utils.window('emby_customPlaylist', clear=True)
self.logMsg("Clear playlist properties.")
pass

View file

@ -98,6 +98,15 @@ class Player(xbmc.Player):
itemType = utils.window("%s.type" % embyitem)
utils.window('emby_skipWatched%s' % itemId, value="true")
if (utils.window('emby_customPlaylist') == "true" and
utils.window('emby_customPlaylist.seektime')):
# Start at, when using custom playlist (play to Kodi from webclient)
seektime = utils.window('emby_customPlaylist.seektime')
self.logMsg("Seeking to: %s" % seektime, 1)
xbmcplayer.seekTime(int(seektime)/10000000.0)
utils.window('emby_customPlaylist.seektime', clear=True)
seekTime = xbmcplayer.getTime()
# Get playback volume
@ -401,6 +410,7 @@ class Player(xbmc.Player):
# Will be called when user stops xbmc playing a file
self.logMsg("ONPLAYBACK_STOPPED", 2)
utils.window('emby_customPlaylist', clear=True)
utils.window('emby_customPlaylist.seektime', clear=True)
utils.window('emby_playbackProps', clear=True)
self.logMsg("Clear playlist properties.", 1)
self.stopAll()
@ -408,6 +418,7 @@ class Player(xbmc.Player):
def onPlayBackEnded( self ):
# Will be called when xbmc stops playing a file
self.logMsg("ONPLAYBACK_ENDED", 2)
utils.window('emby_customPlaylist.seektime', clear=True)
self.stopAll()
def stopAll(self):

View file

@ -43,17 +43,19 @@ class Playlist():
embycursor = embyconn.cursor()
emby_db = embydb.Embydb_Functions(embycursor)
self.logMsg("---*** PLAY ALL ***---", 1)
self.logMsg("Items: %s and start at: %s" % (itemids, startat))
player = xbmc.Player()
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.clear()
started = False
self.logMsg("---*** PLAY ALL ***---", 1)
self.logMsg("Items: %s and start at: %s" % (itemids, startat))
started = False
utils.window('emby_customplaylist', value="true")
position = 0
if startat != 0:
# Seek to the starting position
utils.window('emby_customplaylist.seektime', str(startat))
for itemid in itemids:
embydb_item = emby_db.getItem_byId(itemid)
@ -75,12 +77,6 @@ class Playlist():
started = True
player.play(playlist)
if startat:
# Seek to the starting position
seektime = startat / 10000000.0
player.seekTime(seektime)
self.logMsg("Seeking to: %s" % seektime, 1)
self.verifyPlaylist()
embycursor.close()