diff --git a/src/lib/components/media-file-selector.svelte b/src/lib/components/media-file-selector.svelte index b7828c6..8d22ca9 100644 --- a/src/lib/components/media-file-selector.svelte +++ b/src/lib/components/media-file-selector.svelte @@ -153,6 +153,7 @@ ...extractSeasonEpisode(containerFile.filename) }; }); + validateMappings(); step = 4; } function extractSeasonEpisode(filename: string): { season?: number; episode?: number } { @@ -166,16 +167,24 @@ return {}; } + let isValidMapping = false; + function validateMappings(): boolean { - if (mediaType === 'movie') return true; + if (mediaType === 'movie') { + isValidMapping = true; + return true; + } - return selectedFilesMappings.every( + const isValid = selectedFilesMappings.every( (file) => typeof file.season === 'number' && typeof file.episode === 'number' && file.season > 0 && file.episode > 0 ); + + isValidMapping = isValid; + return isValid; } async function updateAttributes() { @@ -484,7 +493,7 @@
-
+
{file.filename}