Compare commits
No commits in common. "eae8870d4d154253e54bb73a252bd2ecfd7aff86" and "2861511f1fcd58f90191f579f3459a301942a1e3" have entirely different histories.
eae8870d4d
...
2861511f1f
@ -114,7 +114,6 @@ class PlaylistTrack:
|
||||
self.playlist_id: Optional[int] = None
|
||||
self.plr_id: Optional[int] = None
|
||||
self.plr_rownum: Optional[int] = None
|
||||
self.resume_marker: Optional[float] = None
|
||||
self.silence_at: Optional[int] = None
|
||||
self.start_gap: Optional[int] = None
|
||||
self.start_time: Optional[datetime] = None
|
||||
|
||||
@ -197,6 +197,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
self.music: music.Music = music.Music()
|
||||
self.playing: bool = False
|
||||
|
||||
self.previous_track_position: Optional[float] = None
|
||||
self.selected_plrs: Optional[List[PlaylistRows]] = None
|
||||
|
||||
self.set_main_window_size()
|
||||
@ -1216,27 +1217,45 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
- If a track is playing, make that the next track
|
||||
"""
|
||||
|
||||
# Return if no saved position
|
||||
if not track_sequence.previous.resume_marker:
|
||||
return
|
||||
# TODO Reimplement without reference to playlist_tab
|
||||
# # Return if no saved position
|
||||
# if not self.previous_track_position:
|
||||
# return
|
||||
|
||||
# We want to use play_next() to resume, so copy the previous
|
||||
# track to the next track:
|
||||
track_sequence.next = track_sequence.previous
|
||||
# # Note any playing track as this will become the next track
|
||||
# playing_track = None
|
||||
# if self.current_track.track_id:
|
||||
# playing_track = self.current_track
|
||||
|
||||
# Now resume playing the now-next track
|
||||
self.play_next(track_sequence.next.resume_marker)
|
||||
# # Set next plr to be track to resume
|
||||
# if not self.previous_track.plr_id:
|
||||
# return
|
||||
# # TODO Reimplement following two lines
|
||||
# # if not self.previous_track.playlist_tab:
|
||||
# # return
|
||||
|
||||
# Adjust track info so that clocks and graph are correct.
|
||||
# We need to fake the start time to reflect where we resumed the
|
||||
# track
|
||||
if (
|
||||
track_sequence.now.start_time
|
||||
and track_sequence.now.duration
|
||||
and track_sequence.now.resume_marker
|
||||
):
|
||||
elapsed_ms = track_sequence.now.duration * track_sequence.now.resume_marker
|
||||
track_sequence.now.start_time -= timedelta(milliseconds=elapsed_ms)
|
||||
# # Resume last track
|
||||
# # TODO Reimplement next four lines
|
||||
# # self.set_next_plr_id(
|
||||
# # self.previous_track.plr_id, self.previous_track.playlist_tab
|
||||
# # )
|
||||
# # self.play_next(self.previous_track_position)
|
||||
|
||||
# # Adjust track info so that clocks and graph are correct.
|
||||
# # Easiest way is to fake the start time.
|
||||
# if self.current_track.start_time and self.current_track.duration:
|
||||
# elapsed_ms = self.current_track.duration * self.previous_track_position
|
||||
# self.current_track.start_time -= timedelta(milliseconds=elapsed_ms)
|
||||
|
||||
# # If a track was playing when we were called, get details to
|
||||
# # set it as the next track
|
||||
# if playing_track:
|
||||
# if not playing_track.plr_id:
|
||||
# return
|
||||
# if not playing_track.playlist_tab:
|
||||
# return
|
||||
# self.set_next_plr_id(playing_track.plr_id, playing_track.playlist_tab)
|
||||
|
||||
def save_as_template(self) -> None:
|
||||
"""Save current playlist as template"""
|
||||
@ -1432,7 +1451,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
return
|
||||
|
||||
# Stop/fade track
|
||||
track_sequence.now.resume_marker = self.music.get_position()
|
||||
self.previous_track_position = self.music.get_position()
|
||||
if fade:
|
||||
self.music.fade()
|
||||
else:
|
||||
|
||||
@ -448,13 +448,6 @@ class PlaylistModel(QAbstractTableModel):
|
||||
|
||||
return QVariant(boldfont)
|
||||
|
||||
def get_row_track_path(self, row_number: int) -> str:
|
||||
"""
|
||||
Return path of track associated with row or empty string if no track associated
|
||||
"""
|
||||
|
||||
return self.playlist_rows[row_number].path
|
||||
|
||||
def get_rows_duration(self, row_numbers: List[int]) -> int:
|
||||
"""
|
||||
Return the total duration of the passed rows
|
||||
|
||||
@ -284,20 +284,6 @@ class PlaylistTab(QTableView):
|
||||
return index.row()
|
||||
return None
|
||||
|
||||
def get_selected_row_track_path(self) -> str:
|
||||
"""
|
||||
Return the path of the selected row. If no row selected or selected
|
||||
row does not have a track, return empty string.
|
||||
"""
|
||||
|
||||
sm = self.selectionModel()
|
||||
if sm and sm.hasSelection():
|
||||
index = sm.currentIndex()
|
||||
if index.isValid():
|
||||
model = cast(PlaylistModel, self.model())
|
||||
return model.get_row_track_path(index.row())
|
||||
return ""
|
||||
|
||||
# def lookup_row_in_songfacts(self) -> None:
|
||||
# """
|
||||
# If there is a selected row and it is a track row,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user