From e74fa685c6242ad355c587cc135fb6b97197c4a7 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Thu, 19 Sep 2024 21:04:31 -0700 Subject: [PATCH 1/3] Update navidrome list sort mappings --- src/renderer/api/navidrome.types.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderer/api/navidrome.types.ts b/src/renderer/api/navidrome.types.ts index 6c409742..220bf353 100644 --- a/src/renderer/api/navidrome.types.ts +++ b/src/renderer/api/navidrome.types.ts @@ -199,17 +199,17 @@ export type NDGenreListParams = { NDOrder; export enum NDAlbumListSort { - ALBUM_ARTIST = 'albumArtist', + ALBUM_ARTIST = 'album_artist', ARTIST = 'artist', DURATION = 'duration', NAME = 'name', - PLAY_COUNT = 'playCount', + PLAY_COUNT = 'play_count', PLAY_DATE = 'play_date', RANDOM = 'random', RATING = 'rating', RECENTLY_ADDED = 'recently_added', SONG_COUNT = 'songCount', - STARRED = 'starred', + STARRED = 'starred_at', YEAR = 'max_year', } @@ -261,7 +261,7 @@ export type NDSongListParams = { export enum NDAlbumArtistListSort { ALBUM_COUNT = 'albumCount', - FAVORITED = 'starred', + FAVORITED = 'starred_at', NAME = 'name', PLAY_COUNT = 'playCount', RATING = 'rating', From 8605f151c6a0d365f69de937dfae6d5641e01744 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Fri, 20 Sep 2024 18:57:12 -0700 Subject: [PATCH 2/3] Rename ownerName to owner_name --- src/renderer/api/navidrome.types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/api/navidrome.types.ts b/src/renderer/api/navidrome.types.ts index 220bf353..35bbb9fc 100644 --- a/src/renderer/api/navidrome.types.ts +++ b/src/renderer/api/navidrome.types.ts @@ -353,7 +353,7 @@ export type NDPlaylistListResponse = NDPlaylist[]; export enum NDPlaylistListSort { DURATION = 'duration', NAME = 'name', - OWNER = 'ownerName', + OWNER = 'owner_name', PUBLIC = 'public', SONG_COUNT = 'songCount', UPDATED_AT = 'updatedAt', From 49971e837bff1fa27680d83bfe5ca4ebe84ef581 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sun, 22 Sep 2024 18:27:48 -0700 Subject: [PATCH 3/3] Remove deprecated client-side sort --- .../api/navidrome/navidrome-controller.ts | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/src/renderer/api/navidrome/navidrome-controller.ts b/src/renderer/api/navidrome/navidrome-controller.ts index bea42d98..6b2fd353 100644 --- a/src/renderer/api/navidrome/navidrome-controller.ts +++ b/src/renderer/api/navidrome/navidrome-controller.ts @@ -50,7 +50,6 @@ import { SimilarSongsArgs, Song, MoveItemArgs, - SongListSort, } from '../types'; import { VersionInfo, getFeatures, hasFeature } from '/@/renderer/api/utils'; import { ServerFeature, ServerFeatures } from '/@/renderer/api/features-types'; @@ -286,34 +285,6 @@ const getSongList = async (args: SongListArgs): Promise => { throw new Error('Failed to get song list'); } - if ( - (query.sortBy === SongListSort.ALBUM || query.sortBy === SongListSort.ALBUM_ARTIST) && - !query.limit - ) { - const isAlbumArtist = query.sortBy === SongListSort.ALBUM_ARTIST; - - res.body.data.sort((a, b) => { - if (isAlbumArtist) { - const albumDiff = a.album.localeCompare(b.album); - if (albumDiff !== 0) { - return albumDiff; - } - } - - const discDiff = a.discNumber - b.discNumber; - if (discDiff !== 0) { - return discDiff; - } - - const trackDiff = a.trackNumber - b.trackNumber; - if (trackDiff !== 0) { - return trackDiff; - } - - return a.title.localeCompare(b.title); - }); - } - return { items: res.body.data.map((song) => ndNormalize.song(song, apiClientProps.server, '', query.imageSize),