1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-08-16 07:19:51 +02:00

New: Add options to show ratings in movie poster info

This commit is contained in:
Bogdan 2023-08-13 01:20:47 +03:00
parent c3b856401e
commit e8e54fdf99
8 changed files with 142 additions and 8 deletions

View File

@ -22,6 +22,9 @@ export interface MovieIndexAppState {
showQualityProfile: boolean; showQualityProfile: boolean;
showReleaseDate: boolean; showReleaseDate: boolean;
showCinemaRelease: boolean; showCinemaRelease: boolean;
showTmdbRating: boolean;
showImdbRating: boolean;
showRottenTomatoesRating: boolean;
showSearchAction: boolean; showSearchAction: boolean;
}; };

View File

@ -100,6 +100,15 @@ function MovieIndexSortMenu(props: MovieIndexSortMenuProps) {
{translate('DigitalRelease')} {translate('DigitalRelease')}
</SortMenuItem> </SortMenuItem>
<SortMenuItem
name="tmdbRating"
sortKey={sortKey}
sortDirection={sortDirection}
onPress={onSortSelect}
>
{translate('TmdbRating')}
</SortMenuItem>
<SortMenuItem <SortMenuItem
name="imdbRating" name="imdbRating"
sortKey={sortKey} sortKey={sortKey}
@ -110,12 +119,12 @@ function MovieIndexSortMenu(props: MovieIndexSortMenuProps) {
</SortMenuItem> </SortMenuItem>
<SortMenuItem <SortMenuItem
name="tmdbRating" name="rottenTomatoesRating"
sortKey={sortKey} sortKey={sortKey}
sortDirection={sortDirection} sortDirection={sortDirection}
onPress={onSortSelect} onPress={onSortSelect}
> >
{translate('TmdbRating')} {translate('RottenTomatoesRating')}
</SortMenuItem> </SortMenuItem>
<SortMenuItem <SortMenuItem

View File

@ -2,10 +2,13 @@ import React, { useCallback, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { MOVIE_SEARCH, REFRESH_MOVIE } from 'Commands/commandNames'; import { MOVIE_SEARCH, REFRESH_MOVIE } from 'Commands/commandNames';
import Icon from 'Components/Icon'; import Icon from 'Components/Icon';
import ImdbRating from 'Components/ImdbRating';
import Label from 'Components/Label'; import Label from 'Components/Label';
import IconButton from 'Components/Link/IconButton'; import IconButton from 'Components/Link/IconButton';
import Link from 'Components/Link/Link'; import Link from 'Components/Link/Link';
import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; import SpinnerIconButton from 'Components/Link/SpinnerIconButton';
import RottenTomatoRating from 'Components/RottenTomatoRating';
import TmdbRating from 'Components/TmdbRating';
import Popover from 'Components/Tooltip/Popover'; import Popover from 'Components/Tooltip/Popover';
import { icons } from 'Helpers/Props'; import { icons } from 'Helpers/Props';
import DeleteMovieModal from 'Movie/Delete/DeleteMovieModal'; import DeleteMovieModal from 'Movie/Delete/DeleteMovieModal';
@ -44,6 +47,9 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
showQualityProfile, showQualityProfile,
showCinemaRelease, showCinemaRelease,
showReleaseDate, showReleaseDate,
showTmdbRating,
showImdbRating,
showRottenTomatoesRating,
showSearchAction, showSearchAction,
} = useSelector(selectPosterOptions); } = useSelector(selectPosterOptions);
@ -257,6 +263,24 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
</div> </div>
) : null} ) : null}
{showTmdbRating && !!ratings.tmdb ? (
<div className={styles.title}>
<TmdbRating ratings={ratings} iconSize={12} />
</div>
) : null}
{showImdbRating && !!ratings.imdb ? (
<div className={styles.title}>
<ImdbRating ratings={ratings} iconSize={12} />
</div>
) : null}
{showRottenTomatoesRating && !!ratings.rottenTomatoes ? (
<div className={styles.title}>
<RottenTomatoRating ratings={ratings} iconSize={12} />
</div>
) : null}
<MovieIndexPosterInfo <MovieIndexPosterInfo
studio={studio} studio={studio}
qualityProfile={qualityProfile} qualityProfile={qualityProfile}
@ -279,6 +303,9 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
certification={certification} certification={certification}
originalTitle={originalTitle} originalTitle={originalTitle}
originalLanguage={originalLanguage} originalLanguage={originalLanguage}
showTmdbRating={showTmdbRating}
showImdbRating={showImdbRating}
showRottenTomatoesRating={showRottenTomatoesRating}
/> />
<EditMovieModalConnector <EditMovieModalConnector

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import Icon from 'Components/Icon'; import Icon from 'Components/Icon';
import ImdbRating from 'Components/ImdbRating'; import ImdbRating from 'Components/ImdbRating';
import RottenTomatoRating from 'Components/RottenTomatoRating';
import TmdbRating from 'Components/TmdbRating'; import TmdbRating from 'Components/TmdbRating';
import { icons } from 'Helpers/Props'; import { icons } from 'Helpers/Props';
import { Language, Ratings } from 'Movie/Movie'; import { Language, Ratings } from 'Movie/Movie';
@ -33,6 +34,9 @@ interface MovieIndexPosterInfoProps {
shortDateFormat: string; shortDateFormat: string;
longDateFormat: string; longDateFormat: string;
timeFormat: string; timeFormat: string;
showTmdbRating: boolean;
showImdbRating: boolean;
showRottenTomatoesRating: boolean;
} }
function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) { function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
@ -58,6 +62,9 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
shortDateFormat, shortDateFormat,
longDateFormat, longDateFormat,
timeFormat, timeFormat,
showTmdbRating,
showImdbRating,
showRottenTomatoesRating,
} = props; } = props;
if (sortKey === 'studio' && studio) { if (sortKey === 'studio' && studio) {
@ -163,7 +170,15 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
); );
} }
if (sortKey === 'imdbRating' && !!ratings.imdb) { if (!showTmdbRating && sortKey === 'tmdbRating' && !!ratings.tmdb) {
return (
<div className={styles.info}>
<TmdbRating ratings={ratings} iconSize={12} />
</div>
);
}
if (!showImdbRating && sortKey === 'imdbRating' && !!ratings.imdb) {
return ( return (
<div className={styles.info}> <div className={styles.info}>
<ImdbRating ratings={ratings} iconSize={12} /> <ImdbRating ratings={ratings} iconSize={12} />
@ -171,10 +186,14 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
); );
} }
if (sortKey === 'tmdbRating' && !!ratings.tmdb) { if (
!showRottenTomatoesRating &&
sortKey === 'rottenTomatoesRating' &&
!!ratings.rottenTomatoes
) {
return ( return (
<div className={styles.info}> <div className={styles.info}>
<TmdbRating ratings={ratings} iconSize={12} /> <RottenTomatoRating ratings={ratings} iconSize={12} />
</div> </div>
); );
} }

