Option to show audio/subtitle language on series details
New: Option to show audio/subtitle language on series details (first two unique languages will be shown) Closes #3189
This commit is contained in:
parent
56b3acddc9
commit
c10677dfe7
|
@ -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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -37,6 +37,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';
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,34 @@ class EpisodeRow extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name === 'audioLanguages') {
|
||||||
|
return (
|
||||||
|
<TableRowCell
|
||||||
|
key={name}
|
||||||
|
className={styles.audioLanguages}
|
||||||
|
>
|
||||||
|
<MediaInfoConnector
|
||||||
|
type={mediaInfoTypes.AUDIO_LANGUAGES}
|
||||||
|
episodeFileId={episodeFileId}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'subtitleLanguages') {
|
||||||
|
return (
|
||||||
|
<TableRowCell
|
||||||
|
key={name}
|
||||||
|
className={styles.subtitles}
|
||||||
|
>
|
||||||
|
<MediaInfoConnector
|
||||||
|
type={mediaInfoTypes.SUBTITLES}
|
||||||
|
episodeFileId={episodeFileId}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (name === 'videoCodec') {
|
if (name === 'videoCodec') {
|
||||||
return (
|
return (
|
||||||
<TableRowCell
|
<TableRowCell
|
||||||
|
|
|
@ -74,6 +74,16 @@ export const defaultState = {
|
||||||
label: 'Video Codec',
|
label: 'Video Codec',
|
||||||
isVisible: false
|
isVisible: false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'audioLanguages',
|
||||||
|
label: 'Audio Languages',
|
||||||
|
isVisible: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'subtitleLanguages',
|
||||||
|
label: 'Subtitle Languages',
|
||||||
|
isVisible: false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'size',
|
name: 'size',
|
||||||
label: 'Size',
|
label: 'Size',
|
||||||
|
|
Loading…
Reference in New Issue