From 05617e12f6f9d8e8a95c39a86f87a02aca8d26ec Mon Sep 17 00:00:00 2001 From: Ben Scobie Date: Thu, 2 Jan 2025 09:42:32 +0000 Subject: [PATCH] feat: Add rating vote count filters --- .../rules/constants/rules.constants.ts | 28 +++++++++++++++++++ .../rules/getter/radarr-getter.service.ts | 9 ++++++ .../rules/getter/sonarr-getter.service.ts | 3 ++ 3 files changed, 40 insertions(+) diff --git a/server/src/modules/rules/constants/rules.constants.ts b/server/src/modules/rules/constants/rules.constants.ts index 204c24b3..a4a5c6f5 100644 --- a/server/src/modules/rules/constants/rules.constants.ts +++ b/server/src/modules/rules/constants/rules.constants.ts @@ -443,6 +443,13 @@ export class RuleConstants { mediaType: MediaType.MOVIE, type: RuleType.NUMBER, }, + { + id: 17, + name: 'rottenTomatoesRatingVotes', + humanName: 'Rotten Tomatoes rating vote count', + mediaType: MediaType.MOVIE, + type: RuleType.NUMBER, + }, { id: 15, name: 'traktRating', @@ -450,6 +457,13 @@ export class RuleConstants { mediaType: MediaType.MOVIE, type: RuleType.NUMBER, }, + { + id: 18, + name: 'traktRatingVotes', + humanName: 'Trakt rating vote count', + mediaType: MediaType.MOVIE, + type: RuleType.NUMBER, + }, { id: 16, name: 'imdbRating', @@ -457,6 +471,13 @@ export class RuleConstants { mediaType: MediaType.MOVIE, type: RuleType.NUMBER, }, + { + id: 19, + name: 'imdbRatingVotes', + humanName: 'IMDb rating vote count', + mediaType: MediaType.MOVIE, + type: RuleType.NUMBER, + }, ], }, { @@ -620,6 +641,13 @@ export class RuleConstants { mediaType: MediaType.SHOW, type: RuleType.NUMBER, }, + { + id: 20, + name: 'ratingVotes', + humanName: 'Show rating (IMDb) vote count', + mediaType: MediaType.SHOW, + type: RuleType.NUMBER, + }, ], }, { diff --git a/server/src/modules/rules/getter/radarr-getter.service.ts b/server/src/modules/rules/getter/radarr-getter.service.ts index ec49c84d..3a8d1b29 100644 --- a/server/src/modules/rules/getter/radarr-getter.service.ts +++ b/server/src/modules/rules/getter/radarr-getter.service.ts @@ -135,12 +135,21 @@ export class RadarrGetterService { case 'rottenTomatoesRating': { return movieResponse.ratings.rottenTomatoes?.value ?? null; } + case 'rottenTomatoesRatingVotes': { + return movieResponse.ratings.rottenTomatoes?.votes ?? null; + } case 'traktRating': { return movieResponse.ratings.trakt?.value ?? null; } + case 'traktRatingVotes': { + return movieResponse.ratings.trakt?.votes ?? null; + } case 'imdbRating': { return movieResponse.ratings.imdb?.value ?? null; } + case 'imdbRatingVotes': { + return movieResponse.ratings.imdb?.votes ?? null; + } } } else { this.logger.debug( diff --git a/server/src/modules/rules/getter/sonarr-getter.service.ts b/server/src/modules/rules/getter/sonarr-getter.service.ts index d81dcd5e..74bbea77 100644 --- a/server/src/modules/rules/getter/sonarr-getter.service.ts +++ b/server/src/modules/rules/getter/sonarr-getter.service.ts @@ -300,6 +300,9 @@ export class SonarrGetterService { case 'rating': { return showResponse.ratings?.value ?? null; } + case 'ratingVotes': { + return showResponse.ratings?.votes ?? null; + } } } else return null; } else {