Skip to content

Commit

Permalink
fix: prevent error when sorting an artist's tracks
Browse files Browse the repository at this point in the history
...by falling back to using `0` when a sort key is `None`.
This makes the artist detail view also show up when one of the artist's tracks is missing a field that is used for sorting.

Closes #42
  • Loading branch information
mgoltzsche committed Dec 26, 2023
1 parent dfb1160 commit 40e63b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mopidy_beets/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def lookup(self, uri=None, uris=None):
)
# Append composer tracks to the artist tracks (unique items).
tracks = list(set(artist_tracks + composer_tracks))
tracks.sort(key=lambda t: (t.date, t.disc_no, t.track_no))
tracks.sort(key=lambda t: (t.date or 0, t.disc_no or 0, t.track_no or 0))

Check warning on line 169 in mopidy_beets/library.py

View check run for this annotation

Codecov / codecov/patch

mopidy_beets/library.py#L169

Added line #L169 was not covered by tests
else:
logger.info("Unknown Beets lookup URI: %s", uri)
tracks = []
Expand Down

0 comments on commit 40e63b6

Please sign in to comment.