New: Expose subtitle title and disposition in UI

pull/9399/merge
Jendrik Weise 4 months ago committed by Bogdan
parent ac4669dfc1
commit b062a46cbd

@ -0,0 +1 @@
export type ExtraFileType = 'subtitle' | 'metadata' | 'other';

@ -0,0 +1,56 @@
import React from 'react';
import IconButton from 'Components/Link/IconButton';
import Popover from 'Components/Tooltip/Popover';
import { icons, tooltipPositions } from 'Helpers/Props';
import { ExtraFileType } from 'MovieFile/ExtraFile';
import translate from 'Utilities/String/translate';
interface ExtraFileDetailsPopoverProps {
type: ExtraFileType;
title?: string;
languageTags?: string[];
}
function ExtraFileDetailsPopover(props: ExtraFileDetailsPopoverProps) {
const { type, title, languageTags = [] } = props;
const details = [];
if (type === 'subtitle') {
if (title) {
details.push({ name: translate('Title'), value: title });
}
if (languageTags.length) {
details.push({
name: translate('Disposition'),
value: languageTags.join(', '),
});
}
}
if (details.length) {
return (
<Popover
anchor={<IconButton name={icons.INFO} />}
title={translate('Tags')}
body={
<ul>
{details.map(({ name, value }, index) => {
return (
<li key={index}>
{name}: {value}
</li>
);
})}
</ul>
}
position={tooltipPositions.LEFT}
/>
);
}
return '';
}
export default ExtraFileDetailsPopover;

@ -1,10 +1,9 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import IconButton from 'Components/Link/IconButton';
import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableRow from 'Components/Table/TableRow';
import { icons } from 'Helpers/Props';
import titleCase from 'Utilities/String/titleCase';
import ExtraFileDetailsPopover from './ExtraFileDetailsPopover';
import styles from './ExtraFileRow.css';
class ExtraFileRow extends Component {
@ -16,7 +15,9 @@ class ExtraFileRow extends Component {
const {
relativePath,
extension,
type
type,
title,
languageTags
} = this.props;
return (
@ -43,8 +44,10 @@ class ExtraFileRow extends Component {
</TableRowCell>
<TableRowCell className={styles.actions}>
<IconButton
name={icons.INFO}
<ExtraFileDetailsPopover
type={type}
title={title}
languageTags={languageTags}
/>
</TableRowCell>
</TableRow>
@ -57,7 +60,9 @@ ExtraFileRow.propTypes = {
id: PropTypes.number.isRequired,
extension: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
relativePath: PropTypes.string.isRequired
relativePath: PropTypes.string.isRequired,
title: PropTypes.string,
languageTags: PropTypes.arrayOf(PropTypes.string)
};
export default ExtraFileRow;

@ -376,6 +376,7 @@
"DiscordUrlInSlackNotification": "You have a Discord notification setup as a Slack notification. Set this up as a Discord notification for better functionality. The effected notifications are: {0}",
"Discover": "Discover",
"DiskSpace": "Disk Space",
"Disposition": "Disposition",
"DoNotBlocklist": "Do not Blocklist",
"DoNotBlocklistHint": "Remove without blocklisting",
"DoNotPrefer": "Do Not Prefer",

@ -14,6 +14,8 @@ namespace Radarr.Api.V3.ExtraFiles
public int? MovieFileId { get; set; }
public string RelativePath { get; set; }
public string Extension { get; set; }
public List<string> LanguageTags { get; set; }
public string Title { get; set; }
public ExtraFileType Type { get; set; }
}
@ -51,6 +53,8 @@ namespace Radarr.Api.V3.ExtraFiles
MovieFileId = model.MovieFileId,
RelativePath = model.RelativePath,
Extension = model.Extension,
LanguageTags = model.LanguageTags,
Title = model.Title,
Type = ExtraFileType.Subtitle
};
}

Loading…
Cancel
Save