Fix #233
This commit is contained in:
parent
4c638ab608
commit
ebf62fe161
@ -111,6 +111,7 @@ class PlaylistTrack:
|
||||
self.end_time: Optional[datetime] = None
|
||||
self.fade_at: Optional[int] = None
|
||||
self.fade_graph: Optional[FadeCurve] = None
|
||||
self.fade_graph_start_updates: Optional[datetime] = None
|
||||
self.fade_length: Optional[int] = None
|
||||
self.path: Optional[str] = None
|
||||
self.playlist_id: Optional[int] = None
|
||||
@ -177,10 +178,16 @@ class PlaylistTrack:
|
||||
Called when track starts playing
|
||||
"""
|
||||
|
||||
self.start_time = datetime.now()
|
||||
now = datetime.now()
|
||||
self.start_time = now
|
||||
if self.duration:
|
||||
self.end_time = self.start_time + timedelta(milliseconds=self.duration)
|
||||
|
||||
# Calculate time fade_graph should start updating
|
||||
if self.fade_at:
|
||||
update_graph_at_ms = max(0, self.fade_at - Config.FADE_CURVE_MS_BEFORE_FADE - 1)
|
||||
self.fade_graph_start_updates = now + timedelta(milliseconds=update_graph_at_ms)
|
||||
|
||||
|
||||
class AddFadeCurve(QObject):
|
||||
"""
|
||||
|
||||
@ -1110,10 +1110,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
log.error("musicmuster.play_next(): no path for next track")
|
||||
return
|
||||
|
||||
# TODO temporary measure to help isolate issue #223
|
||||
self.timer10.stop()
|
||||
self.show_status_message("10ms timer disabled", 0)
|
||||
|
||||
# If there's currently a track playing, fade it.
|
||||
self.stop_playing(fade=True)
|
||||
|
||||
@ -1498,6 +1494,12 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
"""
|
||||
|
||||
# Update volume fade curve
|
||||
if (
|
||||
track_sequence.now.fade_graph_start_updates is None
|
||||
or track_sequence.now.fade_graph_start_updates > datetime.now()
|
||||
):
|
||||
return
|
||||
|
||||
if (
|
||||
track_sequence.now.track_id
|
||||
and track_sequence.now.fade_graph
|
||||
@ -1549,11 +1551,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
time_to_fade = track_sequence.now.fade_at - playtime
|
||||
time_to_silence = track_sequence.now.silence_at - playtime
|
||||
|
||||
# TODO working on issue #223
|
||||
if playtime > 10000 and not self.timer10.isActive():
|
||||
self.timer10.start(10)
|
||||
self.show_status_message("10ms timer enabled", 0)
|
||||
|
||||
# Elapsed time
|
||||
self.label_elapsed_timer.setText(
|
||||
helpers.ms_to_mmss(playtime)
|
||||
|
||||
@ -1205,7 +1205,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
self.signals.next_track_changed_signal.emit()
|
||||
return
|
||||
|
||||
# Update playing_track
|
||||
# Update track_sequence
|
||||
with Session() as session:
|
||||
track_sequence.next = PlaylistTrack()
|
||||
try:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user