WIP V3: resume working
This commit is contained in:
parent
93c5475a29
commit
eae8870d4d
@ -114,6 +114,7 @@ class PlaylistTrack:
|
||||
self.playlist_id: Optional[int] = None
|
||||
self.plr_id: Optional[int] = None
|
||||
self.plr_rownum: Optional[int] = None
|
||||
self.resume_marker: Optional[float] = None
|
||||
self.silence_at: Optional[int] = None
|
||||
self.start_gap: Optional[int] = None
|
||||
self.start_time: Optional[datetime] = None
|
||||
|
||||
@ -197,7 +197,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
self.music: music.Music = music.Music()
|
||||
self.playing: bool = False
|
||||
|
||||
self.previous_track_position: Optional[float] = None
|
||||
self.selected_plrs: Optional[List[PlaylistRows]] = None
|
||||
|
||||
self.set_main_window_size()
|
||||
@ -1217,45 +1216,27 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
- If a track is playing, make that the next track
|
||||
"""
|
||||
|
||||
return
|
||||
# TODO Reimplement without reference to playlist_tab
|
||||
# # Return if no saved position
|
||||
# if not self.previous_track_position:
|
||||
# return
|
||||
# Return if no saved position
|
||||
if not track_sequence.previous.resume_marker:
|
||||
return
|
||||
|
||||
# # Note any playing track as this will become the next track
|
||||
# playing_track = None
|
||||
# if self.current_track.track_id:
|
||||
# playing_track = self.current_track
|
||||
# We want to use play_next() to resume, so copy the previous
|
||||
# track to the next track:
|
||||
track_sequence.next = track_sequence.previous
|
||||
|
||||
# # Set next plr to be track to resume
|
||||
# if not self.previous_track.plr_id:
|
||||
# return
|
||||
# # TODO Reimplement following two lines
|
||||
# # if not self.previous_track.playlist_tab:
|
||||
# # return
|
||||
# Now resume playing the now-next track
|
||||
self.play_next(track_sequence.next.resume_marker)
|
||||
|
||||
# # Resume last track
|
||||
# # TODO Reimplement next four lines
|
||||
# # self.set_next_plr_id(
|
||||
# # self.previous_track.plr_id, self.previous_track.playlist_tab
|
||||
# # )
|
||||
# # self.play_next(self.previous_track_position)
|
||||
|
||||
# # Adjust track info so that clocks and graph are correct.
|
||||
# # Easiest way is to fake the start time.
|
||||
# if self.current_track.start_time and self.current_track.duration:
|
||||
# elapsed_ms = self.current_track.duration * self.previous_track_position
|
||||
# self.current_track.start_time -= timedelta(milliseconds=elapsed_ms)
|
||||
|
||||
# # If a track was playing when we were called, get details to
|
||||
# # set it as the next track
|
||||
# if playing_track:
|
||||
# if not playing_track.plr_id:
|
||||
# return
|
||||
# if not playing_track.playlist_tab:
|
||||
# return
|
||||
# self.set_next_plr_id(playing_track.plr_id, playing_track.playlist_tab)
|
||||
# Adjust track info so that clocks and graph are correct.
|
||||
# We need to fake the start time to reflect where we resumed the
|
||||
# track
|
||||
if (
|
||||
track_sequence.now.start_time
|
||||
and track_sequence.now.duration
|
||||
and track_sequence.now.resume_marker
|
||||
):
|
||||
elapsed_ms = track_sequence.now.duration * track_sequence.now.resume_marker
|
||||
track_sequence.now.start_time -= timedelta(milliseconds=elapsed_ms)
|
||||
|
||||
def save_as_template(self) -> None:
|
||||
"""Save current playlist as template"""
|
||||
@ -1451,7 +1432,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
return
|
||||
|
||||
# Stop/fade track
|
||||
self.previous_track_position = self.music.get_position()
|
||||
track_sequence.now.resume_marker = self.music.get_position()
|
||||
if fade:
|
||||
self.music.fade()
|
||||
else:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user