1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-08-16 15:29:40 +02:00

Option to show audio/subtitle language on movie details (first two unique languages will be shown)

(cherry picked from commit c10677dfe7098295fde39517b3983e8f3f22823d)
This commit is contained in:
Mark McDowall 2022-02-27 01:16:51 -08:00 committed by Bogdan
parent 993e4ca298
commit 933d9e074c
7 changed files with 76 additions and 0 deletions

View File

@ -34,6 +34,13 @@
width: 100px; width: 100px;
} }
.audioLanguages,
.subtitles {
composes: cell from '~Components/Table/Cells/TableRowCell.css';
width: 165px;
}
.releaseGroup { .releaseGroup {
composes: cell from '~Components/Table/Cells/TableRowCell.css'; composes: cell from '~Components/Table/Cells/TableRowCell.css';

View File

@ -3,6 +3,7 @@
interface CssExports { interface CssExports {
'actions': string; 'actions': string;
'age': string; 'age': string;
'audioLanguages': string;
'customFormatScore': string; 'customFormatScore': string;
'download': string; 'download': string;
'formats': string; 'formats': string;
@ -12,6 +13,7 @@ interface CssExports {
'relativePath': string; 'relativePath': string;
'releaseGroup': string; 'releaseGroup': string;
'size': string; 'size': string;
'subtitles': string;
} }
export const cssExports: CssExports; export const cssExports: CssExports;
export default cssExports; export default cssExports;

View File

@ -117,6 +117,24 @@ class MovieFileEditorRow extends Component {
/> />
</TableRowCell> </TableRowCell>
<TableRowCell
className={styles.audioLanguages}
>
<MediaInfoConnector
type={mediaInfoTypes.AUDIO_LANGUAGES}
movieFileId={id}
/>
</TableRowCell>
<TableRowCell
className={styles.subtitles}
>
<MediaInfoConnector
type={mediaInfoTypes.SUBTITLES}
movieFileId={id}
/>
</TableRowCell>
<TableRowCell <TableRowCell
className={styles.size} className={styles.size}
title={size} title={size}

View File

@ -25,6 +25,16 @@ const columns = [
label: () => translate('AudioInfo'), label: () => translate('AudioInfo'),
isVisible: true isVisible: true
}, },
{
name: 'audioLanguages',
label: () => translate('AudioLanguages'),
isVisible: true
},
{
name: 'subtitleLanguages',
label: () => translate('SubtitleLanguages'),
isVisible: true
},
{ {
name: 'size', name: 'size',
label: () => translate('Size'), label: () => translate('Size'),

View File

@ -1,12 +1,37 @@
import _ from 'lodash';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import * as mediaInfoTypes from './mediaInfoTypes'; import * as mediaInfoTypes from './mediaInfoTypes';
function formatLanguages(languages) {
if (!languages) {
return null;
}
const splitLanguages = _.uniq(languages.split(' / '));
if (splitLanguages.length > 3) {
return (
<span title={splitLanguages.join(', ')}>
{splitLanguages.slice(0, 2).join(', ')}, {splitLanguages.length - 2} more
</span>
);
}
return (
<span>
{splitLanguages.join(', ')}
</span>
);
}
function MediaInfo(props) { function MediaInfo(props) {
const { const {
type, type,
audioChannels, audioChannels,
audioCodec, audioCodec,
audioLanguages,
subtitles,
videoCodec videoCodec
} = props; } = props;
@ -31,6 +56,14 @@ function MediaInfo(props) {
); );
} }
if (type === mediaInfoTypes.AUDIO_LANGUAGES) {
return formatLanguages(audioLanguages);
}
if (type === mediaInfoTypes.SUBTITLES) {
return formatLanguages(subtitles);
}
if (type === mediaInfoTypes.VIDEO) { if (type === mediaInfoTypes.VIDEO) {
return ( return (
<span> <span>
@ -46,6 +79,8 @@ MediaInfo.propTypes = {
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
audioChannels: PropTypes.number, audioChannels: PropTypes.number,
audioCodec: PropTypes.string, audioCodec: PropTypes.string,
audioLanguages: PropTypes.string,
subtitles: PropTypes.string,
videoCodec: PropTypes.string videoCodec: PropTypes.string
}; };

View File

@ -1,2 +1,4 @@
export const AUDIO = 'audio'; export const AUDIO = 'audio';
export const AUDIO_LANGUAGES = 'audioLanguages';
export const SUBTITLES = 'subtitles';
export const VIDEO = 'video'; export const VIDEO = 'video';

View File

@ -74,6 +74,7 @@
"AptUpdater": "Use apt to install the update", "AptUpdater": "Use apt to install the update",
"AsAllDayHelpText": "Events will appear as all-day events in your calendar", "AsAllDayHelpText": "Events will appear as all-day events in your calendar",
"AudioInfo": "Audio Info", "AudioInfo": "Audio Info",
"AudioLanguages": "Audio Languages",
"AuthBasic": "Basic (Browser Popup)", "AuthBasic": "Basic (Browser Popup)",
"AuthForm": "Forms (Login Page)", "AuthForm": "Forms (Login Page)",
"Authentication": "Authentication", "Authentication": "Authentication",
@ -1099,6 +1100,7 @@
"Studio": "Studio", "Studio": "Studio",
"Style": "Style", "Style": "Style",
"SubfolderWillBeCreatedAutomaticallyInterp": "'{0}' subfolder will be created automatically", "SubfolderWillBeCreatedAutomaticallyInterp": "'{0}' subfolder will be created automatically",
"SubtitleLanguages": "Subtitle Languages",
"SuggestTranslationChange": "Suggest translation change", "SuggestTranslationChange": "Suggest translation change",
"Sunday": "Sunday", "Sunday": "Sunday",
"System": "System", "System": "System",