diff --git a/src/cmd.ts b/src/cmd.ts index b6cf8c3ae..c93b290b7 100755 --- a/src/cmd.ts +++ b/src/cmd.ts @@ -140,7 +140,7 @@ function createCommandWithSharedOptions(name, description) { .option( "--include-season-pack-episodes", "Include episodes from a season pack in the search", - fallback(fileConfig.includeSeasonPackEpisodes, false) + fallback(fileConfig.includeSeasonPackEpisodes, fileConfig.includeEpisodes) ) .option( "--no-include-non-videos", diff --git a/src/preFilter.ts b/src/preFilter.ts index de8419974..84248fc34 100644 --- a/src/preFilter.ts +++ b/src/preFilter.ts @@ -20,14 +20,14 @@ export function filterByContent(searchee: Searchee): boolean { } const isSingleEpisodeTorrent = searchee.files.length === 1 && EP_REGEX.test(searchee.name); - const isSeasonPack = typeof searchee.path !== 'undefined' ? SEASON_REGEX.test(path.dirname(searchee.path).split(path.sep).reverse()[0]): false; - - if (!includeEpisodes && isSingleEpisodeTorrent && !isSeasonPack) { + const isSeasonPackEpisode = searchee.path && searchee.files.length === 1 && SEASON_REGEX.test(path.basename(path.dirname(searchee.path))); + + if (!includeEpisodes && isSingleEpisodeTorrent && !isSeasonPackEpisode) { logReason("it is a single episode"); return false; } - if (!includeSeasonPackEpisodes && (searchee.files.length === 1 && isSeasonPack)) { + if (!includeSeasonPackEpisodes && isSeasonPackEpisode) { logReason("it is a season pack episode"); return false; }