diff --git a/src/utils/compare.ts b/src/utils/compare.ts index cceffb8..7db784e 100644 --- a/src/utils/compare.ts +++ b/src/utils/compare.ts @@ -1,11 +1,14 @@ import { CommonMedia } from '@/entrypoint/utils/media'; export function normalizeTitle(title: string): string { - return title - .trim() - .toLowerCase() - .replace(/['":]/g, '') - .replace(/[^a-zA-Z0-9]+/g, '_'); + let titleTrimmed = title.trim().toLowerCase(); + if (titleTrimmed !== 'the movie' && titleTrimmed.endsWith('the movie')) { + titleTrimmed = titleTrimmed.replace('the movie', ''); + } + if (titleTrimmed !== 'the series' && titleTrimmed.endsWith('the series')) { + titleTrimmed = titleTrimmed.replace('the series', ''); + } + return titleTrimmed.replace(/['":]/g, '').replace(/[^a-zA-Z0-9]+/g, '_'); } export function compareTitle(a: string, b: string): boolean {