New: Add CF Score to import modal

This commit is contained in:
jack-mil 2023-07-17 10:51:45 -04:00
parent f62bc59a73
commit 1f4f636b5e
3 changed files with 13 additions and 4 deletions

View File

@ -131,7 +131,7 @@ const COLUMNS = [
name: icons.INTERACTIVE,
title: 'Custom Format',
}),
isSortable: true,
isSortable: false,
isVisible: true,
},
{

View File

@ -30,6 +30,8 @@ import {
import { SelectStateInputProps } from 'typings/props';
import Rejection from 'typings/Rejection';
import formatBytes from 'Utilities/Number/formatBytes';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
import translate from 'Utilities/String/translate';
import InteractiveImportRowCellPlaceholder from './InteractiveImportRowCellPlaceholder';
import styles from './InteractiveImportRow.css';
@ -57,6 +59,7 @@ interface InteractiveImportRowProps {
languages?: Language[];
size: number;
customFormats?: object[];
customFormatScore?: number;
rejections: Rejection[];
columns: Column[];
episodeFileId?: number;
@ -80,6 +83,7 @@ function InteractiveImportRow(props: InteractiveImportRowProps) {
releaseGroup,
size,
customFormats,
customFormatScore,
rejections,
isReprocessing,
isSelected,
@ -427,8 +431,8 @@ function InteractiveImportRow(props: InteractiveImportRowProps) {
<TableRowCell>
{customFormats?.length ? (
<Popover
anchor={<Icon name={icons.INTERACTIVE} />}
title="Formats"
anchor={formatPreferredWordScore(customFormatScore)}
title={translate('CustomFormats')}
body={
<div className={styles.customFormatTooltip}>
<EpisodeFormats formats={customFormats} />

View File

@ -29,6 +29,7 @@ namespace Sonarr.Api.V3.ManualImport
public int QualityWeight { get; set; }
public string DownloadId { get; set; }
public List<CustomFormatResource> CustomFormats { get; set; }
public int CustomFormatScore { get; set; }
public IEnumerable<Rejection> Rejections { get; set; }
}
@ -41,6 +42,9 @@ namespace Sonarr.Api.V3.ManualImport
return null;
}
var customFormats = model.CustomFormats;
var customFormatScore = model.Series?.QualityProfile.Value.CalculateCustomFormatScore(customFormats) ?? 0;
return new ManualImportResource
{
Id = HashConverter.GetHashInt31(model.Path),
@ -56,7 +60,8 @@ namespace Sonarr.Api.V3.ManualImport
ReleaseGroup = model.ReleaseGroup,
Quality = model.Quality,
Languages = model.Languages,
CustomFormats = model.CustomFormats.ToResource(false),
CustomFormats = customFormats.ToResource(false),
CustomFormatScore = customFormatScore,
// QualityWeight
DownloadId = model.DownloadId,