funkwhale bodge

This commit is contained in:
Kendall Garner 2024-10-01 17:21:28 -07:00
parent ecef9bea5e
commit b3b810c62c
No known key found for this signature in database
GPG Key ID: 18D2767419676C87
3 changed files with 27 additions and 20 deletions

View File

@ -125,7 +125,7 @@ export const SubsonicController: ControllerEndpoint = {
} }
return { return {
id: res.body.playlist.id, id: res.body.playlist.id.toString(),
name: res.body.playlist.name, name: res.body.playlist.name,
}; };
}, },
@ -570,7 +570,10 @@ export const SubsonicController: ControllerEndpoint = {
} }
return { return {
items: res.body.musicFolders.musicFolder, items: res.body.musicFolders.musicFolder.map((folder) => ({
id: folder.id.toString(),
name: folder.name,
})),
startIndex: 0, startIndex: 0,
totalRecordCount: res.body.musicFolders.musicFolder.length, totalRecordCount: res.body.musicFolders.musicFolder.length,
}; };
@ -902,7 +905,7 @@ export const SubsonicController: ControllerEndpoint = {
fromAlbumPromises.push( fromAlbumPromises.push(
ssApiClient(apiClientProps).getAlbum({ ssApiClient(apiClientProps).getAlbum({
query: { query: {
id: albumId, id: albumId.toString(),
}, },
}), }),
); );

View File

@ -54,16 +54,16 @@ const normalizeSong = (
album: item.album || '', album: item.album || '',
albumArtists: [ albumArtists: [
{ {
id: item.artistId || '', id: item.artistId?.toString() || '',
imageUrl: null, imageUrl: null,
name: item.artist || '', name: item.artist || '',
}, },
], ],
albumId: item.albumId || '', albumId: item.albumId?.toString() || '',
artistName: item.artist || '', artistName: item.artist || '',
artists: [ artists: [
{ {
id: item.artistId || '', id: item.artistId?.toString() || '',
imageUrl: null, imageUrl: null,
name: item.artist || '', name: item.artist || '',
}, },
@ -95,7 +95,7 @@ const normalizeSong = (
}, },
] ]
: [], : [],
id: item.id, id: item.id.toString(),
imagePlaceholderUrl: null, imagePlaceholderUrl: null,
imageUrl, imageUrl,
itemType: LibraryItem.SONG, itemType: LibraryItem.SONG,
@ -146,7 +146,7 @@ const normalizeAlbumArtist = (
biography: null, biography: null,
duration: null, duration: null,
genres: [], genres: [],
id: item.id, id: item.id.toString(),
imageUrl, imageUrl,
itemType: LibraryItem.ALBUM_ARTIST, itemType: LibraryItem.ALBUM_ARTIST,
lastPlayedAt: null, lastPlayedAt: null,
@ -178,9 +178,11 @@ const normalizeAlbum = (
return { return {
albumArtist: item.artist, albumArtist: item.artist,
albumArtists: item.artistId albumArtists: item.artistId
? [{ id: item.artistId, imageUrl: null, name: item.artist }] ? [{ id: item.artistId.toString(), imageUrl: null, name: item.artist }]
: [],
artists: item.artistId
? [{ id: item.artistId.toString(), imageUrl: null, name: item.artist }]
: [], : [],
artists: item.artistId ? [{ id: item.artistId, imageUrl: null, name: item.artist }] : [],
backdropImageUrl: null, backdropImageUrl: null,
comment: null, comment: null,
createdAt: item.created, createdAt: item.created,
@ -195,7 +197,7 @@ const normalizeAlbum = (
}, },
] ]
: [], : [],
id: item.id, id: item.id.toString(),
imagePlaceholderUrl: null, imagePlaceholderUrl: null,
imageUrl, imageUrl,
isCompilation: null, isCompilation: null,
@ -232,7 +234,7 @@ const normalizePlaylist = (
description: item.comment || null, description: item.comment || null,
duration: item.duration, duration: item.duration,
genres: [], genres: [],
id: item.id, id: item.id.toString(),
imagePlaceholderUrl: null, imagePlaceholderUrl: null,
imageUrl: getCoverArtUrl({ imageUrl: getCoverArtUrl({
baseUrl: server?.url, baseUrl: server?.url,

View File

@ -19,6 +19,8 @@ const authenticateParameters = z.object({
v: z.string(), v: z.string(),
}); });
const id = z.number().or(z.string());
const createFavoriteParameters = z.object({ const createFavoriteParameters = z.object({
albumId: z.array(z.string()).optional(), albumId: z.array(z.string()).optional(),
artistId: z.array(z.string()).optional(), artistId: z.array(z.string()).optional(),
@ -43,7 +45,7 @@ const setRatingParameters = z.object({
const setRating = z.null(); const setRating = z.null();
const musicFolder = z.object({ const musicFolder = z.object({
id: z.string(), id,
name: z.string(), name: z.string(),
}); });
@ -66,9 +68,9 @@ const genreItem = z.object({
const song = z.object({ const song = z.object({
album: z.string().optional(), album: z.string().optional(),
albumId: z.string().optional(), albumId: id.optional(),
artist: z.string().optional(), artist: z.string().optional(),
artistId: z.string().optional(), artistId: id.optional(),
averageRating: z.number().optional(), averageRating: z.number().optional(),
bitRate: z.number().optional(), bitRate: z.number().optional(),
bpm: z.number().optional(), bpm: z.number().optional(),
@ -79,7 +81,7 @@ const song = z.object({
duration: z.number().optional(), duration: z.number().optional(),
genre: z.string().optional(), genre: z.string().optional(),
genres: z.array(genreItem).optional(), genres: z.array(genreItem).optional(),
id: z.string(), id,
isDir: z.boolean(), isDir: z.boolean(),
isVideo: z.boolean(), isVideo: z.boolean(),
musicBrainzId: z.string().optional(), musicBrainzId: z.string().optional(),
@ -100,12 +102,12 @@ const song = z.object({
const album = z.object({ const album = z.object({
album: z.string(), album: z.string(),
artist: z.string(), artist: z.string(),
artistId: z.string(), artistId: id,
coverArt: z.string(), coverArt: z.string(),
created: z.string(), created: z.string(),
duration: z.number(), duration: z.number(),
genre: z.string().optional(), genre: z.string().optional(),
id: z.string(), id,
isCompilation: z.boolean().optional(), isCompilation: z.boolean().optional(),
isDir: z.boolean(), isDir: z.boolean(),
isVideo: z.boolean(), isVideo: z.boolean(),
@ -140,7 +142,7 @@ const albumArtist = z.object({
albumCount: z.string(), albumCount: z.string(),
artistImageUrl: z.string().optional(), artistImageUrl: z.string().optional(),
coverArt: z.string().optional(), coverArt: z.string().optional(),
id: z.string(), id,
name: z.string(), name: z.string(),
starred: z.string().optional(), starred: z.string().optional(),
}); });
@ -398,7 +400,7 @@ const playlist = z.object({
created: z.string(), created: z.string(),
duration: z.number(), duration: z.number(),
entry: z.array(song).optional(), entry: z.array(song).optional(),
id: z.string(), id,
name: z.string(), name: z.string(),
owner: z.string(), owner: z.string(),
public: z.boolean(), public: z.boolean(),