fix: playlist version ++ after set one-shot

This commit is contained in:
Terry Geng 2020-02-27 12:05:42 +08:00
parent 4a7dfc48c2
commit 0216103b69

View File

@ -16,9 +16,13 @@ class PlayList(list):
def set_mode(self, mode): def set_mode(self, mode):
# modes are "one-shot", "repeat", "random" # modes are "one-shot", "repeat", "random"
self.mode = mode self.mode = mode
if mode == "random": if mode == "random":
self.randomize() self.randomize()
if mode == "one-shot" and self.current_index > 0:
elif mode == "one-shot" and self.current_index > 0:
# remove items before current item
self.version += 1
for i in range(self.current_index): for i in range(self.current_index):
super().__delitem__(0) super().__delitem__(0)
self.current_index = 0 self.current_index = 0