mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 02:13:33 +00:00
better album dates
This commit is contained in:
parent
8c929d0dc3
commit
9923c021fa
7 changed files with 52 additions and 13 deletions
|
|
@ -175,8 +175,11 @@ const normalizeSong = (
|
|||
peak: null,
|
||||
playCount: (item.UserData && item.UserData.PlayCount) || 0,
|
||||
playlistItemId: item.PlaylistItemId,
|
||||
// releaseDate: (item.ProductionYear && new Date(item.ProductionYear, 0, 1).toISOString()) || null,
|
||||
releaseDate: null,
|
||||
releaseDate: item.PremiereDate
|
||||
? new Date(item.PremiereDate).toISOString()
|
||||
: item.ProductionYear
|
||||
? new Date(item.ProductionYear, 0, 1).toISOString()
|
||||
: null,
|
||||
releaseYear: item.ProductionYear ? String(item.ProductionYear) : null,
|
||||
serverId: server?.id || '',
|
||||
serverType: ServerType.JELLYFIN,
|
||||
|
|
@ -237,6 +240,7 @@ const normalizeAlbum = (
|
|||
lastPlayedAt: null,
|
||||
mbzId: item.ProviderIds?.MusicBrainzAlbum || null,
|
||||
name: item.Name,
|
||||
originalDate: null,
|
||||
playCount: item.UserData?.PlayCount || 0,
|
||||
releaseDate: item.PremiereDate?.split('T')[0] || null,
|
||||
releaseYear: item.ProductionYear || null,
|
||||
|
|
|
|||
|
|
@ -119,7 +119,10 @@ const normalizeSong = (
|
|||
: null,
|
||||
playCount: item.playCount,
|
||||
playlistItemId,
|
||||
releaseDate: new Date(item.year, 0, 1).toISOString(),
|
||||
releaseDate: (item.releaseDate
|
||||
? new Date(item.releaseDate)
|
||||
: new Date(item.year, 0, 1)
|
||||
).toISOString(),
|
||||
releaseYear: String(item.year),
|
||||
serverId: server?.id || 'unknown',
|
||||
serverType: ServerType.NAVIDROME,
|
||||
|
|
@ -173,8 +176,16 @@ const normalizeAlbum = (
|
|||
lastPlayedAt: normalizePlayDate(item),
|
||||
mbzId: item.mbzAlbumId || null,
|
||||
name: item.name,
|
||||
originalDate: item.originalDate
|
||||
? new Date(item.originalDate).toISOString()
|
||||
: item.originalYear
|
||||
? new Date(item.originalYear, 0, 1).toISOString()
|
||||
: null,
|
||||
playCount: item.playCount,
|
||||
releaseDate: new Date(item.minYear, 0, 1).toISOString(),
|
||||
releaseDate: (item.releaseDate
|
||||
? new Date(item.releaseDate)
|
||||
: new Date(item.minYear, 0, 1)
|
||||
).toISOString(),
|
||||
releaseYear: item.minYear,
|
||||
serverId: server?.id || 'unknown',
|
||||
serverType: ServerType.NAVIDROME,
|
||||
|
|
|
|||
|
|
@ -128,9 +128,12 @@ const album = z.object({
|
|||
name: z.string(),
|
||||
orderAlbumArtistName: z.string(),
|
||||
orderAlbumName: z.string(),
|
||||
originalDate: z.string().optional(),
|
||||
originalYear: z.number().optional(),
|
||||
playCount: z.number(),
|
||||
playDate: z.string().optional(),
|
||||
rating: z.number().optional(),
|
||||
releaseDate: z.string().optional(),
|
||||
size: z.number(),
|
||||
songCount: z.number(),
|
||||
sortAlbumArtistName: z.string(),
|
||||
|
|
@ -214,6 +217,7 @@ const song = z.object({
|
|||
playCount: z.number(),
|
||||
playDate: z.string().optional(),
|
||||
rating: z.number().optional(),
|
||||
releaseDate: z.string().optional(),
|
||||
rgAlbumGain: z.number().optional(),
|
||||
rgAlbumPeak: z.number().optional(),
|
||||
rgTrackGain: z.number().optional(),
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ const normalizeAlbum = (
|
|||
lastPlayedAt: null,
|
||||
mbzId: null,
|
||||
name: item.name,
|
||||
originalDate: null,
|
||||
playCount: null,
|
||||
releaseDate: item.year ? new Date(item.year, 0, 1).toISOString() : null,
|
||||
releaseYear: item.year ? Number(item.year) : null,
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ export type Album = {
|
|||
lastPlayedAt: string | null;
|
||||
mbzId: string | null;
|
||||
name: string;
|
||||
originalDate: string | null;
|
||||
playCount: number | null;
|
||||
releaseDate: string | null;
|
||||
releaseYear: number | null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue