mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 13:40:24 +02:00
enable reordering non-smart playlists
This commit is contained in:
@@ -226,6 +226,15 @@ export const contract = c.router({
|
||||
400: jfType._response.error,
|
||||
},
|
||||
},
|
||||
movePlaylistItem: {
|
||||
body: null,
|
||||
method: 'POST',
|
||||
path: 'playlists/:playlistId/items/:itemId/move/:newIdx',
|
||||
responses: {
|
||||
200: jfType._response.moveItem,
|
||||
400: jfType._response.error,
|
||||
},
|
||||
},
|
||||
removeFavorite: {
|
||||
body: jfType._parameters.favorite,
|
||||
method: 'DELETE',
|
||||
|
||||
@@ -53,6 +53,7 @@ import {
|
||||
ServerInfoArgs,
|
||||
SimilarSongsArgs,
|
||||
Song,
|
||||
MoveItemArgs,
|
||||
} from '/@/renderer/api/types';
|
||||
import { jfApiClient } from '/@/renderer/api/jellyfin/jellyfin-api';
|
||||
import { jfNormalize } from './jellyfin-normalize';
|
||||
@@ -1025,6 +1026,23 @@ const getSimilarSongs = async (args: SimilarSongsArgs): Promise<Song[]> => {
|
||||
}, []);
|
||||
};
|
||||
|
||||
const movePlaylistItem = async (args: MoveItemArgs): Promise<void> => {
|
||||
const { apiClientProps, query } = args;
|
||||
|
||||
const res = await jfApiClient(apiClientProps).movePlaylistItem({
|
||||
body: null,
|
||||
params: {
|
||||
itemId: query.trackId,
|
||||
newIdx: query.endingIndex.toString(),
|
||||
playlistId: query.playlistId,
|
||||
},
|
||||
});
|
||||
|
||||
if (res.status !== 204) {
|
||||
throw new Error('Failed to move item in playlist');
|
||||
}
|
||||
};
|
||||
|
||||
export const jfController = {
|
||||
addToPlaylist,
|
||||
authenticate,
|
||||
@@ -1049,6 +1067,7 @@ export const jfController = {
|
||||
getSongDetail,
|
||||
getSongList,
|
||||
getTopSongList,
|
||||
movePlaylistItem,
|
||||
removeFromPlaylist,
|
||||
scrobble,
|
||||
search,
|
||||
|
||||
@@ -681,6 +681,8 @@ export enum JellyfinExtensions {
|
||||
SONG_LYRICS = 'songLyrics',
|
||||
}
|
||||
|
||||
const moveItem = z.null();
|
||||
|
||||
export const jfType = {
|
||||
_enum: {
|
||||
albumArtistList: albumArtistListSort,
|
||||
@@ -729,6 +731,7 @@ export const jfType = {
|
||||
genre,
|
||||
genreList,
|
||||
lyrics,
|
||||
moveItem,
|
||||
musicFolderList,
|
||||
playlist,
|
||||
playlistList,
|
||||
|
||||
Reference in New Issue
Block a user