fix: hide unknown release years on every platform
Unknown years are stored as 0 and dates as "". Album detail now returns a null year and the Siri catalog sends an empty year instead of "0", so no client has to special-case 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5237b1e53a
commit
4ef610c143
3 files changed
+7
-5
No files matched your search
@@ -134,7 +134,7 @@ function songEntity(song: {
|
||||
albumId: song.albumId,
|
||||
duration: String(song.durationSeconds),
|
||||
genres: song.genres ?? "",
|
||||
year: song.year == null ? "" : String(song.year),
|
||||
year: song.year ? String(song.year) : "",
|
||||
track: song.track == null ? "" : String(song.track),
|
||||
disk: song.diskNumber == null ? "" : String(song.diskNumber),
|
||||
favorite: song.favorite ? "1" : "0",
|
||||
|
||||
@@ -606,7 +606,7 @@ export const browseAlbumDetail = query({
|
||||
|
||||
return {
|
||||
...toBrowseAlbum(album, artist),
|
||||
year: primarySong?.year ?? null,
|
||||
year: primarySong?.year || null,
|
||||
genre: primarySong?.genres[0] ?? null,
|
||||
releaseDate: album.date,
|
||||
hasLossless: songs.some((song) => "lossless" in song.files),
|
||||
@@ -640,7 +640,7 @@ async function browseAlbumSummaryHandler(
|
||||
|
||||
return {
|
||||
...toBrowseAlbum(album, artist),
|
||||
year: primarySong?.year ?? null,
|
||||
year: primarySong?.year || null,
|
||||
genre: primarySong?.genres[0] ?? null,
|
||||
releaseDate: album.date,
|
||||
hasLossless: songs.some((song) => "lossless" in song.files),
|
||||
@@ -1281,7 +1281,7 @@ export const intentCatalogPage = query({
|
||||
albumId: album._id,
|
||||
duration: String(Math.max(0, Math.round(song.length))),
|
||||
genres: song.genres.join(", "),
|
||||
year: String(song.year),
|
||||
year: song.year ? String(song.year) : "",
|
||||
track: String(song.track),
|
||||
disk: String(song.diskNumber ?? ""),
|
||||
favorite: user.favoriteSongs?.includes(song._id) ? "1" : "0",
|
||||
@@ -1302,7 +1302,7 @@ export const intentCatalogPage = query({
|
||||
metadata: {
|
||||
artistName: artist.name,
|
||||
artistId: artist._id,
|
||||
year: String(album.year),
|
||||
year: album.year ? String(album.year) : "",
|
||||
favorite: user.favoriteAlbums?.includes(album._id) ? "1" : "0",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -33,8 +33,10 @@ export type BrowseAlbumTrack = {
|
||||
}
|
||||
|
||||
export type BrowseAlbumDetail = BrowseAlbum & {
|
||||
/** `null` when the files have no year tag; clients hide it. */
|
||||
year: number | null
|
||||
genre: string | null
|
||||
/** Empty when unknown; clients hide it. */
|
||||
releaseDate: string
|
||||
hasLossless: boolean
|
||||
hasAtmos: boolean
|
||||
|
||||
Reference in new issue
Block a user