View File

@ -145,6 +145,9 @@ export default function MovieIndexPosters(props: MovieIndexPostersProps) {
showQualityProfile, showQualityProfile,
showCinemaRelease, showCinemaRelease,
showReleaseDate, showReleaseDate,
showTmdbRating,
showImdbRating,
showRottenTomatoesRating,
} = posterOptions; } = posterOptions;
const nextAiringHeight = 19; const nextAiringHeight = 19;
@ -176,12 +179,22 @@ export default function MovieIndexPosters(props: MovieIndexPostersProps) {
heights.push(19); heights.push(19);
} }
if (showTmdbRating) {
heights.push(19);
}
if (showImdbRating) {
heights.push(19);
}
if (showRottenTomatoesRating) {
heights.push(19);
}
switch (sortKey) { switch (sortKey) {
case 'studio': case 'studio':
case 'added': case 'added':
case 'year': case 'year':
case 'imdbRating':
case 'tmdbRating':
case 'path': case 'path':
case 'sizeOnDisk': case 'sizeOnDisk':
case 'originalTitle': case 'originalTitle':
@ -204,6 +217,21 @@ export default function MovieIndexPosters(props: MovieIndexPostersProps) {
heights.push(19); heights.push(19);
} }
break; break;
case 'imdbRating':
if (!showImdbRating) {
heights.push(19);
}
break;
case 'tmdbRating':
if (!showTmdbRating) {
heights.push(19);
}
break;
case 'rottenTomatoesRating':
if (!showRottenTomatoesRating) {
heights.push(19);
}
break;
default: default:
// No need to add a height of 0 // No need to add a height of 0
} }

View File

@ -54,6 +54,9 @@ function MovieIndexPosterOptionsModalContent(
showQualityProfile, showQualityProfile,
showCinemaRelease, showCinemaRelease,
showReleaseDate, showReleaseDate,
showTmdbRating,
showImdbRating,
showRottenTomatoesRating,
showSearchAction, showSearchAction,
} = posterOptions; } = posterOptions;
@ -156,6 +159,42 @@ function MovieIndexPosterOptionsModalContent(
/> />
</FormGroup> </FormGroup>
<FormGroup>
<FormLabel>{translate('ShowTmdbRating')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="showTmdbRating"
value={showTmdbRating}
helpText={translate('ShowTmdbRatingHelpText')}
onChange={onPosterOptionChange}
/>
</FormGroup>
<FormGroup>
<FormLabel>{translate('ShowImdbRating')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="showImdbRating"
value={showImdbRating}
helpText={translate('ShowImdbRatingHelpText')}
onChange={onPosterOptionChange}
/>
</FormGroup>
<FormGroup>
<FormLabel>{translate('ShowRottenTomatoesRating')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="showRottenTomatoesRating"
value={showRottenTomatoesRating}
helpText={translate('ShowRottenTomatoesRatingHelpText')}
onChange={onPosterOptionChange}
/>
</FormGroup>
<FormGroup> <FormGroup>
<FormLabel>{translate('ShowSearch')}</FormLabel> <FormLabel>{translate('ShowSearch')}</FormLabel>

View File

@ -35,6 +35,9 @@ export const defaultState = {
showQualityProfile: true, showQualityProfile: true,
showCinemaRelease: false, showCinemaRelease: false,
showReleaseDate: false, showReleaseDate: false,
showTmdbRating: false,
showImdbRating: false,
showRottenTomatoesRating: false,
showSearchAction: false showSearchAction: false
}, },
@ -253,7 +256,7 @@ export const defaultState = {
rottenTomatoesRating: function(item) { rottenTomatoesRating: function(item) {
const { ratings = {} } = item; const { ratings = {} } = item;
return ratings.rottenTomatoes ? ratings.rottenTomatoes.value : 0; return ratings.rottenTomatoes ? ratings.rottenTomatoes.value : -1;
} }
}, },

View File

@ -1021,6 +1021,8 @@
"ShowCutoffUnmetIconHelpText": "Show icon for files when the cutoff hasn't been met", "ShowCutoffUnmetIconHelpText": "Show icon for files when the cutoff hasn't been met",
"ShowDateAdded": "Show Date Added", "ShowDateAdded": "Show Date Added",
"ShowGenres": "Show Genres", "ShowGenres": "Show Genres",
"ShowImdbRating": "Show IMDb Rating",
"ShowImdbRatingHelpText": "Show IMDb rating under poster",
"ShowMonitored": "Show Monitored", "ShowMonitored": "Show Monitored",
"ShowMonitoredHelpText": "Show monitored status under poster", "ShowMonitoredHelpText": "Show monitored status under poster",
"ShowMovieInformation": "Show Movie Information", "ShowMovieInformation": "Show Movie Information",
@ -1033,12 +1035,16 @@
"ShowRatings": "Show Ratings", "ShowRatings": "Show Ratings",
"ShowReleaseDate": "Show Release Date", "ShowReleaseDate": "Show Release Date",
"ShowReleaseDateHelpText": "Show release date under poster", "ShowReleaseDateHelpText": "Show release date under poster",
"ShowRottenTomatoesRating": "Show Tomato Rating",
"ShowRottenTomatoesRatingHelpText": "Show Tomato rating under poster",
"ShowSearch": "Show Search", "ShowSearch": "Show Search",
"ShowSearchHelpText": "Show search button on hover", "ShowSearchHelpText": "Show search button on hover",
"ShowSizeOnDisk": "Show Size on Disk", "ShowSizeOnDisk": "Show Size on Disk",
"ShowStudio": "Show Studio", "ShowStudio": "Show Studio",
"ShowTitle": "Show Title", "ShowTitle": "Show Title",
"ShowTitleHelpText": "Show movie title under poster", "ShowTitleHelpText": "Show movie title under poster",
"ShowTmdbRating": "Show TMDb Rating",
"ShowTmdbRatingHelpText": "Show TMDb rating under poster",
"ShowUnknownMovieItems": "Show Unknown Movie Items", "ShowUnknownMovieItems": "Show Unknown Movie Items",
"ShowYear": "Show Year", "ShowYear": "Show Year",
"ShownClickToHide": "Shown, click to hide", "ShownClickToHide": "Shown, click to hide",