Cleanup
This commit is contained in:
parent
af40e419ff
commit
0124ca6018
@ -168,7 +168,7 @@ class Music:
|
|||||||
|
|
||||||
if helpers.file_is_unreadable(path):
|
if helpers.file_is_unreadable(path):
|
||||||
log.error(f"play({path}): path not readable")
|
log.error(f"play({path}): path not readable")
|
||||||
return None
|
return
|
||||||
|
|
||||||
self.player = vlc.MediaPlayer(self.vlc_instance, path)
|
self.player = vlc.MediaPlayer(self.vlc_instance, path)
|
||||||
if self.player is None:
|
if self.player is None:
|
||||||
@ -217,11 +217,12 @@ class Music:
|
|||||||
# reset to zero within 200mS or so of starting play. This
|
# reset to zero within 200mS or so of starting play. This
|
||||||
# only happened since moving to Debian 12, which uses
|
# only happened since moving to Debian 12, which uses
|
||||||
# Pipewire for sound (which may be irrelevant).
|
# Pipewire for sound (which may be irrelevant).
|
||||||
|
# Update 19 April 2025: this may no longer be occuring
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
current_volume = self.player.audio_get_volume()
|
current_volume = self.player.audio_get_volume()
|
||||||
if current_volume < volume:
|
if current_volume < volume:
|
||||||
self.player.audio_set_volume(volume)
|
self.player.audio_set_volume(volume)
|
||||||
log.debug(f"Reset from {volume=}")
|
log.debug(f"Volume reset from {volume=}")
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
|
|
||||||
def signal_track_ended(self) -> None:
|
def signal_track_ended(self) -> None:
|
||||||
@ -253,6 +254,7 @@ class Music:
|
|||||||
self.player.stop()
|
self.player.stop()
|
||||||
self.player.release()
|
self.player.release()
|
||||||
self.player = None
|
self.player = None
|
||||||
|
self.signal_track_ended()
|
||||||
|
|
||||||
def track_end_event_handler(self, event: vlc.Event) -> None:
|
def track_end_event_handler(self, event: vlc.Event) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -1760,6 +1760,8 @@ class Window(QMainWindow):
|
|||||||
of the playlist.
|
of the playlist.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# TODO should be able to have the model handle row depending on
|
||||||
|
# how current_row_or_end is used
|
||||||
if self.current.selected_row_numbers:
|
if self.current.selected_row_numbers:
|
||||||
return self.current.selected_row_numbers[0]
|
return self.current.selected_row_numbers[0]
|
||||||
return self.current.base_model.rowCount()
|
return self.current.base_model.rowCount()
|
||||||
@ -1903,6 +1905,9 @@ class Window(QMainWindow):
|
|||||||
def hide_played(self):
|
def hide_played(self):
|
||||||
"""Toggle hide played tracks"""
|
"""Toggle hide played tracks"""
|
||||||
|
|
||||||
|
# TODO: handle this with signals, but first decide how to better
|
||||||
|
# handle hide tracks / sections
|
||||||
|
|
||||||
if self.hide_played_tracks:
|
if self.hide_played_tracks:
|
||||||
self.hide_played_tracks = False
|
self.hide_played_tracks = False
|
||||||
self.current.base_model.hide_played_tracks(False)
|
self.current.base_model.hide_played_tracks(False)
|
||||||
@ -1940,7 +1945,7 @@ class Window(QMainWindow):
|
|||||||
if ok:
|
if ok:
|
||||||
self.signals.signal_insert_track.emit(
|
self.signals.signal_insert_track.emit(
|
||||||
InsertTrack(
|
InsertTrack(
|
||||||
playlist_id=self.current.base_model.playlist_id,
|
playlist_id=self.current.playlist_id,
|
||||||
track_id=None,
|
track_id=None,
|
||||||
note=dlg.textValue(),
|
note=dlg.textValue(),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -238,18 +238,6 @@ class PlaylistRow:
|
|||||||
|
|
||||||
self.resume_marker = self.music.get_position()
|
self.resume_marker = self.music.get_position()
|
||||||
self.music.fade(fade_seconds)
|
self.music.fade(fade_seconds)
|
||||||
self.signals.track_ended_signal.emit(self.playlist_id)
|
|
||||||
self.end_of_track_signalled = True
|
|
||||||
|
|
||||||
def is_playing(self) -> bool:
|
|
||||||
"""
|
|
||||||
Return True if we're currently playing else False
|
|
||||||
"""
|
|
||||||
|
|
||||||
if self.start_time is None:
|
|
||||||
return False
|
|
||||||
|
|
||||||
return self.music.is_playing()
|
|
||||||
|
|
||||||
def play(self, position: float | None = None) -> None:
|
def play(self, position: float | None = None) -> None:
|
||||||
"""Play track"""
|
"""Play track"""
|
||||||
@ -368,7 +356,7 @@ class PlaylistRow:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if (
|
if (
|
||||||
not self.is_playing()
|
not self.music.is_playing()
|
||||||
or not self.fade_graph_start_updates
|
or not self.fade_graph_start_updates
|
||||||
or not self.fade_graph
|
or not self.fade_graph
|
||||||
):
|
):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user