Fix play sometimes stopping almost immediately
This commit is contained in:
parent
ee7436221e
commit
2422adea21
@ -67,6 +67,7 @@ class Config(object):
|
|||||||
MINIMUM_ROW_HEIGHT = 30
|
MINIMUM_ROW_HEIGHT = 30
|
||||||
MYSQL_CONNECT = os.environ.get('MYSQL_CONNECT') or "mysql+mysqldb://musicmuster:musicmuster@localhost/musicmuster_v2" # noqa E501
|
MYSQL_CONNECT = os.environ.get('MYSQL_CONNECT') or "mysql+mysqldb://musicmuster:musicmuster@localhost/musicmuster_v2" # noqa E501
|
||||||
NOTE_TIME_FORMAT = "%H:%M:%S"
|
NOTE_TIME_FORMAT = "%H:%M:%S"
|
||||||
|
PLAY_SETTLE = 500000
|
||||||
ROOT = os.environ.get('ROOT') or "/home/kae/music"
|
ROOT = os.environ.get('ROOT') or "/home/kae/music"
|
||||||
IMPORT_DESTINATION = os.path.join(ROOT, "Singles")
|
IMPORT_DESTINATION = os.path.join(ROOT, "Singles")
|
||||||
SCROLL_TOP_MARGIN = 3
|
SCROLL_TOP_MARGIN = 3
|
||||||
|
|||||||
@ -1613,7 +1613,14 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# If track is playing, update track clocks time and colours
|
# If track is playing, update track clocks time and colours
|
||||||
if self.music.player and self.music.player.is_playing():
|
# There is a discrete time between starting playing a track and
|
||||||
|
# player.is_playing() returning True, so assume playing if less
|
||||||
|
# than Config.PLAY_SETTLE microseconds have passed since
|
||||||
|
# starting play.
|
||||||
|
if self.music.player and self.current_track.start_time and (
|
||||||
|
self.music.player.is_playing() or
|
||||||
|
(datetime.now() - self.current_track.start_time)
|
||||||
|
< timedelta(microseconds=Config.PLAY_SETTLE)):
|
||||||
playtime = self.music.get_playtime()
|
playtime = self.music.get_playtime()
|
||||||
time_to_fade = (self.current_track.fade_at - playtime)
|
time_to_fade = (self.current_track.fade_at - playtime)
|
||||||
time_to_silence = (
|
time_to_silence = (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user