feat: optimized play/resume logic, add fast-forward support within song.

fix #153.
This commit is contained in:
Terry Geng
2020-05-15 10:22:37 +08:00
parent 7e38c191f6
commit 71e0ede51e
6 changed files with 98 additions and 98 deletions

View File

@ -249,6 +249,12 @@ class OneshotPlaylist(BasePlaylist):
self.mode = "one-shot"
self.current_index = -1
def current_item(self):
if self.current_index == -1:
self.current_index = 0
return self[self.current_index]
def from_list(self, _list, current_index):
if len(_list) > 0:
if current_index > -1:
@ -259,6 +265,7 @@ class OneshotPlaylist(BasePlaylist):
return self
def next(self):
print(f"*** next asked")
if len(self) > 0:
self.version += 1
@ -289,7 +296,7 @@ class OneshotPlaylist(BasePlaylist):
def point_to(self, index):
self.version += 1
self.current_index = -1
for i in range(index + 1):
for i in range(index):
super().__delitem__(0)