New: Add CF Score to import modal
This commit is contained in:
parent
f62bc59a73
commit
1f4f636b5e
|
@ -131,7 +131,7 @@ const COLUMNS = [
|
||||||
name: icons.INTERACTIVE,
|
name: icons.INTERACTIVE,
|
||||||
title: 'Custom Format',
|
title: 'Custom Format',
|
||||||
}),
|
}),
|
||||||
isSortable: true,
|
isSortable: false,
|
||||||
isVisible: true,
|
isVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,8 @@ import {
|
||||||
import { SelectStateInputProps } from 'typings/props';
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
import Rejection from 'typings/Rejection';
|
import Rejection from 'typings/Rejection';
|
||||||
import formatBytes from 'Utilities/Number/formatBytes';
|
import formatBytes from 'Utilities/Number/formatBytes';
|
||||||
|
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
import InteractiveImportRowCellPlaceholder from './InteractiveImportRowCellPlaceholder';
|
import InteractiveImportRowCellPlaceholder from './InteractiveImportRowCellPlaceholder';
|
||||||
import styles from './InteractiveImportRow.css';
|
import styles from './InteractiveImportRow.css';
|
||||||
|
|
||||||
|
@ -57,6 +59,7 @@ interface InteractiveImportRowProps {
|
||||||
languages?: Language[];
|
languages?: Language[];
|
||||||
size: number;
|
size: number;
|
||||||
customFormats?: object[];
|
customFormats?: object[];
|
||||||
|
customFormatScore?: number;
|
||||||
rejections: Rejection[];
|
rejections: Rejection[];
|
||||||
columns: Column[];
|
columns: Column[];
|
||||||
episodeFileId?: number;
|
episodeFileId?: number;
|
||||||
|
@ -80,6 +83,7 @@ function InteractiveImportRow(props: InteractiveImportRowProps) {
|
||||||
releaseGroup,
|
releaseGroup,
|
||||||
size,
|
size,
|
||||||
customFormats,
|
customFormats,
|
||||||
|
customFormatScore,
|
||||||
rejections,
|
rejections,
|
||||||
isReprocessing,
|
isReprocessing,
|
||||||
isSelected,
|
isSelected,
|
||||||
|
@ -427,8 +431,8 @@ function InteractiveImportRow(props: InteractiveImportRowProps) {
|
||||||
<TableRowCell>
|
<TableRowCell>
|
||||||
{customFormats?.length ? (
|
{customFormats?.length ? (
|
||||||
<Popover
|
<Popover
|
||||||
anchor={<Icon name={icons.INTERACTIVE} />}
|
anchor={formatPreferredWordScore(customFormatScore)}
|
||||||
title="Formats"
|
title={translate('CustomFormats')}
|
||||||
body={
|
body={
|
||||||
<div className={styles.customFormatTooltip}>
|
<div className={styles.customFormatTooltip}>
|
||||||
<EpisodeFormats formats={customFormats} />
|
<EpisodeFormats formats={customFormats} />
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace Sonarr.Api.V3.ManualImport
|
||||||
public int QualityWeight { get; set; }
|
public int QualityWeight { get; set; }
|
||||||
public string DownloadId { get; set; }
|
public string DownloadId { get; set; }
|
||||||
public List<CustomFormatResource> CustomFormats { get; set; }
|
public List<CustomFormatResource> CustomFormats { get; set; }
|
||||||
|
public int CustomFormatScore { get; set; }
|
||||||
public IEnumerable<Rejection> Rejections { get; set; }
|
public IEnumerable<Rejection> Rejections { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +42,9 @@ namespace Sonarr.Api.V3.ManualImport
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var customFormats = model.CustomFormats;
|
||||||
|
var customFormatScore = model.Series?.QualityProfile.Value.CalculateCustomFormatScore(customFormats) ?? 0;
|
||||||
|
|
||||||
return new ManualImportResource
|
return new ManualImportResource
|
||||||
{
|
{
|
||||||
Id = HashConverter.GetHashInt31(model.Path),
|
Id = HashConverter.GetHashInt31(model.Path),
|
||||||
|
@ -56,7 +60,8 @@ namespace Sonarr.Api.V3.ManualImport
|
||||||
ReleaseGroup = model.ReleaseGroup,
|
ReleaseGroup = model.ReleaseGroup,
|
||||||
Quality = model.Quality,
|
Quality = model.Quality,
|
||||||
Languages = model.Languages,
|
Languages = model.Languages,
|
||||||
CustomFormats = model.CustomFormats.ToResource(false),
|
CustomFormats = customFormats.ToResource(false),
|
||||||
|
CustomFormatScore = customFormatScore,
|
||||||
|
|
||||||
// QualityWeight
|
// QualityWeight
|
||||||
DownloadId = model.DownloadId,
|
DownloadId = model.DownloadId,
|
||||||
|
|
Loading…
Reference in New Issue