From 71aacce1efc3de18a90a0b4a0db0f8db9239f224 Mon Sep 17 00:00:00 2001 From: smoothlystable <20187834+smoothlystable@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:18:40 +0200 Subject: [PATCH] AmazonPrime: Remove all version tags from movie/show title (#346) * AmazonPrime: Remove [dt./OV] from movie/show title * Prettier formatting * Use regex to catch all tags instead --- src/services/amazon-prime/AmazonPrimeApi.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/services/amazon-prime/AmazonPrimeApi.ts b/src/services/amazon-prime/AmazonPrimeApi.ts index 7e7aa6a2..c8fafb59 100644 --- a/src/services/amazon-prime/AmazonPrimeApi.ts +++ b/src/services/amazon-prime/AmazonPrimeApi.ts @@ -375,13 +375,14 @@ class _AmazonPrimeApi extends ServiceApi { const serviceId = this.id; const { catalog, family } = metadata.catalogMetadata; const { id, entityType } = catalog; + const versionTagRegex = / \[[\w.]+\/[\w.]+\]$/; // some media with dub/subtitle will add [version/tag] to the title (issue #342) if (entityType === 'TV Show' || entityType === 'Bonus Content') { let title = ''; let season = 0; if (family) { const [seasonInfo, showInfo] = family.tvAncestors; - title = showInfo.catalog.title.replace(' [dt./OV]', ''); + title = showInfo.catalog.title.replace(versionTagRegex, ''); season = seasonInfo.catalog.seasonNumber; } const { episodeNumber: number = 0, title: episodeTitle } = catalog; @@ -397,7 +398,7 @@ class _AmazonPrimeApi extends ServiceApi { }, }); } else { - const title = catalog.title.replace(' [dt./OV]', ''); + const title = catalog.title.replace(versionTagRegex, ''); item = new MovieItem({ serviceId, id,