New: Show Custom Format Score for movies in Files tab

Closes #8818
pull/8968/head
Bogdan 1 year ago
parent efe5c3beb7
commit 431bc14e76

@ -9,3 +9,9 @@
word-break: break-word;
}
.customFormatScore {
composes: cell from '~Components/Table/Cells/TableRowCell.css';
width: 55px;
}

@ -2,6 +2,7 @@
// Please do not change this file!
interface CssExports {
'actions': string;
'customFormatScore': string;
'sourceTitle': string;
}
export const cssExports: CssExports;

@ -7,7 +7,8 @@ import ConfirmModal from 'Components/Modal/ConfirmModal';
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableRow from 'Components/Table/TableRow';
import { icons, kinds } from 'Helpers/Props';
import Tooltip from 'Components/Tooltip/Tooltip';
import { icons, kinds, tooltipPositions } from 'Helpers/Props';
import MovieFormats from 'Movie/MovieFormats';
import MovieLanguage from 'Movie/MovieLanguage';
import MovieQuality from 'Movie/MovieQuality';
@ -106,8 +107,15 @@ class MovieHistoryRow extends Component {
/>
</TableRowCell>
<TableRowCell>
{formatCustomFormatScore(customFormatScore)}
<TableRowCell className={styles.customFormatScore}>
<Tooltip
anchor={formatCustomFormatScore(
customFormatScore,
customFormats.length
)}
tooltip={<MovieFormats formats={customFormats} />}
position={tooltipPositions.TOP}
/>
</TableRowCell>
<RelativeDateCellConnector

@ -39,3 +39,9 @@
width: 120px;
}
.customFormatScore {
composes: cell from '~Components/Table/Cells/TableRowCell.css';
width: 55px;
}

@ -3,6 +3,7 @@
interface CssExports {
'actions': string;
'age': string;
'customFormatScore': string;
'download': string;
'formats': string;
'language': string;

@ -4,7 +4,8 @@ import IconButton from 'Components/Link/IconButton';
import ConfirmModal from 'Components/Modal/ConfirmModal';
import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableRow from 'Components/Table/TableRow';
import { icons, kinds } from 'Helpers/Props';
import Tooltip from 'Components/Tooltip/Tooltip';
import { icons, kinds, tooltipPositions } from 'Helpers/Props';
import MovieFormats from 'Movie/MovieFormats';
import MovieLanguage from 'Movie/MovieLanguage';
import MovieQuality from 'Movie/MovieQuality';
@ -12,6 +13,7 @@ import FileEditModal from 'MovieFile/Edit/FileEditModal';
import MediaInfoConnector from 'MovieFile/MediaInfoConnector';
import * as mediaInfoTypes from 'MovieFile/mediaInfoTypes';
import formatBytes from 'Utilities/Number/formatBytes';
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
import translate from 'Utilities/String/translate';
import FileDetailsModal from '../FileDetailsModal';
import MovieFileRowCellPlaceholder from './MovieFileRowCellPlaceholder';
@ -78,6 +80,7 @@ class MovieFileEditorRow extends Component {
quality,
qualityCutoffNotMet,
customFormats,
customFormatScore,
languages
} = this.props;
@ -170,6 +173,19 @@ class MovieFileEditorRow extends Component {
/>
</TableRowCell>
<TableRowCell
className={styles.customFormatScore}
>
<Tooltip
anchor={formatCustomFormatScore(
customFormatScore,
customFormats.length
)}
tooltip={<MovieFormats formats={customFormats} />}
position={tooltipPositions.TOP}
/>
</TableRowCell>
<TableRowCell className={styles.actions}>
<IconButton
title={translate('EditMovieFile')}
@ -225,6 +241,7 @@ MovieFileEditorRow.propTypes = {
quality: PropTypes.object.isRequired,
releaseGroup: PropTypes.string,
customFormats: PropTypes.arrayOf(PropTypes.object).isRequired,
customFormatScore: PropTypes.number.isRequired,
qualityCutoffNotMet: PropTypes.bool.isRequired,
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
mediaInfo: PropTypes.object,

@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import Icon from 'Components/Icon';
import IconButton from 'Components/Link/IconButton';
import Table from 'Components/Table/Table';
import TableBody from 'Components/Table/TableBody';
@ -45,10 +46,18 @@ const columns = [
isVisible: true
},
{
name: 'quality.customFormats',
name: 'customFormats',
label: () => translate('Formats'),
isVisible: true
},
{
name: 'customFormatScore',
label: React.createElement(Icon, {
name: icons.SCORE,
title: () => translate('CustomFormatScore')
}),
isVisible: true
},
{
name: 'action',
label: React.createElement(IconButton, { name: icons.ADVANCED_SETTINGS }),

@ -54,7 +54,12 @@ namespace Radarr.Api.V3.MovieFiles
movieFile.Movie = movie;
var resource = movieFile.ToResource(movie, _qualityUpgradableSpecification);
resource.CustomFormats = _formatCalculator.ParseCustomFormat(movieFile).ToResource(false);
var customFormats = _formatCalculator.ParseCustomFormat(movieFile);
var customFormatScore = movie?.Profile?.CalculateCustomFormatScore(customFormats) ?? 0;
resource.CustomFormats = customFormats.ToResource(false);
resource.CustomFormatScore = customFormatScore;
return resource;
}
@ -78,7 +83,11 @@ namespace Radarr.Api.V3.MovieFiles
var resource = file.ToResource(movie, _qualityUpgradableSpecification);
file.Movie = movie;
resource.CustomFormats = _formatCalculator.ParseCustomFormat(file).ToResource(false);
var customFormats = _formatCalculator.ParseCustomFormat(file);
var customFormatScore = movie?.Profile?.CalculateCustomFormatScore(customFormats) ?? 0;
resource.CustomFormats = customFormats.ToResource(false);
resource.CustomFormatScore = customFormatScore;
return new List<MovieFileResource> { resource };
}

@ -21,6 +21,7 @@ namespace Radarr.Api.V3.MovieFiles
public int IndexerFlags { get; set; }
public QualityModel Quality { get; set; }
public List<CustomFormatResource> CustomFormats { get; set; }
public int CustomFormatScore { get; set; }
public MediaInfoResource MediaInfo { get; set; }
public string OriginalFilePath { get; set; }
public bool QualityCutoffNotMet { get; set; }

Loading…
Cancel
Save