Set next track start time correctly when current track on another tab
This commit is contained in:
parent
0194790605
commit
dff7e2323d
@ -70,6 +70,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
self.music: music.Music = music.Music()
|
||||
self.current_track: Optional[TrackData] = None
|
||||
self.current_track_playlist_tab: Optional[PlaylistTab] = None
|
||||
self.current_track_end_time = None
|
||||
self.next_track: Optional[TrackData] = None
|
||||
self.next_track_playlist_tab: Optional[PlaylistTab] = None
|
||||
self.previous_track: Optional[TrackData] = None
|
||||
@ -308,6 +309,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
- Tell playlist_tab track has finished
|
||||
- Reset current playlist_tab
|
||||
- Reset clocks
|
||||
- Reset end time
|
||||
- Update headers
|
||||
- Enable controls
|
||||
"""
|
||||
@ -339,6 +341,9 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
self.label_start_time.setText("00:00:00")
|
||||
self.label_end_time.setText("00:00:00")
|
||||
|
||||
# Reset end time
|
||||
self.current_track_end_time = None
|
||||
|
||||
# Update headers
|
||||
self.update_headers()
|
||||
|
||||
@ -696,10 +701,10 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
helpers.ms_to_mmss(silence_at - fade_at))
|
||||
self.label_start_time.setText(
|
||||
start_at.strftime(Config.TRACK_TIME_FORMAT))
|
||||
end_at = start_at + timedelta(
|
||||
self.current_track_end_time = start_at + timedelta(
|
||||
milliseconds=self.current_track.duration)
|
||||
self.label_end_time.setText(
|
||||
end_at.strftime(Config.TRACK_TIME_FORMAT))
|
||||
self.current_track_end_time.strftime(Config.TRACK_TIME_FORMAT))
|
||||
|
||||
def search_playlist(self) -> None:
|
||||
"""Show text box to search playlist"""
|
||||
|
||||
@ -1078,11 +1078,11 @@ class PlaylistTab(QTableWidget):
|
||||
# Render next track
|
||||
if row == next_row:
|
||||
# Set start time
|
||||
# if there's a track playing, set start time from that
|
||||
if current_row is not None:
|
||||
start_time = self._calculate_end_time(
|
||||
self.current_track_start_time, track.duration)
|
||||
else:
|
||||
# if there's a track playing, set start time from
|
||||
# that. It may be on a different tab, so we get
|
||||
# start time from musicmuster.
|
||||
start_time = self.musicmuster.current_track_end_time
|
||||
if start_time is None:
|
||||
# No current track to base from, but don't change
|
||||
# time if it's already set
|
||||
start_time = self._get_row_start_time(row)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user