parent
7e7ae7dddf
commit
e8d9cf8f00
@ -288,7 +288,6 @@ class PlaylistModel(QAbstractTableModel):
|
||||
# Update Playdates in database
|
||||
log.debug(f"{self}: update playdates {track_id=}")
|
||||
Playdates(session, track_id)
|
||||
session.commit()
|
||||
|
||||
# Mark track as played in playlist
|
||||
log.debug(f"{self}: Mark track as played")
|
||||
@ -298,39 +297,41 @@ class PlaylistModel(QAbstractTableModel):
|
||||
self.refresh_row(session, plr.row_number)
|
||||
else:
|
||||
log.error(
|
||||
f"{self}: Can't retrieve plr, {track_sequence.current.playlistrow_id=}"
|
||||
f"{self}: Can't retrieve plr, "
|
||||
f"{track_sequence.current.playlistrow_id=}"
|
||||
)
|
||||
session.commit()
|
||||
|
||||
# Update colour and times for current row
|
||||
# Update colour and times for current row
|
||||
# only invalidate required roles
|
||||
roles = [
|
||||
Qt.ItemDataRole.DisplayRole
|
||||
]
|
||||
self.invalidate_row(row_number, roles)
|
||||
|
||||
# Update previous row in case we're hiding played rows
|
||||
if track_sequence.previous and track_sequence.previous.row_number:
|
||||
# only invalidate required roles
|
||||
roles = [
|
||||
Qt.ItemDataRole.DisplayRole
|
||||
]
|
||||
self.invalidate_row(row_number, roles)
|
||||
self.invalidate_row(track_sequence.previous.row_number, roles)
|
||||
|
||||
# Update previous row in case we're hiding played rows
|
||||
if track_sequence.previous and track_sequence.previous.row_number:
|
||||
# only invalidate required roles
|
||||
self.invalidate_row(track_sequence.previous.row_number, roles)
|
||||
# Update all other track times
|
||||
self.update_track_times()
|
||||
|
||||
# Update all other track times
|
||||
self.update_track_times()
|
||||
|
||||
# Find next track
|
||||
next_row = None
|
||||
unplayed_rows = [
|
||||
a
|
||||
for a in self.get_unplayed_rows()
|
||||
if not self.is_header_row(a)
|
||||
and not file_is_unreadable(self.playlist_rows[a].path)
|
||||
]
|
||||
if unplayed_rows:
|
||||
try:
|
||||
next_row = min([a for a in unplayed_rows if a > row_number])
|
||||
except ValueError:
|
||||
next_row = min(unplayed_rows)
|
||||
if next_row is not None:
|
||||
self.set_next_row(next_row)
|
||||
# Find next track
|
||||
next_row = None
|
||||
unplayed_rows = [
|
||||
a
|
||||
for a in self.get_unplayed_rows()
|
||||
if not self.is_header_row(a)
|
||||
and not file_is_unreadable(self.playlist_rows[a].path)
|
||||
]
|
||||
if unplayed_rows:
|
||||
try:
|
||||
next_row = min([a for a in unplayed_rows if a > row_number])
|
||||
except ValueError:
|
||||
next_row = min(unplayed_rows)
|
||||
if next_row is not None:
|
||||
self.set_next_row(next_row)
|
||||
|
||||
def data(
|
||||
self, index: QModelIndex, role: int = Qt.ItemDataRole.DisplayRole
|
||||
|
||||
Loading…
Reference in New Issue
Block a user