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

MediaPlayer - clear playlist via buttons with confirmation only #4139

Merged
merged 1 commit into from
Dec 18, 2024
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: 7 additions & 1 deletion lib/python/Plugins/Extensions/MediaPlayer/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def action(self, contexts, action):
"prevBouquet": (self.prevBouquet, self.prevBouquetHelpText),
"nextBouquet": (self.nextBouquet, self.nextBouquetHelptext),
"delete": (self.deletePlaylistEntry, _("Delete playlist entry")),
"shift_stop": (self.clear_playlist, _("Clear playlist")),
"shift_stop": (self.confirm_clear_playlist, _("Clear playlist")),
"shift_record": (self.playlist.PlayListShuffle, _("Shuffle playlist")),
"subtitles": (self.subtitleSelection, _("Subtitle selection")),
}, -2)
Expand Down Expand Up @@ -765,6 +765,12 @@ def deleteConfirmed(self, confirmed):
print("delete failed:", e)
self.session.open(MessageBox, _("Delete failed!"), MessageBox.TYPE_ERROR)

def confirm_clear_playlist(self):
def confirm(answer=False):
if answer:
self.clear_playlist()
self.session.openWithCallback(confirm, MessageBox, _("Do you really want to clear this playlist?"), type=MessageBox.TYPE_YESNO, default=False)

def clear_playlist(self):
self.isAudioCD = False
self.stopEntry()
Expand Down