mirror of
https://github.com/solero/houdini.git
synced 2024-11-21 21:17:21 +00:00
Next track seek optimisation
This commit is contained in:
parent
4eb93c74a8
commit
ae30ca33c0
@ -33,14 +33,13 @@ class SoundStudio:
|
|||||||
await self.send_broadcasted_tracks()
|
await self.send_broadcasted_tracks()
|
||||||
await self.stop_broadcasting()
|
await self.stop_broadcasting()
|
||||||
else:
|
else:
|
||||||
next_track = self.playlist[0]
|
|
||||||
if self.current_track is not None:
|
if self.current_track is not None:
|
||||||
while next_track.id != self.current_track.id:
|
current_track_position = next((i for i, track in enumerate(self.playlist)
|
||||||
self.playlist.append(self.playlist.pop(0))
|
if track.id == self.current_track.id), None)
|
||||||
if next_track.id == self.playlist[0].id:
|
if current_track_position is not None:
|
||||||
break
|
playlist_front = self.playlist[current_track_position+1:]
|
||||||
next_track = self.playlist[0]
|
playlist_end = self.playlist[:current_track_position+1]
|
||||||
self.playlist.append(self.playlist.pop(0))
|
self.playlist = playlist_front+playlist_end
|
||||||
|
|
||||||
self.current_track = self.playlist[0]
|
self.current_track = self.playlist[0]
|
||||||
await self.send_broadcasted_tracks()
|
await self.send_broadcasted_tracks()
|
||||||
|
Loading…
Reference in New Issue
Block a user