Fix resume when using play-to
This commit is contained in:
parent
dc12f05ba8
commit
c4608b38e1
3 changed files with 19 additions and 13 deletions
|
@ -200,5 +200,4 @@ class KodiMonitor(xbmc.Monitor):
|
||||||
utils.window('emby_onWake', value="true")
|
utils.window('emby_onWake', value="true")
|
||||||
|
|
||||||
elif method == "Playlist.OnClear":
|
elif method == "Playlist.OnClear":
|
||||||
utils.window('emby_customPlaylist', clear=True)
|
pass
|
||||||
self.logMsg("Clear playlist properties.")
|
|
|
@ -98,6 +98,15 @@ class Player(xbmc.Player):
|
||||||
itemType = utils.window("%s.type" % embyitem)
|
itemType = utils.window("%s.type" % embyitem)
|
||||||
utils.window('emby_skipWatched%s' % itemId, value="true")
|
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()
|
seekTime = xbmcplayer.getTime()
|
||||||
|
|
||||||
# Get playback volume
|
# Get playback volume
|
||||||
|
@ -401,6 +410,7 @@ 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("ONPLAYBACK_STOPPED", 2)
|
self.logMsg("ONPLAYBACK_STOPPED", 2)
|
||||||
utils.window('emby_customPlaylist', clear=True)
|
utils.window('emby_customPlaylist', clear=True)
|
||||||
|
utils.window('emby_customPlaylist.seektime', clear=True)
|
||||||
utils.window('emby_playbackProps', clear=True)
|
utils.window('emby_playbackProps', clear=True)
|
||||||
self.logMsg("Clear playlist properties.", 1)
|
self.logMsg("Clear playlist properties.", 1)
|
||||||
self.stopAll()
|
self.stopAll()
|
||||||
|
@ -408,6 +418,7 @@ class Player(xbmc.Player):
|
||||||
def onPlayBackEnded( self ):
|
def onPlayBackEnded( self ):
|
||||||
# Will be called when xbmc stops playing a file
|
# Will be called when xbmc stops playing a file
|
||||||
self.logMsg("ONPLAYBACK_ENDED", 2)
|
self.logMsg("ONPLAYBACK_ENDED", 2)
|
||||||
|
utils.window('emby_customPlaylist.seektime', clear=True)
|
||||||
self.stopAll()
|
self.stopAll()
|
||||||
|
|
||||||
def stopAll(self):
|
def stopAll(self):
|
||||||
|
|
|
@ -43,17 +43,19 @@ class Playlist():
|
||||||
embycursor = embyconn.cursor()
|
embycursor = embyconn.cursor()
|
||||||
emby_db = embydb.Embydb_Functions(embycursor)
|
emby_db = embydb.Embydb_Functions(embycursor)
|
||||||
|
|
||||||
self.logMsg("---*** PLAY ALL ***---", 1)
|
|
||||||
self.logMsg("Items: %s and start at: %s" % (itemids, startat))
|
|
||||||
|
|
||||||
player = xbmc.Player()
|
player = xbmc.Player()
|
||||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||||
playlist.clear()
|
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")
|
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:
|
for itemid in itemids:
|
||||||
embydb_item = emby_db.getItem_byId(itemid)
|
embydb_item = emby_db.getItem_byId(itemid)
|
||||||
|
@ -75,12 +77,6 @@ class Playlist():
|
||||||
started = True
|
started = True
|
||||||
player.play(playlist)
|
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()
|
self.verifyPlaylist()
|
||||||
embycursor.close()
|
embycursor.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue