Don't select unplayable track as next track
This commit is contained in:
parent
3a3b1b712d
commit
d30bf49c88
@ -297,22 +297,17 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
self.update_track_times()
|
self.update_track_times()
|
||||||
|
|
||||||
# Find next track
|
# Find next track
|
||||||
# Get all unplayed track rows
|
|
||||||
log.debug(f"{self}: Find next track")
|
|
||||||
next_row = None
|
next_row = None
|
||||||
unplayed_rows = self.get_unplayed_rows()
|
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:
|
if unplayed_rows:
|
||||||
try:
|
try:
|
||||||
# Find next row after current track
|
next_row = min([a for a in unplayed_rows if a > row_number])
|
||||||
next_row = min(
|
|
||||||
[
|
|
||||||
a
|
|
||||||
for a in unplayed_rows
|
|
||||||
if a > row_number and not self.is_header_row(a)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# Find first unplayed track
|
|
||||||
next_row = min(unplayed_rows)
|
next_row = min(unplayed_rows)
|
||||||
if next_row is not None:
|
if next_row is not None:
|
||||||
self.set_next_row(next_row)
|
self.set_next_row(next_row)
|
||||||
@ -1588,7 +1583,9 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
row(s), otherwise insert this track at row_number.
|
row(s), otherwise insert this track at row_number.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
track_rows = [a.row_number for a in self.playlist_rows.values() if a.track_id == track_id]
|
track_rows = [
|
||||||
|
a.row_number for a in self.playlist_rows.values() if a.track_id == track_id
|
||||||
|
]
|
||||||
if track_rows:
|
if track_rows:
|
||||||
with db.Session() as session:
|
with db.Session() as session:
|
||||||
for row in track_rows:
|
for row in track_rows:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user