From 8eb9b7a92efbbf76991d532b828ab48070f13b6d Mon Sep 17 00:00:00 2001 From: Viren070 Date: Sat, 21 Jun 2025 14:16:57 +0100 Subject: [PATCH] fix: fallback to using parsed properties from folder when undefined in file and correctly merge array properties --- packages/core/src/parser/streams.ts | 32 ++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/packages/core/src/parser/streams.ts b/packages/core/src/parser/streams.ts index 4ac3a7d4..2a9ab360 100644 --- a/packages/core/src/parser/streams.ts +++ b/packages/core/src/parser/streams.ts @@ -121,12 +121,34 @@ class StreamParser { : undefined; parsedStream.parsedFile = { - visualTags: [], - audioTags: [], - audioChannels: [], - ...folderParsed, - ...fileParsed, title: folderParsed?.title || fileParsed?.title, + year: fileParsed?.year || folderParsed?.year, + season: fileParsed?.season || folderParsed?.season, + episode: fileParsed?.episode || folderParsed?.episode, + seasons: fileParsed?.seasons || folderParsed?.seasons, + resolution: fileParsed?.resolution || folderParsed?.resolution, + quality: fileParsed?.quality || folderParsed?.quality, + encode: fileParsed?.encode || folderParsed?.encode, + releaseGroup: fileParsed?.releaseGroup || folderParsed?.releaseGroup, + seasonEpisode: fileParsed?.seasonEpisode || folderParsed?.seasonEpisode, + visualTags: Array.from( + new Set([ + ...(folderParsed?.visualTags ?? []), + ...(fileParsed?.visualTags ?? []), + ]) + ), + audioTags: Array.from( + new Set([ + ...(folderParsed?.audioTags ?? []), + ...(fileParsed?.audioTags ?? []), + ]) + ), + audioChannels: Array.from( + new Set([ + ...(folderParsed?.audioChannels ?? []), + ...(fileParsed?.audioChannels ?? []), + ]) + ), languages: Array.from( new Set([ ...(folderParsed?.languages ?? []),