mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-14 00:02:18 +02:00
feat: sync play queue for navidrome/subsonic (#1335)
--------- Co-authored-by: jeffvli <jeffvictorli@gmail.com>
This commit is contained in:
@@ -14,6 +14,8 @@ import {
|
||||
} from '/@/shared/types/domain-types';
|
||||
import { ServerListItem, ServerType } from '/@/shared/types/types';
|
||||
|
||||
const TICKS_PER_MS = 10000;
|
||||
|
||||
const getAlbumArtistCoverArtUrl = (args: {
|
||||
baseUrl: string;
|
||||
item: z.infer<typeof jfType._response.albumArtist>;
|
||||
@@ -221,7 +223,7 @@ const normalizeSong = (
|
||||
createdAt: item.DateCreated,
|
||||
discNumber: (item.ParentIndexNumber && item.ParentIndexNumber) || 1,
|
||||
discSubtitle: null,
|
||||
duration: item.RunTimeTicks / 10000,
|
||||
duration: item.RunTimeTicks / TICKS_PER_MS,
|
||||
explicitStatus: null,
|
||||
gain:
|
||||
item.NormalizationGain !== undefined
|
||||
@@ -294,7 +296,7 @@ const normalizeAlbum = (
|
||||
backdropImageUrl: null,
|
||||
comment: null,
|
||||
createdAt: item.DateCreated,
|
||||
duration: item.RunTimeTicks / 10000,
|
||||
duration: item.RunTimeTicks / TICKS_PER_MS,
|
||||
explicitStatus: null,
|
||||
genres:
|
||||
item.GenreItems?.map((entry) => ({
|
||||
@@ -363,7 +365,7 @@ const normalizeAlbumArtist = (
|
||||
albumCount: item.AlbumCount ?? null,
|
||||
backgroundImageUrl: null,
|
||||
biography: item.Overview || null,
|
||||
duration: item.RunTimeTicks / 10000,
|
||||
duration: item.RunTimeTicks / TICKS_PER_MS,
|
||||
genres: item.GenreItems?.map((entry) => ({
|
||||
_itemType: LibraryItem.GENRE,
|
||||
_serverId: server?.id || '',
|
||||
@@ -409,7 +411,7 @@ const normalizePlaylist = (
|
||||
_serverId: server?.id || '',
|
||||
_serverType: ServerType.JELLYFIN,
|
||||
description: item.Overview || null,
|
||||
duration: item.RunTimeTicks / 10000,
|
||||
duration: item.RunTimeTicks / TICKS_PER_MS,
|
||||
genres: item.GenreItems?.map((entry) => ({
|
||||
_itemType: LibraryItem.GENRE,
|
||||
_serverId: server?.id || '',
|
||||
|
||||
@@ -253,6 +253,7 @@ const sessionInfo = z.object({
|
||||
CanSeek: z.boolean(),
|
||||
IsMuted: z.boolean(),
|
||||
IsPaused: z.boolean(),
|
||||
PositionTicks: z.number().optional(),
|
||||
RepeatMode: z.string(),
|
||||
}),
|
||||
RemoteEndPoint: z.string(),
|
||||
@@ -801,6 +802,28 @@ const folderParameters = z.object({
|
||||
SortOrder: z.enum(sortOrderValues).optional(),
|
||||
});
|
||||
|
||||
const queueItem = z.object({
|
||||
Id: z.string(),
|
||||
PlaylistItemId: z.string().optional(),
|
||||
});
|
||||
|
||||
const saveQueueParameters = scrobbleParameters.merge(
|
||||
z.object({
|
||||
NowPlayingQueue: z.array(queueItem),
|
||||
PlaylistItemId: z.string().optional(),
|
||||
}),
|
||||
);
|
||||
|
||||
const getQueueParameters = z.object({});
|
||||
|
||||
const getSessions = z.array(
|
||||
sessionInfo.merge(
|
||||
z.object({
|
||||
PlaylistItemId: z.string().optional(),
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
export const jfType = {
|
||||
_enum: {
|
||||
albumArtistList: albumArtistListSort,
|
||||
@@ -825,10 +848,12 @@ export const jfType = {
|
||||
filterList: filterListParameters,
|
||||
folder: folderParameters,
|
||||
genreList: genreListParameters,
|
||||
getQueue: getQueueParameters,
|
||||
musicFolderList: musicFolderListParameters,
|
||||
playlistDetail: playlistDetailParameters,
|
||||
playlistList: playlistListParameters,
|
||||
removeFromPlaylist: removeFromPlaylistParameters,
|
||||
saveQueue: saveQueueParameters,
|
||||
scrobble: scrobbleParameters,
|
||||
search: searchParameters,
|
||||
similarArtistList: similarArtistListParameters,
|
||||
@@ -853,6 +878,7 @@ export const jfType = {
|
||||
folderList,
|
||||
genre,
|
||||
genreList,
|
||||
getSessions,
|
||||
lyrics,
|
||||
moveItem,
|
||||
musicFolder,
|
||||
|
||||
Reference in New Issue
Block a user