From eadd0c4e101af0386360bbff859f80e008a5be7c Mon Sep 17 00:00:00 2001 From: jack-mil <62065280+jack-mil@users.noreply.github.com> Date: Sat, 15 Jul 2023 13:28:38 -0400 Subject: [PATCH] New: Optionally show Custom Format Score for episodes on Series Details --- frontend/src/Series/Details/EpisodeRow.css | 6 +++++ .../src/Series/Details/EpisodeRow.css.d.ts | 1 + frontend/src/Series/Details/EpisodeRow.js | 23 +++++++++++++++++++ .../src/Series/Details/EpisodeRowConnector.js | 1 + frontend/src/Store/Actions/episodeActions.js | 14 ++++++++++- src/NzbDrone.Core/Localization/Core/en.json | 1 + .../EpisodeFiles/EpisodeFileResource.cs | 6 ++++- 7 files changed, 50 insertions(+), 2 deletions(-) diff --git a/frontend/src/Series/Details/EpisodeRow.css b/frontend/src/Series/Details/EpisodeRow.css index b27a69f1a..4a0940362 100644 --- a/frontend/src/Series/Details/EpisodeRow.css +++ b/frontend/src/Series/Details/EpisodeRow.css @@ -56,3 +56,9 @@ width: 120px; } + +.customFormatScore { + composes: cell from '~Components/Table/Cells/TableRowCell.css'; + + width: 55px; +} diff --git a/frontend/src/Series/Details/EpisodeRow.css.d.ts b/frontend/src/Series/Details/EpisodeRow.css.d.ts index 138000856..d4a5cfe93 100644 --- a/frontend/src/Series/Details/EpisodeRow.css.d.ts +++ b/frontend/src/Series/Details/EpisodeRow.css.d.ts @@ -3,6 +3,7 @@ interface CssExports { 'audio': string; 'audioLanguages': string; + 'customFormatScore': string; 'episodeNumber': string; 'episodeNumberAnime': string; 'languages': string; diff --git a/frontend/src/Series/Details/EpisodeRow.js b/frontend/src/Series/Details/EpisodeRow.js index eba223b16..4b9e827f6 100644 --- a/frontend/src/Series/Details/EpisodeRow.js +++ b/frontend/src/Series/Details/EpisodeRow.js @@ -4,6 +4,7 @@ import MonitorToggleButton from 'Components/MonitorToggleButton'; import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector'; import TableRowCell from 'Components/Table/Cells/TableRowCell'; import TableRow from 'Components/Table/TableRow'; +import Tooltip from 'Components/Tooltip/Tooltip'; import EpisodeFormats from 'Episode/EpisodeFormats'; import EpisodeNumber from 'Episode/EpisodeNumber'; import EpisodeSearchCellConnector from 'Episode/EpisodeSearchCellConnector'; @@ -12,7 +13,9 @@ import EpisodeTitleLink from 'Episode/EpisodeTitleLink'; import EpisodeFileLanguageConnector from 'EpisodeFile/EpisodeFileLanguageConnector'; import MediaInfoConnector from 'EpisodeFile/MediaInfoConnector'; import * as mediaInfoTypes from 'EpisodeFile/mediaInfoTypes'; +import { tooltipPositions } from 'Helpers/Props'; import formatBytes from 'Utilities/Number/formatBytes'; +import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore'; import formatRuntime from 'Utilities/Number/formatRuntime'; import styles from './EpisodeRow.css'; @@ -72,6 +75,7 @@ class EpisodeRow extends Component { episodeFileSize, releaseGroup, customFormats, + customFormatScore, alternateTitles, columns } = this.props; @@ -193,6 +197,24 @@ class EpisodeRow extends Component { ); } + if (name === 'customFormatScore') { + return ( + + } + position={tooltipPositions.BOTTOM} + /> + + ); + } + if (name === 'languages') { return ( Languages { get; set; } public QualityModel Quality { get; set; } public List CustomFormats { get; set; } + public int CustomFormatScore { get; set; } public MediaInfoResource MediaInfo { get; set; } public bool QualityCutoffNotMet { get; set; } @@ -67,6 +68,8 @@ namespace Sonarr.Api.V3.EpisodeFiles } model.Series = series; + var customFormats = formatCalculationService?.ParseCustomFormat(model, model.Series); + var customFormatScore = series?.QualityProfile?.Value?.CalculateCustomFormatScore(customFormats) ?? 0; return new EpisodeFileResource { @@ -84,7 +87,8 @@ namespace Sonarr.Api.V3.EpisodeFiles Quality = model.Quality, MediaInfo = model.MediaInfo.ToResource(model.SceneName), QualityCutoffNotMet = upgradableSpecification.QualityCutoffNotMet(series.QualityProfile.Value, model.Quality), - CustomFormats = formatCalculationService.ParseCustomFormat(model).ToResource(false) + CustomFormats = customFormats.ToResource(false), + CustomFormatScore = customFormatScore }; } }