This commit is contained in:
Keith Edmunds 2025-04-19 18:23:43 +01:00
parent af40e419ff
commit 0124ca6018
3 changed files with 11 additions and 16 deletions

View File

@ -168,7 +168,7 @@ class Music:
if helpers.file_is_unreadable(path):
log.error(f"play({path}): path not readable")
return None
return
self.player = vlc.MediaPlayer(self.vlc_instance, path)
if self.player is None:
@ -217,11 +217,12 @@ class Music:
# reset to zero within 200mS or so of starting play. This
# only happened since moving to Debian 12, which uses
# Pipewire for sound (which may be irrelevant).
# Update 19 April 2025: this may no longer be occuring
for _ in range(3):
current_volume = self.player.audio_get_volume()
if current_volume < volume:
self.player.audio_set_volume(volume)
log.debug(f"Reset from {volume=}")
log.debug(f"Volume reset from {volume=}")
sleep(0.1)
def signal_track_ended(self) -> None:
@ -253,6 +254,7 @@ class Music:
self.player.stop()
self.player.release()
self.player = None
self.signal_track_ended()
def track_end_event_handler(self, event: vlc.Event) -> None:
"""

View File

@ -1760,6 +1760,8 @@ class Window(QMainWindow):
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:
return self.current.selected_row_numbers[0]
return self.current.base_model.rowCount()
@ -1903,6 +1905,9 @@ class Window(QMainWindow):
def hide_played(self):
"""Toggle hide played tracks"""
# TODO: handle this with signals, but first decide how to better
# handle hide tracks / sections
if self.hide_played_tracks:
self.hide_played_tracks = False
self.current.base_model.hide_played_tracks(False)
@ -1940,7 +1945,7 @@ class Window(QMainWindow):
if ok:
self.signals.signal_insert_track.emit(
InsertTrack(
playlist_id=self.current.base_model.playlist_id,
playlist_id=self.current.playlist_id,
track_id=None,
note=dlg.textValue(),
)

View File

@ -238,18 +238,6 @@ class PlaylistRow:
self.resume_marker = self.music.get_position()
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:
"""Play track"""
@ -368,7 +356,7 @@ class PlaylistRow:
"""
if (
not self.is_playing()
not self.music.is_playing()
or not self.fade_graph_start_updates
or not self.fade_graph
):