fix: playlist version ++ after set one-shot
This commit is contained in:
parent
4a7dfc48c2
commit
0216103b69
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user