mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 20:40:15 +02:00
Add internet radio (#1384)
This commit is contained in:
@@ -12,7 +12,9 @@ import {
|
||||
AlbumArtistListSort,
|
||||
AlbumListSort,
|
||||
ArtistListSort,
|
||||
InternetRadioStation,
|
||||
LibraryItem,
|
||||
RadioListSort,
|
||||
ServerListItem,
|
||||
Song,
|
||||
SongListSort,
|
||||
@@ -365,6 +367,7 @@ export const sortAlbumArtistList = (
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
export const sortAlbumList = (albums: Album[], sortBy: AlbumListSort, sortOrder: SortOrder) => {
|
||||
let results = albums;
|
||||
|
||||
@@ -414,3 +417,29 @@ export const sortAlbumList = (albums: Album[], sortBy: AlbumListSort, sortOrder:
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
export const sortRadioList = (
|
||||
stations: InternetRadioStation[],
|
||||
sortBy: RadioListSort,
|
||||
sortOrder: SortOrder,
|
||||
) => {
|
||||
let results = stations;
|
||||
|
||||
const order = sortOrder === SortOrder.ASC ? 'asc' : 'desc';
|
||||
|
||||
switch (sortBy) {
|
||||
case RadioListSort.ID:
|
||||
results = [...results];
|
||||
if (order === 'desc') {
|
||||
results.reverse();
|
||||
}
|
||||
break;
|
||||
case RadioListSort.NAME:
|
||||
results = orderBy(results, [(v) => v.name.toLowerCase()], [order]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user