WIP V3: move unplayed rows
This commit is contained in:
parent
80c363c316
commit
551a574eac
@ -973,13 +973,10 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
Move unplayed rows to another playlist
|
||||
"""
|
||||
|
||||
playlist_id = self.active_tab().playlist_id
|
||||
with Session() as session:
|
||||
unplayed_plrs = PlaylistRows.get_unplayed_rows(session, playlist_id)
|
||||
if helpers.ask_yes_no(
|
||||
"Move tracks", f"Move {len(unplayed_plrs)} tracks:" " Are you sure?"
|
||||
):
|
||||
self.move_playlist_rows(session, unplayed_plrs)
|
||||
unplayed_rows = self.active_model().get_unplayed_rows()
|
||||
if not unplayed_rows:
|
||||
return
|
||||
self.move_playlist_rows(unplayed_rows)
|
||||
|
||||
def new_from_template(self) -> None:
|
||||
"""Create new playlist from template"""
|
||||
|
||||
@ -297,11 +297,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
# Find next track
|
||||
# Get all unplayed track rows
|
||||
next_row = None
|
||||
unplayed_rows = [
|
||||
a.plr_rownum
|
||||
for a in PlaylistRows.get_unplayed_rows(session, self.playlist_id)
|
||||
]
|
||||
|
||||
unplayed_rows = self.get_unplayed_rows()
|
||||
if unplayed_rows:
|
||||
try:
|
||||
# Find next row after current track
|
||||
@ -542,6 +538,13 @@ class PlaylistModel(QAbstractTableModel):
|
||||
|
||||
return self.playlist_rows[row_number]
|
||||
|
||||
def get_unplayed_rows(self) -> List[int]:
|
||||
"""
|
||||
Return a list of unplayed row numbers
|
||||
"""
|
||||
|
||||
return [a.plr_rownum for a in self.playlist_rows.values() if not a.played]
|
||||
|
||||
def headerData(
|
||||
self,
|
||||
section: int,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user