mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-24 12:50:58 +03:00
Fall back to path when comparing tracks
Tracks will be sorted by ascending path if neither album, disc and track id can help. This is helpful for browsing a loose collection of tracks tagged under the same album. Signed-off-by: lbonn <bonnans.l@gmail.com>
This commit is contained in:
parent
0ce5a56051
commit
7af666037d
@ -18,6 +18,8 @@ public class EntryByDiscAndTrackComparator implements Comparator<MusicDirectory.
|
||||
Integer trackY = y.getTrack();
|
||||
String albumX = x.getAlbum();
|
||||
String albumY = y.getAlbum();
|
||||
String pathX = x.getPath();
|
||||
String pathY = y.getPath();
|
||||
|
||||
int albumComparison = compare(albumX, albumY);
|
||||
|
||||
@ -33,7 +35,14 @@ public class EntryByDiscAndTrackComparator implements Comparator<MusicDirectory.
|
||||
return discComparison;
|
||||
}
|
||||
|
||||
return compare(trackX == null ? 0 : trackX, trackY == null ? 0 : trackY);
|
||||
int trackComparison = compare(trackX == null ? 0 : trackX, trackY == null ? 0 : trackY);
|
||||
|
||||
if (trackComparison != 0)
|
||||
{
|
||||
return trackComparison;
|
||||
}
|
||||
|
||||
return compare(pathX == null ? "" : pathX, pathY == null ? "" : pathY);
|
||||
}
|
||||
|
||||
private static int compare(long a, long b)
|
||||
|
Loading…
x
Reference in New Issue
Block a user