Merge pull request #871 from CeruleanRed/fix/fix-up-next-compatability

Clear playlist if clear flag is set (UpNext)
This commit is contained in:
Odd Stråbø 2024-06-08 04:15:32 +02:00 committed by GitHub
commit f209f9e59b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -166,13 +166,12 @@ class Actions(object):
playlist = self.get_playlist(item) playlist = self.get_playlist(item)
player = xbmc.Player() player = xbmc.Player()
# xbmc.executebuiltin("Playlist.Clear") # Clear playlist to remove the previous item from playlist position no.2
if clear: if clear:
if player.isPlaying(): if player.isPlaying():
player.stop() player.stop()
xbmc.executebuiltin('ActivateWindow(busydialognocancel)') xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
playlist.clear()
index = 0 index = 0
else: else:
index = max(playlist.getposition(), 0) + 1 # Can return -1 index = max(playlist.getposition(), 0) + 1 # Can return -1
@ -196,11 +195,12 @@ class Actions(object):
playutils.set_properties(item, item['PlaybackInfo']['Method'], self.server_id) playutils.set_properties(item, item['PlaybackInfo']['Method'], self.server_id)
playlist.add(item['PlaybackInfo']['Path'], listitem, index) playlist.add(item['PlaybackInfo']['Path'], listitem, index)
index += 1
if clear: if clear:
xbmc.executebuiltin('Dialog.Close(busydialognocancel)') xbmc.executebuiltin('Dialog.Close(busydialognocancel)')
player.play(playlist) player.play(playlist, startpos=index)
index += 1
server_address = item['PlaybackInfo']['ServerAddress'] server_address = item['PlaybackInfo']['ServerAddress']
token = item['PlaybackInfo']['Token'] token = item['PlaybackInfo']['Token']