Skip to content

Commit

Permalink
AmazonPrime: Remove all version tags from movie/show title (#346)
Browse files Browse the repository at this point in the history
* AmazonPrime: Remove [dt./OV] from movie/show title

* Prettier formatting

* Use regex to catch all tags instead
  • Loading branch information
smoothlystable authored Oct 15, 2023
1 parent b82fc8b commit 71aacce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/amazon-prime/AmazonPrimeApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 71aacce

Please sign in to comment.