1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-11-06 09:19:38 +02:00

Use episode runtime for size limits when available

Closes #3482
This commit is contained in:
Mark McDowall
2023-03-03 15:17:59 -08:00
parent a42f97229a
commit f22998aef3
13 changed files with 144 additions and 50 deletions

View File

@@ -22,6 +22,12 @@
width: 95px;
}
.runtime {
composes: cell from '~Components/Table/Cells/TableRowCell.css';
width: 80px;
}
.size {
composes: cell from '~Components/Table/Cells/TableRowCell.css';

View File

@@ -8,6 +8,7 @@ interface CssExports {
'languages': string;
'monitored': string;
'releaseGroup': string;
'runtime': string;
'size': string;
'status': string;
'subtitles': string;

View File

@@ -13,6 +13,7 @@ import EpisodeFileLanguageConnector from 'EpisodeFile/EpisodeFileLanguageConnect
import MediaInfoConnector from 'EpisodeFile/MediaInfoConnector';
import * as mediaInfoTypes from 'EpisodeFile/mediaInfoTypes';
import formatBytes from 'Utilities/Number/formatBytes';
import formatRuntime from 'Utilities/Number/formatRuntime';
import styles from './EpisodeRow.css';
class EpisodeRow extends Component {
@@ -59,6 +60,7 @@ class EpisodeRow extends Component {
sceneEpisodeNumber,
sceneAbsoluteEpisodeNumber,
airDateUtc,
runtime,
title,
useSceneNumbering,
unverifiedSceneNumbering,
@@ -170,6 +172,17 @@ class EpisodeRow extends Component {
);
}
if (name === 'runtime') {
return (
<TableRowCell
key={name}
className={styles.runtime}
>
{ formatRuntime(runtime) }
</TableRowCell>
);
}
if (name === 'customFormats') {
return (
<TableRowCell key={name}>
@@ -330,6 +343,7 @@ EpisodeRow.propTypes = {
sceneEpisodeNumber: PropTypes.number,
sceneAbsoluteEpisodeNumber: PropTypes.number,
airDateUtc: PropTypes.string,
runtime: PropTypes.number,
title: PropTypes.string.isRequired,
isSaving: PropTypes.bool,
useSceneNumbering: PropTypes.bool,

View File

@@ -59,6 +59,11 @@ export const defaultState = {
label: 'Air Date',
isVisible: true
},
{
name: 'runtime',
label: 'Runtime',
isVisible: false
},
{
name: 'languages',
label: 'Languages',

View File

@@ -0,0 +1,21 @@
function formatRuntime(runtime: number) {
if (!runtime) {
return '';
}
const hours = Math.floor(runtime / 60);
const minutes = runtime % 60;
const result = [];
if (hours) {
result.push(`${hours}h`);
}
if (minutes) {
result.push(`${minutes}m`);
}
return result.join(' ');
}
export default formatRuntime;