System content filtering utilities for manga matching.
Provides shared filtering logic for novels, one-shots, and adult content
applied consistently across multiple matching pipelines.
/** * Configuration for system content filtering. * @property shouldIgnoreOneShots - Whether to filter out one-shots * @property shouldIgnoreAdultContent - Whether to filter out adult content * @source */ exportinterfaceSystemFilterConfig { shouldIgnoreOneShots?: boolean; shouldIgnoreAdultContent?: boolean; }
/** * Apply system content filters to manga results. * Filters novels, one-shots (if enabled), adult content (if enabled), and custom skip rules. * @paramresults - Manga results to filter * @parammatchConfig - Match configuration with filter settings * @paramkenmeiManga - Optional Kenmei manga for custom rule evaluation * @paramcontextTitle - Optional title for debug logging * @returns Filtered manga results * @source */ exportfunctionapplySystemContentFilters( results: AniListManga[], matchConfig: SystemFilterConfig, kenmeiManga?: KenmeiManga, contextTitle?: string, ): AniListManga[] { letfilteredResults = results.filter( (manga) =>manga.format !== "NOVEL" && manga.format !== "LIGHT_NOVEL", );
// Filter one-shots if enabled if (matchConfig.shouldIgnoreOneShots) { constbeforeFilter = filteredResults.length; filteredResults = filteredResults.filter((manga) => !isOneShot(manga)); constafterFilter = filteredResults.length;
if (beforeFilter > afterFilter && contextTitle) { console.debug( `[MangaSearchService] 🚫 Filtered out ${beforeFilter-afterFilter} one-shot(s) for "${contextTitle}" during system content filtering`, ); } }
// Filter adult content if enabled if (matchConfig.shouldIgnoreAdultContent) { constbeforeFilter = filteredResults.length; filteredResults = filteredResults.filter((manga) => !manga.isAdult); constafterFilter = filteredResults.length;
if (beforeFilter > afterFilter && contextTitle) { console.debug( `[MangaSearchService] 🚫 Filtered out ${beforeFilter-afterFilter} adult content manga for "${contextTitle}" during system content filtering`, ); } }
if (beforeCustomSkip > afterCustomSkip && contextTitle) { console.debug( `[MangaSearchService] 🚫 Filtered out ${beforeCustomSkip-afterCustomSkip} manga by custom skip rules for "${contextTitle}"`, ); } }
System content filtering utilities for manga matching. Provides shared filtering logic for novels, one-shots, and adult content applied consistently across multiple matching pipelines.
Source