diff --git a/overseerr-api.yml b/overseerr-api.yml index 542ac59f4..c8b528859 100644 --- a/overseerr-api.yml +++ b/overseerr-api.yml @@ -4186,6 +4186,16 @@ paths: schema: type: number example: 10 + - in: query + name: voteCountGte + schema: + type: number + example: 7 + - in: query + name: voteCountLte + schema: + type: number + example: 10 - in: query name: watchRegion schema: @@ -4465,6 +4475,16 @@ paths: schema: type: number example: 10 + - in: query + name: voteCountGte + schema: + type: number + example: 7 + - in: query + name: voteCountLte + schema: + type: number + example: 10 - in: query name: watchRegion schema: diff --git a/server/api/themoviedb/index.ts b/server/api/themoviedb/index.ts index 4c931ff97..ef36fcd6d 100644 --- a/server/api/themoviedb/index.ts +++ b/server/api/themoviedb/index.ts @@ -65,6 +65,8 @@ interface DiscoverMovieOptions { withRuntimeLte?: string; voteAverageGte?: string; voteAverageLte?: string; + voteCountGte?: string; + voteCountLte?: string; originalLanguage?: string; genre?: string; studio?: string; @@ -83,6 +85,8 @@ interface DiscoverTvOptions { withRuntimeLte?: string; voteAverageGte?: string; voteAverageLte?: string; + voteCountGte?: string; + voteCountLte?: string; includeEmptyReleaseDate?: boolean; originalLanguage?: string; genre?: string; @@ -460,6 +464,8 @@ class TheMovieDb extends ExternalAPI { withRuntimeLte, voteAverageGte, voteAverageLte, + voteCountGte, + voteCountLte, watchProviders, watchRegion, }: DiscoverMovieOptions = {}): Promise => { @@ -504,6 +510,8 @@ class TheMovieDb extends ExternalAPI { 'with_runtime.lte': withRuntimeLte, 'vote_average.gte': voteAverageGte, 'vote_average.lte': voteAverageLte, + 'vote_count.gte': voteCountGte, + 'vote_count.lte': voteCountLte, watch_region: watchRegion, with_watch_providers: watchProviders, }, @@ -530,6 +538,8 @@ class TheMovieDb extends ExternalAPI { withRuntimeLte, voteAverageGte, voteAverageLte, + voteCountGte, + voteCountLte, watchProviders, watchRegion, }: DiscoverTvOptions = {}): Promise => { @@ -574,6 +584,8 @@ class TheMovieDb extends ExternalAPI { 'with_runtime.lte': withRuntimeLte, 'vote_average.gte': voteAverageGte, 'vote_average.lte': voteAverageLte, + 'vote_count.gte': voteCountGte, + 'vote_count.lte': voteCountLte, with_watch_providers: watchProviders, watch_region: watchRegion, }, diff --git a/server/routes/discover.ts b/server/routes/discover.ts index 47492fc06..487d1a329 100644 --- a/server/routes/discover.ts +++ b/server/routes/discover.ts @@ -65,6 +65,8 @@ const QueryFilterOptions = z.object({ withRuntimeLte: z.coerce.string().optional(), voteAverageGte: z.coerce.string().optional(), voteAverageLte: z.coerce.string().optional(), + voteCountGte: z.coerce.string().optional(), + voteCountLte: z.coerce.string().optional(), network: z.coerce.string().optional(), watchProviders: z.coerce.string().optional(), watchRegion: z.coerce.string().optional(), @@ -96,6 +98,8 @@ discoverRoutes.get('/movies', async (req, res, next) => { withRuntimeLte: query.withRuntimeLte, voteAverageGte: query.voteAverageGte, voteAverageLte: query.voteAverageLte, + voteCountGte: query.voteCountGte, + voteCountLte: query.voteCountLte, watchProviders: query.watchProviders, watchRegion: query.watchRegion, }); @@ -371,6 +375,8 @@ discoverRoutes.get('/tv', async (req, res, next) => { withRuntimeLte: query.withRuntimeLte, voteAverageGte: query.voteAverageGte, voteAverageLte: query.voteAverageLte, + voteCountGte: query.voteCountGte, + voteCountLte: query.voteCountLte, watchProviders: query.watchProviders, watchRegion: query.watchRegion, }); diff --git a/src/components/Discover/FilterSlideover/index.tsx b/src/components/Discover/FilterSlideover/index.tsx index 10ee0fea2..83d5a2e49 100644 --- a/src/components/Discover/FilterSlideover/index.tsx +++ b/src/components/Discover/FilterSlideover/index.tsx @@ -35,8 +35,10 @@ const messages = defineMessages({ ratingText: 'Ratings between {minValue} and {maxValue}', clearfilters: 'Clear Active Filters', tmdbuserscore: 'TMDB User Score', + tmdbuservotecount: 'TMDB User Vote Count', runtime: 'Runtime', streamingservices: 'Streaming Services', + voteCount: 'Number of votes between {minValue} and {maxValue}', }); type FilterSlideoverProps = { @@ -246,6 +248,45 @@ const FilterSlideover = ({ })} /> + + {intl.formatMessage(messages.tmdbuservotecount)} + +
+ { + updateQueryParams( + 'voteCountGte', + min !== 0 && Number(currentFilters.voteCountLte) !== 1000 + ? min.toString() + : undefined + ); + }} + onUpdateMax={(max) => { + updateQueryParams( + 'voteCountLte', + max !== 1000 && Number(currentFilters.voteCountGte) !== 0 + ? max.toString() + : undefined + ); + }} + subText={intl.formatMessage(messages.voteCount, { + minValue: currentFilters.voteCountGte ?? 0, + maxValue: currentFilters.voteCountLte ?? 1000, + })} + /> +
{intl.formatMessage(messages.streamingservices)} diff --git a/src/components/Discover/constants.ts b/src/components/Discover/constants.ts index 802ba7c6e..0571f1fc7 100644 --- a/src/components/Discover/constants.ts +++ b/src/components/Discover/constants.ts @@ -104,6 +104,8 @@ export const QueryFilterOptions = z.object({ withRuntimeLte: z.string().optional(), voteAverageGte: z.string().optional(), voteAverageLte: z.string().optional(), + voteCountLte: z.string().optional(), + voteCountGte: z.string().optional(), watchRegion: z.string().optional(), watchProviders: z.string().optional(), }); @@ -169,6 +171,14 @@ export const prepareFilterValues = ( filterValues.voteAverageLte = values.voteAverageLte; } + if (values.voteCountGte) { + filterValues.voteCountGte = values.voteCountGte; + } + + if (values.voteCountLte) { + filterValues.voteCountLte = values.voteCountLte; + } + if (values.watchProviders) { filterValues.watchProviders = values.watchProviders; } @@ -190,6 +200,12 @@ export const countActiveFilters = (filterValues: FilterOptions): number => { delete clonedFilters.voteAverageLte; } + if (clonedFilters.voteCountGte || filterValues.voteCountLte) { + totalCount += 1; + delete clonedFilters.voteCountGte; + delete clonedFilters.voteCountLte; + } + if (clonedFilters.withRuntimeGte || filterValues.withRuntimeLte) { totalCount += 1; delete clonedFilters.withRuntimeGte; diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index 39d44bbc3..0098eb5c6 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -76,7 +76,9 @@ "components.Discover.FilterSlideover.streamingservices": "Streaming Services", "components.Discover.FilterSlideover.studio": "Studio", "components.Discover.FilterSlideover.tmdbuserscore": "TMDB User Score", + "components.Discover.FilterSlideover.tmdbuservotecount": "TMDB User Vote Count", "components.Discover.FilterSlideover.to": "To", + "components.Discover.FilterSlideover.voteCount": "Number of votes between {minValue} and {maxValue}", "components.Discover.MovieGenreList.moviegenres": "Movie Genres", "components.Discover.MovieGenreSlider.moviegenres": "Movie Genres", "components.Discover.NetworkSlider.networks": "Networks",