Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear playlist if clear flag is set (UpNext) #871

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions jellyfin_kodi/objects/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,12 @@
playlist = self.get_playlist(item)
player = xbmc.Player()

# xbmc.executebuiltin("Playlist.Clear") # Clear playlist to remove the previous item from playlist position no.2

if clear:
if player.isPlaying():
player.stop()

xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
playlist.clear()

Check warning on line 174 in jellyfin_kodi/objects/actions.py

View check run for this annotation

Codecov / codecov/patch

jellyfin_kodi/objects/actions.py#L174

Added line #L174 was not covered by tests
index = 0
else:
index = max(playlist.getposition(), 0) + 1 # Can return -1
Expand All @@ -196,11 +195,12 @@
playutils.set_properties(item, item['PlaybackInfo']['Method'], self.server_id)

playlist.add(item['PlaybackInfo']['Path'], listitem, index)
index += 1

if clear:
xbmc.executebuiltin('Dialog.Close(busydialognocancel)')
player.play(playlist)
player.play(playlist, startpos=index)

Check warning on line 201 in jellyfin_kodi/objects/actions.py

View check run for this annotation

Codecov / codecov/patch

jellyfin_kodi/objects/actions.py#L201

Added line #L201 was not covered by tests

index += 1

Check warning on line 203 in jellyfin_kodi/objects/actions.py

View check run for this annotation

Codecov / codecov/patch

jellyfin_kodi/objects/actions.py#L203

Added line #L203 was not covered by tests

server_address = item['PlaybackInfo']['ServerAddress']
token = item['PlaybackInfo']['Token']
Expand Down
Loading