mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
remove artist song list fetch post-processing
- the post-processing sort breaks the correct order returned by the API
This commit is contained in:
+15
-6
@@ -306,7 +306,11 @@ export const sortSongsByFetchedOrder = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sort each group by discNumber and trackNumber
|
// Sort each group by discNumber and trackNumber
|
||||||
|
// Skip sorting for ALBUM_ARTIST as songs are already sorted by the API
|
||||||
for (const [fetchedId, groupSongs] of songsByFetchedId.entries()) {
|
for (const [fetchedId, groupSongs] of songsByFetchedId.entries()) {
|
||||||
|
if (itemType === LibraryItem.ALBUM_ARTIST) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const sortedGroup = orderBy(groupSongs, ['discNumber', 'trackNumber'], ['asc', 'asc']);
|
const sortedGroup = orderBy(groupSongs, ['discNumber', 'trackNumber'], ['asc', 'asc']);
|
||||||
songsByFetchedId.set(fetchedId, sortedGroup);
|
songsByFetchedId.set(fetchedId, sortedGroup);
|
||||||
}
|
}
|
||||||
@@ -324,12 +328,17 @@ export const sortSongsByFetchedOrder = (
|
|||||||
const matchedIds = new Set(result.map((s) => s.id));
|
const matchedIds = new Set(result.map((s) => s.id));
|
||||||
const unmatchedSongs = songs.filter((s) => !matchedIds.has(s.id));
|
const unmatchedSongs = songs.filter((s) => !matchedIds.has(s.id));
|
||||||
if (unmatchedSongs.length > 0) {
|
if (unmatchedSongs.length > 0) {
|
||||||
const sortedUnmatched = orderBy(
|
// Skip sorting for ALBUM_ARTIST as songs are already sorted by the API
|
||||||
unmatchedSongs,
|
if (itemType === LibraryItem.ALBUM_ARTIST) {
|
||||||
['discNumber', 'trackNumber'],
|
result.push(...unmatchedSongs);
|
||||||
['asc', 'asc'],
|
} else {
|
||||||
);
|
const sortedUnmatched = orderBy(
|
||||||
result.push(...sortedUnmatched);
|
unmatchedSongs,
|
||||||
|
['discNumber', 'trackNumber'],
|
||||||
|
['asc', 'asc'],
|
||||||
|
);
|
||||||
|
result.push(...sortedUnmatched);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user