Merge branch 'develop' into skip-redownload
This commit is contained in:
commit
a968d0baf1
|
@ -268,7 +268,7 @@ dotnet_diagnostic.CA5397.severity = suggestion
|
||||||
|
|
||||||
dotnet_diagnostic.SYSLIB0006.severity = none
|
dotnet_diagnostic.SYSLIB0006.severity = none
|
||||||
|
|
||||||
[*.{js,html,js,hbs,less,css}]
|
[*.{js,html,hbs,less,css,ts,tsx}]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
|
@ -36,7 +36,7 @@ module.exports = (env) => {
|
||||||
},
|
},
|
||||||
|
|
||||||
entry: {
|
entry: {
|
||||||
index: 'index.js'
|
index: 'index.ts'
|
||||||
},
|
},
|
||||||
|
|
||||||
resolve: {
|
resolve: {
|
||||||
|
@ -67,23 +67,23 @@ module.exports = (env) => {
|
||||||
output: {
|
output: {
|
||||||
path: distFolder,
|
path: distFolder,
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
filename: '[name].js',
|
filename: '[name]-[contenthash].js',
|
||||||
sourceMapFilename: '[file].map'
|
sourceMapFilename: '[file].map'
|
||||||
},
|
},
|
||||||
|
|
||||||
optimization: {
|
optimization: {
|
||||||
moduleIds: 'deterministic',
|
moduleIds: 'deterministic',
|
||||||
chunkIds: 'named',
|
chunkIds: isProduction ? 'deterministic' : 'named'
|
||||||
splitChunks: {
|
|
||||||
chunks: 'initial',
|
|
||||||
name: 'vendors'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
performance: {
|
performance: {
|
||||||
hints: false
|
hints: false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
experiments: {
|
||||||
|
topLevelAwait: true
|
||||||
|
},
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
__DEV__: !isProduction,
|
__DEV__: !isProduction,
|
||||||
|
@ -97,7 +97,8 @@ module.exports = (env) => {
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: 'frontend/src/index.ejs',
|
template: 'frontend/src/index.ejs',
|
||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
publicPath: '/'
|
publicPath: '/',
|
||||||
|
inject: false
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new FileManagerPlugin({
|
new FileManagerPlugin({
|
||||||
|
|
|
@ -4,13 +4,14 @@ import IconButton from 'Components/Link/IconButton';
|
||||||
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
||||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
import TableRow from 'Components/Table/TableRow';
|
import TableRow from 'Components/Table/TableRow';
|
||||||
|
import Tooltip from 'Components/Tooltip/Tooltip';
|
||||||
import episodeEntities from 'Episode/episodeEntities';
|
import episodeEntities from 'Episode/episodeEntities';
|
||||||
import EpisodeFormats from 'Episode/EpisodeFormats';
|
import EpisodeFormats from 'Episode/EpisodeFormats';
|
||||||
import EpisodeLanguages from 'Episode/EpisodeLanguages';
|
import EpisodeLanguages from 'Episode/EpisodeLanguages';
|
||||||
import EpisodeQuality from 'Episode/EpisodeQuality';
|
import EpisodeQuality from 'Episode/EpisodeQuality';
|
||||||
import EpisodeTitleLink from 'Episode/EpisodeTitleLink';
|
import EpisodeTitleLink from 'Episode/EpisodeTitleLink';
|
||||||
import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
|
import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
|
||||||
import { icons } from 'Helpers/Props';
|
import { icons, tooltipPositions } from 'Helpers/Props';
|
||||||
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
||||||
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
|
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
|
||||||
import HistoryDetailsModal from './Details/HistoryDetailsModal';
|
import HistoryDetailsModal from './Details/HistoryDetailsModal';
|
||||||
|
@ -210,7 +211,14 @@ class HistoryRow extends Component {
|
||||||
key={name}
|
key={name}
|
||||||
className={styles.customFormatScore}
|
className={styles.customFormatScore}
|
||||||
>
|
>
|
||||||
{formatPreferredWordScore(customFormatScore)}
|
<Tooltip
|
||||||
|
anchor={formatPreferredWordScore(
|
||||||
|
customFormatScore,
|
||||||
|
customFormats.length
|
||||||
|
)}
|
||||||
|
tooltip={<EpisodeFormats formats={customFormats} />}
|
||||||
|
position={tooltipPositions.BOTTOM}
|
||||||
|
/>
|
||||||
</TableRowCell>
|
</TableRowCell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -294,4 +302,8 @@ HistoryRow.propTypes = {
|
||||||
onMarkAsFailedPress: PropTypes.func.isRequired
|
onMarkAsFailedPress: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HistoryRow.defaultProps = {
|
||||||
|
customFormats: []
|
||||||
|
};
|
||||||
|
|
||||||
export default HistoryRow;
|
export default HistoryRow;
|
||||||
|
|
|
@ -8,12 +8,13 @@ import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellCo
|
||||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
||||||
import TableRow from 'Components/Table/TableRow';
|
import TableRow from 'Components/Table/TableRow';
|
||||||
|
import Tooltip from 'Components/Tooltip/Tooltip';
|
||||||
import EpisodeFormats from 'Episode/EpisodeFormats';
|
import EpisodeFormats from 'Episode/EpisodeFormats';
|
||||||
import EpisodeLanguages from 'Episode/EpisodeLanguages';
|
import EpisodeLanguages from 'Episode/EpisodeLanguages';
|
||||||
import EpisodeQuality from 'Episode/EpisodeQuality';
|
import EpisodeQuality from 'Episode/EpisodeQuality';
|
||||||
import EpisodeTitleLink from 'Episode/EpisodeTitleLink';
|
import EpisodeTitleLink from 'Episode/EpisodeTitleLink';
|
||||||
import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
|
import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
|
||||||
import { icons, kinds } from 'Helpers/Props';
|
import { icons, kinds, tooltipPositions } from 'Helpers/Props';
|
||||||
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
|
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
|
||||||
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
||||||
import formatBytes from 'Utilities/Number/formatBytes';
|
import formatBytes from 'Utilities/Number/formatBytes';
|
||||||
|
@ -267,7 +268,14 @@ class QueueRow extends Component {
|
||||||
key={name}
|
key={name}
|
||||||
className={styles.customFormatScore}
|
className={styles.customFormatScore}
|
||||||
>
|
>
|
||||||
{formatPreferredWordScore(customFormatScore)}
|
<Tooltip
|
||||||
|
anchor={formatPreferredWordScore(
|
||||||
|
customFormatScore,
|
||||||
|
customFormats.length
|
||||||
|
)}
|
||||||
|
tooltip={<EpisodeFormats formats={customFormats} />}
|
||||||
|
position={tooltipPositions.BOTTOM}
|
||||||
|
/>
|
||||||
</TableRowCell>
|
</TableRowCell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -450,6 +458,7 @@ QueueRow.propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
QueueRow.defaultProps = {
|
QueueRow.defaultProps = {
|
||||||
|
customFormats: [],
|
||||||
isGrabbing: false,
|
isGrabbing: false,
|
||||||
isRemoving: false
|
isRemoving: false
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,13 +7,13 @@ import PageConnector from 'Components/Page/PageConnector';
|
||||||
import ApplyTheme from './ApplyTheme';
|
import ApplyTheme from './ApplyTheme';
|
||||||
import AppRoutes from './AppRoutes';
|
import AppRoutes from './AppRoutes';
|
||||||
|
|
||||||
function App({ store, history }) {
|
function App({ store, history, hasTranslationsError }) {
|
||||||
return (
|
return (
|
||||||
<DocumentTitle title={window.Sonarr.instanceName}>
|
<DocumentTitle title={window.Sonarr.instanceName}>
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<ConnectedRouter history={history}>
|
<ConnectedRouter history={history}>
|
||||||
<ApplyTheme>
|
<ApplyTheme>
|
||||||
<PageConnector>
|
<PageConnector hasTranslationsError={hasTranslationsError}>
|
||||||
<AppRoutes app={App} />
|
<AppRoutes app={App} />
|
||||||
</PageConnector>
|
</PageConnector>
|
||||||
</ApplyTheme>
|
</ApplyTheme>
|
||||||
|
@ -25,7 +25,8 @@ function App({ store, history }) {
|
||||||
|
|
||||||
App.propTypes = {
|
App.propTypes = {
|
||||||
store: PropTypes.object.isRequired,
|
store: PropTypes.object.isRequired,
|
||||||
history: PropTypes.object.isRequired
|
history: PropTypes.object.isRequired,
|
||||||
|
hasTranslationsError: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
|
|
@ -69,7 +69,7 @@ class QualityProfileSelectInputConnector extends Component {
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
onChange = ({ name, value }) => {
|
onChange = ({ name, value }) => {
|
||||||
this.props.onChange({ name, value: parseInt(value) });
|
this.props.onChange({ name, value: value === 'noChange' ? value : parseInt(value) });
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -7,6 +7,7 @@ function ErrorPage(props) {
|
||||||
const {
|
const {
|
||||||
version,
|
version,
|
||||||
isLocalStorageSupported,
|
isLocalStorageSupported,
|
||||||
|
hasTranslationsError,
|
||||||
seriesError,
|
seriesError,
|
||||||
customFiltersError,
|
customFiltersError,
|
||||||
tagsError,
|
tagsError,
|
||||||
|
@ -19,6 +20,8 @@ function ErrorPage(props) {
|
||||||
|
|
||||||
if (!isLocalStorageSupported) {
|
if (!isLocalStorageSupported) {
|
||||||
errorMessage = 'Local Storage is not supported or disabled. A plugin or private browsing may have disabled it.';
|
errorMessage = 'Local Storage is not supported or disabled. A plugin or private browsing may have disabled it.';
|
||||||
|
} else if (hasTranslationsError) {
|
||||||
|
errorMessage = 'Failed to load translations from API';
|
||||||
} else if (seriesError) {
|
} else if (seriesError) {
|
||||||
errorMessage = getErrorMessage(seriesError, 'Failed to load series from API');
|
errorMessage = getErrorMessage(seriesError, 'Failed to load series from API');
|
||||||
} else if (customFiltersError) {
|
} else if (customFiltersError) {
|
||||||
|
@ -49,6 +52,7 @@ function ErrorPage(props) {
|
||||||
ErrorPage.propTypes = {
|
ErrorPage.propTypes = {
|
||||||
version: PropTypes.string.isRequired,
|
version: PropTypes.string.isRequired,
|
||||||
isLocalStorageSupported: PropTypes.bool.isRequired,
|
isLocalStorageSupported: PropTypes.bool.isRequired,
|
||||||
|
hasTranslationsError: PropTypes.bool.isRequired,
|
||||||
seriesError: PropTypes.object,
|
seriesError: PropTypes.object,
|
||||||
customFiltersError: PropTypes.object,
|
customFiltersError: PropTypes.object,
|
||||||
tagsError: PropTypes.object,
|
tagsError: PropTypes.object,
|
||||||
|
|
|
@ -220,6 +220,7 @@ class PageConnector extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
|
hasTranslationsError,
|
||||||
isPopulated,
|
isPopulated,
|
||||||
hasError,
|
hasError,
|
||||||
dispatchFetchSeries,
|
dispatchFetchSeries,
|
||||||
|
@ -232,11 +233,12 @@ class PageConnector extends Component {
|
||||||
...otherProps
|
...otherProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (hasError || !this.state.isLocalStorageSupported) {
|
if (hasTranslationsError || hasError || !this.state.isLocalStorageSupported) {
|
||||||
return (
|
return (
|
||||||
<ErrorPage
|
<ErrorPage
|
||||||
{...this.state}
|
{...this.state}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
|
hasTranslationsError={hasTranslationsError}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -257,6 +259,7 @@ class PageConnector extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
PageConnector.propTypes = {
|
PageConnector.propTypes = {
|
||||||
|
hasTranslationsError: PropTypes.bool.isRequired,
|
||||||
isPopulated: PropTypes.bool.isRequired,
|
isPopulated: PropTypes.bool.isRequired,
|
||||||
hasError: PropTypes.bool.isRequired,
|
hasError: PropTypes.bool.isRequired,
|
||||||
isSidebarVisible: PropTypes.bool.isRequired,
|
isSidebarVisible: PropTypes.bool.isRequired,
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { icons } from 'Helpers/Props';
|
||||||
import locationShape from 'Helpers/Props/Shapes/locationShape';
|
import locationShape from 'Helpers/Props/Shapes/locationShape';
|
||||||
import dimensions from 'Styles/Variables/dimensions';
|
import dimensions from 'Styles/Variables/dimensions';
|
||||||
import HealthStatusConnector from 'System/Status/Health/HealthStatusConnector';
|
import HealthStatusConnector from 'System/Status/Health/HealthStatusConnector';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
import MessagesConnector from './Messages/MessagesConnector';
|
import MessagesConnector from './Messages/MessagesConnector';
|
||||||
import PageSidebarItem from './PageSidebarItem';
|
import PageSidebarItem from './PageSidebarItem';
|
||||||
import styles from './PageSidebar.css';
|
import styles from './PageSidebar.css';
|
||||||
|
@ -20,16 +21,16 @@ const SIDEBAR_WIDTH = parseInt(dimensions.sidebarWidth);
|
||||||
const links = [
|
const links = [
|
||||||
{
|
{
|
||||||
iconName: icons.SERIES_CONTINUING,
|
iconName: icons.SERIES_CONTINUING,
|
||||||
title: 'Series',
|
title: translate('Series'),
|
||||||
to: '/',
|
to: '/',
|
||||||
alias: '/series',
|
alias: '/series',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'Add New',
|
title: translate('AddNew'),
|
||||||
to: '/add/new'
|
to: '/add/new'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Library Import',
|
title: translate('LibraryImport'),
|
||||||
to: '/add/import'
|
to: '/add/import'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -37,26 +38,26 @@ const links = [
|
||||||
|
|
||||||
{
|
{
|
||||||
iconName: icons.CALENDAR,
|
iconName: icons.CALENDAR,
|
||||||
title: 'Calendar',
|
title: translate('Calendar'),
|
||||||
to: '/calendar'
|
to: '/calendar'
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
iconName: icons.ACTIVITY,
|
iconName: icons.ACTIVITY,
|
||||||
title: 'Activity',
|
title: translate('Activity'),
|
||||||
to: '/activity/queue',
|
to: '/activity/queue',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'Queue',
|
title: translate('Queue'),
|
||||||
to: '/activity/queue',
|
to: '/activity/queue',
|
||||||
statusComponent: QueueStatusConnector
|
statusComponent: QueueStatusConnector
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'History',
|
title: translate('History'),
|
||||||
to: '/activity/history'
|
to: '/activity/history'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Blocklist',
|
title: translate('Blocklist'),
|
||||||
to: '/activity/blocklist'
|
to: '/activity/blocklist'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -64,15 +65,15 @@ const links = [
|
||||||
|
|
||||||
{
|
{
|
||||||
iconName: icons.WARNING,
|
iconName: icons.WARNING,
|
||||||
title: 'Wanted',
|
title: translate('Wanted'),
|
||||||
to: '/wanted/missing',
|
to: '/wanted/missing',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'Missing',
|
title: translate('Missing'),
|
||||||
to: '/wanted/missing'
|
to: '/wanted/missing'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Cutoff Unmet',
|
title: translate('CutoffUnmet'),
|
||||||
to: '/wanted/cutoffunmet'
|
to: '/wanted/cutoffunmet'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -80,59 +81,59 @@ const links = [
|
||||||
|
|
||||||
{
|
{
|
||||||
iconName: icons.SETTINGS,
|
iconName: icons.SETTINGS,
|
||||||
title: 'Settings',
|
title: translate('Settings'),
|
||||||
to: '/settings',
|
to: '/settings',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'Media Management',
|
title: translate('MediaManagement'),
|
||||||
to: '/settings/mediamanagement'
|
to: '/settings/mediamanagement'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Profiles',
|
title: translate('Profiles'),
|
||||||
to: '/settings/profiles'
|
to: '/settings/profiles'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Quality',
|
title: translate('Quality'),
|
||||||
to: '/settings/quality'
|
to: '/settings/quality'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Custom Formats',
|
title: translate('CustomFormats'),
|
||||||
to: '/settings/customformats'
|
to: '/settings/customformats'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Indexers',
|
title: translate('Indexers'),
|
||||||
to: '/settings/indexers'
|
to: '/settings/indexers'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Download Clients',
|
title: translate('DownloadClients'),
|
||||||
to: '/settings/downloadclients'
|
to: '/settings/downloadclients'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Import Lists',
|
title: translate('ImportLists'),
|
||||||
to: '/settings/importlists'
|
to: '/settings/importlists'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Connect',
|
title: translate('Connect'),
|
||||||
to: '/settings/connect'
|
to: '/settings/connect'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Metadata',
|
title: translate('Metadata'),
|
||||||
to: '/settings/metadata'
|
to: '/settings/metadata'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Metadata Source',
|
title: translate('MetadataSource'),
|
||||||
to: '/settings/metadatasource'
|
to: '/settings/metadatasource'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Tags',
|
title: translate('Tags'),
|
||||||
to: '/settings/tags'
|
to: '/settings/tags'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'General',
|
title: translate('General'),
|
||||||
to: '/settings/general'
|
to: '/settings/general'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'UI',
|
title: translate('UI'),
|
||||||
to: '/settings/ui'
|
to: '/settings/ui'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -140,32 +141,32 @@ const links = [
|
||||||
|
|
||||||
{
|
{
|
||||||
iconName: icons.SYSTEM,
|
iconName: icons.SYSTEM,
|
||||||
title: 'System',
|
title: translate('System'),
|
||||||
to: '/system/status',
|
to: '/system/status',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'Status',
|
title: translate('Status'),
|
||||||
to: '/system/status',
|
to: '/system/status',
|
||||||
statusComponent: HealthStatusConnector
|
statusComponent: HealthStatusConnector
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Tasks',
|
title: translate('Tasks'),
|
||||||
to: '/system/tasks'
|
to: '/system/tasks'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Backup',
|
title: translate('Backup'),
|
||||||
to: '/system/backup'
|
to: '/system/backup'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Updates',
|
title: translate('Updates'),
|
||||||
to: '/system/updates'
|
to: '/system/updates'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Events',
|
title: translate('Events'),
|
||||||
to: '/system/events'
|
to: '/system/events'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Log Files',
|
title: translate('LogFiles'),
|
||||||
to: '/system/logs/files'
|
to: '/system/logs/files'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -30,6 +30,8 @@ import {
|
||||||
import { SelectStateInputProps } from 'typings/props';
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
import Rejection from 'typings/Rejection';
|
import Rejection from 'typings/Rejection';
|
||||||
import formatBytes from 'Utilities/Number/formatBytes';
|
import formatBytes from 'Utilities/Number/formatBytes';
|
||||||
|
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
import InteractiveImportRowCellPlaceholder from './InteractiveImportRowCellPlaceholder';
|
import InteractiveImportRowCellPlaceholder from './InteractiveImportRowCellPlaceholder';
|
||||||
import styles from './InteractiveImportRow.css';
|
import styles from './InteractiveImportRow.css';
|
||||||
|
|
||||||
|
@ -57,6 +59,7 @@ interface InteractiveImportRowProps {
|
||||||
languages?: Language[];
|
languages?: Language[];
|
||||||
size: number;
|
size: number;
|
||||||
customFormats?: object[];
|
customFormats?: object[];
|
||||||
|
customFormatScore?: number;
|
||||||
rejections: Rejection[];
|
rejections: Rejection[];
|
||||||
columns: Column[];
|
columns: Column[];
|
||||||
episodeFileId?: number;
|
episodeFileId?: number;
|
||||||
|
@ -80,6 +83,7 @@ function InteractiveImportRow(props: InteractiveImportRowProps) {
|
||||||
releaseGroup,
|
releaseGroup,
|
||||||
size,
|
size,
|
||||||
customFormats,
|
customFormats,
|
||||||
|
customFormatScore,
|
||||||
rejections,
|
rejections,
|
||||||
isReprocessing,
|
isReprocessing,
|
||||||
isSelected,
|
isSelected,
|
||||||
|
@ -427,8 +431,8 @@ function InteractiveImportRow(props: InteractiveImportRowProps) {
|
||||||
<TableRowCell>
|
<TableRowCell>
|
||||||
{customFormats?.length ? (
|
{customFormats?.length ? (
|
||||||
<Popover
|
<Popover
|
||||||
anchor={<Icon name={icons.INTERACTIVE} />}
|
anchor={formatPreferredWordScore(customFormatScore)}
|
||||||
title="Formats"
|
title={translate('CustomFormats')}
|
||||||
body={
|
body={
|
||||||
<div className={styles.customFormatTooltip}>
|
<div className={styles.customFormatTooltip}>
|
||||||
<EpisodeFormats formats={customFormats} />
|
<EpisodeFormats formats={customFormats} />
|
||||||
|
|
|
@ -11,6 +11,7 @@ import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
import { icons } from 'Helpers/Props';
|
import { icons } from 'Helpers/Props';
|
||||||
import { clear, fetch } from 'Store/Actions/parseActions';
|
import { clear, fetch } from 'Store/Actions/parseActions';
|
||||||
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
import ParseResult from './ParseResult';
|
import ParseResult from './ParseResult';
|
||||||
import parseStateSelector from './parseStateSelector';
|
import parseStateSelector from './parseStateSelector';
|
||||||
import styles from './ParseModalContent.css';
|
import styles from './ParseModalContent.css';
|
||||||
|
@ -58,7 +59,7 @@ function ParseModalContent(props: ParseModalContentProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalContent onModalClose={onModalClose}>
|
<ModalContent onModalClose={onModalClose}>
|
||||||
<ModalHeader>Test Parsing</ModalHeader>
|
<ModalHeader>{translate('TestParsing')}</ModalHeader>
|
||||||
|
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<div className={styles.inputContainer}>
|
<div className={styles.inputContainer}>
|
||||||
|
@ -115,7 +116,7 @@ function ParseModalContent(props: ParseModalContentProps) {
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<Button onPress={onModalClose}>Close</Button>
|
<Button onPress={onModalClose}>{translate('Close')}</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,20 +1,8 @@
|
||||||
.item {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.column {
|
||||||
margin-right: 20px;
|
flex: 0 0 50%;
|
||||||
width: 250px;
|
|
||||||
text-align: right;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
|
||||||
/* composes: description from '~Components/DescriptionList/DescriptionListItemTitle.css'; */
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: $breakpointSmall) {
|
|
||||||
.item {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
// This file is automatically generated.
|
// This file is automatically generated.
|
||||||
// Please do not change this file!
|
// Please do not change this file!
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
'description': string;
|
'column': string;
|
||||||
'item': string;
|
'container': string;
|
||||||
'title': string;
|
|
||||||
}
|
}
|
||||||
export const cssExports: CssExports;
|
export const cssExports: CssExports;
|
||||||
export default cssExports;
|
export default cssExports;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import EpisodeFormats from 'Episode/EpisodeFormats';
|
||||||
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import ParseResultItem from './ParseResultItem';
|
import ParseResultItem from './ParseResultItem';
|
||||||
|
import styles from './ParseResult.css';
|
||||||
|
|
||||||
interface ParseResultProps {
|
interface ParseResultProps {
|
||||||
item: ParseModel;
|
item: ParseModel;
|
||||||
|
@ -45,11 +46,11 @@ function ParseResult(props: ParseResultProps) {
|
||||||
<div>
|
<div>
|
||||||
<FieldSet legend={translate('Release')}>
|
<FieldSet legend={translate('Release')}>
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Release Title')}
|
title={translate('ReleaseTitle')}
|
||||||
data={releaseTitle}
|
data={releaseTitle}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem title={translate('Series Title')} data={seriesTitle} />
|
<ParseResultItem title={translate('SeriesTitle')} data={seriesTitle} />
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Year')}
|
title={translate('Year')}
|
||||||
|
@ -57,7 +58,7 @@ function ParseResult(props: ParseResultProps) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('All Titles')}
|
title={translate('AllTitles')}
|
||||||
data={
|
data={
|
||||||
seriesTitleInfo.allTitles?.length > 0
|
seriesTitleInfo.allTitles?.length > 0
|
||||||
? seriesTitleInfo.allTitles.join(', ')
|
? seriesTitleInfo.allTitles.join(', ')
|
||||||
|
@ -66,27 +67,21 @@ function ParseResult(props: ParseResultProps) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Release Group')}
|
title={translate('ReleaseGroup')}
|
||||||
data={releaseGroup ?? '-'}
|
data={releaseGroup ?? '-'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Release Hash')}
|
title={translate('ReleaseHash')}
|
||||||
data={releaseHash ? releaseHash : '-'}
|
data={releaseHash ? releaseHash : '-'}
|
||||||
/>
|
/>
|
||||||
</FieldSet>
|
</FieldSet>
|
||||||
|
|
||||||
{/*
|
<FieldSet legend={translate('EpisodeInfo')}>
|
||||||
|
<div className={styles.container}>
|
||||||
Year
|
<div className={styles.column}>
|
||||||
Secondary titles
|
|
||||||
special episode
|
|
||||||
|
|
||||||
*/}
|
|
||||||
|
|
||||||
<FieldSet legend={translate('Episode Info')}>
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Season Number')}
|
title={translate('SeasonNumber')}
|
||||||
data={
|
data={
|
||||||
seasonNumber === 0 && absoluteEpisodeNumbers.length
|
seasonNumber === 0 && absoluteEpisodeNumbers.length
|
||||||
? '-'
|
? '-'
|
||||||
|
@ -95,12 +90,12 @@ function ParseResult(props: ParseResultProps) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Episode Number(s)')}
|
title={translate('EpisodeNumbers')}
|
||||||
data={episodeNumbers.join(', ') || '-'}
|
data={episodeNumbers.join(', ') || '-'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Absolute Episode Number(s)')}
|
title={translate('AbsoluteEpisodeNumbers')}
|
||||||
data={
|
data={
|
||||||
absoluteEpisodeNumbers.length
|
absoluteEpisodeNumbers.length
|
||||||
? absoluteEpisodeNumbers.join(', ')
|
? absoluteEpisodeNumbers.join(', ')
|
||||||
|
@ -108,50 +103,48 @@ function ParseResult(props: ParseResultProps) {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ParseResultItem
|
||||||
|
title={translate('Daily')}
|
||||||
|
data={isDaily ? 'True' : 'False'}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ParseResultItem
|
||||||
|
title={translate('AirDate')}
|
||||||
|
data={airDate ?? '-'}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.column}>
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Special')}
|
title={translate('Special')}
|
||||||
data={special ? 'True' : 'False'}
|
data={special ? 'True' : 'False'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Full Season')}
|
title={translate('FullSeason')}
|
||||||
data={fullSeason ? 'True' : 'False'}
|
data={fullSeason ? 'True' : 'False'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Multi-Season')}
|
title={translate('MultiSeason')}
|
||||||
data={isMultiSeason ? 'True' : 'False'}
|
data={isMultiSeason ? 'True' : 'False'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Partial Season')}
|
title={translate('PartialSeason')}
|
||||||
data={isPartialSeason ? 'True' : 'False'}
|
data={isPartialSeason ? 'True' : 'False'}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<ParseResultItem
|
</div>
|
||||||
title={translate('Daily')}
|
|
||||||
data={isDaily ? 'True' : 'False'}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ParseResultItem title={translate('Air Date')} data={airDate ?? '-'} />
|
|
||||||
</FieldSet>
|
</FieldSet>
|
||||||
|
|
||||||
<FieldSet legend={translate('Quality')}>
|
<FieldSet legend={translate('Quality')}>
|
||||||
|
<div className={styles.container}>
|
||||||
|
<div className={styles.column}>
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Quality')}
|
title={translate('Quality')}
|
||||||
data={quality.quality.name}
|
data={quality.quality.name}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
|
||||||
title={translate('Version')}
|
|
||||||
data={quality.revision.version > 1 ? quality.revision.version : '-'}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ParseResultItem
|
|
||||||
title={translate('Real')}
|
|
||||||
data={quality.revision.real ? 'True' : '-'}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Proper')}
|
title={translate('Proper')}
|
||||||
data={
|
data={
|
||||||
|
@ -165,6 +158,22 @@ function ParseResult(props: ParseResultProps) {
|
||||||
title={translate('Repack')}
|
title={translate('Repack')}
|
||||||
data={quality.revision.isRepack ? 'True' : '-'}
|
data={quality.revision.isRepack ? 'True' : '-'}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.column}>
|
||||||
|
<ParseResultItem
|
||||||
|
title={translate('Version')}
|
||||||
|
data={
|
||||||
|
quality.revision.version > 1 ? quality.revision.version : '-'
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ParseResultItem
|
||||||
|
title={translate('Real')}
|
||||||
|
data={quality.revision.real ? 'True' : '-'}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</FieldSet>
|
</FieldSet>
|
||||||
|
|
||||||
<FieldSet legend={translate('Languages')}>
|
<FieldSet legend={translate('Languages')}>
|
||||||
|
@ -176,7 +185,7 @@ function ParseResult(props: ParseResultProps) {
|
||||||
|
|
||||||
<FieldSet legend={translate('Details')}>
|
<FieldSet legend={translate('Details')}>
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Matched to Series')}
|
title={translate('MatchedToSeries')}
|
||||||
data={
|
data={
|
||||||
series ? (
|
series ? (
|
||||||
<SeriesTitleLink
|
<SeriesTitleLink
|
||||||
|
@ -190,12 +199,12 @@ function ParseResult(props: ParseResultProps) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Matched to Season')}
|
title={translate('MatchedToSeason')}
|
||||||
data={episodes.length ? episodes[0].seasonNumber : '-'}
|
data={episodes.length ? episodes[0].seasonNumber : '-'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Matched to Episodes')}
|
title={translate('MatchedToEpisodes')}
|
||||||
data={
|
data={
|
||||||
episodes.length ? (
|
episodes.length ? (
|
||||||
<div>
|
<div>
|
||||||
|
@ -218,12 +227,12 @@ function ParseResult(props: ParseResultProps) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Custom Formats')}
|
title={translate('CustomFormats')}
|
||||||
data={<EpisodeFormats formats={customFormats} />}
|
data={<EpisodeFormats formats={customFormats} />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParseResultItem
|
<ParseResultItem
|
||||||
title={translate('Custom Format Score')}
|
title={translate('CustomFormatScore')}
|
||||||
data={customFormatScore}
|
data={customFormatScore}
|
||||||
/>
|
/>
|
||||||
</FieldSet>
|
</FieldSet>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React, { Fragment, useCallback, useState } from 'react';
|
||||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||||
import { icons } from 'Helpers/Props';
|
import { icons } from 'Helpers/Props';
|
||||||
import ParseModal from 'Parse/ParseModal';
|
import ParseModal from 'Parse/ParseModal';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
function ParseToolbarButton() {
|
function ParseToolbarButton() {
|
||||||
const [isParseModalOpen, setIsParseModalOpen] = useState(false);
|
const [isParseModalOpen, setIsParseModalOpen] = useState(false);
|
||||||
|
@ -17,7 +18,7 @@ function ParseToolbarButton() {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
label="Test Parsing"
|
label={translate('TestParsing')}
|
||||||
iconName={icons.PARSE}
|
iconName={icons.PARSE}
|
||||||
onPress={onOpenParseModalPress}
|
onPress={onOpenParseModalPress}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -56,3 +56,9 @@
|
||||||
|
|
||||||
width: 120px;
|
width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.customFormatScore {
|
||||||
|
composes: cell from '~Components/Table/Cells/TableRowCell.css';
|
||||||
|
|
||||||
|
width: 55px;
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
'audio': string;
|
'audio': string;
|
||||||
'audioLanguages': string;
|
'audioLanguages': string;
|
||||||
|
'customFormatScore': string;
|
||||||
'episodeNumber': string;
|
'episodeNumber': string;
|
||||||
'episodeNumberAnime': string;
|
'episodeNumberAnime': string;
|
||||||
'languages': string;
|
'languages': string;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import MonitorToggleButton from 'Components/MonitorToggleButton';
|
||||||
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
||||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
import TableRow from 'Components/Table/TableRow';
|
import TableRow from 'Components/Table/TableRow';
|
||||||
|
import Tooltip from 'Components/Tooltip/Tooltip';
|
||||||
import EpisodeFormats from 'Episode/EpisodeFormats';
|
import EpisodeFormats from 'Episode/EpisodeFormats';
|
||||||
import EpisodeNumber from 'Episode/EpisodeNumber';
|
import EpisodeNumber from 'Episode/EpisodeNumber';
|
||||||
import EpisodeSearchCellConnector from 'Episode/EpisodeSearchCellConnector';
|
import EpisodeSearchCellConnector from 'Episode/EpisodeSearchCellConnector';
|
||||||
|
@ -12,7 +13,9 @@ import EpisodeTitleLink from 'Episode/EpisodeTitleLink';
|
||||||
import EpisodeFileLanguageConnector from 'EpisodeFile/EpisodeFileLanguageConnector';
|
import EpisodeFileLanguageConnector from 'EpisodeFile/EpisodeFileLanguageConnector';
|
||||||
import MediaInfoConnector from 'EpisodeFile/MediaInfoConnector';
|
import MediaInfoConnector from 'EpisodeFile/MediaInfoConnector';
|
||||||
import * as mediaInfoTypes from 'EpisodeFile/mediaInfoTypes';
|
import * as mediaInfoTypes from 'EpisodeFile/mediaInfoTypes';
|
||||||
|
import { tooltipPositions } from 'Helpers/Props';
|
||||||
import formatBytes from 'Utilities/Number/formatBytes';
|
import formatBytes from 'Utilities/Number/formatBytes';
|
||||||
|
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
|
||||||
import formatRuntime from 'Utilities/Number/formatRuntime';
|
import formatRuntime from 'Utilities/Number/formatRuntime';
|
||||||
import styles from './EpisodeRow.css';
|
import styles from './EpisodeRow.css';
|
||||||
|
|
||||||
|
@ -72,6 +75,7 @@ class EpisodeRow extends Component {
|
||||||
episodeFileSize,
|
episodeFileSize,
|
||||||
releaseGroup,
|
releaseGroup,
|
||||||
customFormats,
|
customFormats,
|
||||||
|
customFormatScore,
|
||||||
alternateTitles,
|
alternateTitles,
|
||||||
columns
|
columns
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
@ -193,6 +197,24 @@ class EpisodeRow extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name === 'customFormatScore') {
|
||||||
|
return (
|
||||||
|
<TableRowCell
|
||||||
|
key={name}
|
||||||
|
className={styles.customFormatScore}
|
||||||
|
>
|
||||||
|
<Tooltip
|
||||||
|
anchor={formatPreferredWordScore(
|
||||||
|
customFormatScore,
|
||||||
|
customFormats.length
|
||||||
|
)}
|
||||||
|
tooltip={<EpisodeFormats formats={customFormats} />}
|
||||||
|
position={tooltipPositions.BOTTOM}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (name === 'languages') {
|
if (name === 'languages') {
|
||||||
return (
|
return (
|
||||||
<TableRowCell
|
<TableRowCell
|
||||||
|
@ -355,6 +377,7 @@ EpisodeRow.propTypes = {
|
||||||
episodeFileSize: PropTypes.number,
|
episodeFileSize: PropTypes.number,
|
||||||
releaseGroup: PropTypes.string,
|
releaseGroup: PropTypes.string,
|
||||||
customFormats: PropTypes.arrayOf(PropTypes.object),
|
customFormats: PropTypes.arrayOf(PropTypes.object),
|
||||||
|
customFormatScore: PropTypes.number.isRequired,
|
||||||
mediaInfo: PropTypes.object,
|
mediaInfo: PropTypes.object,
|
||||||
alternateTitles: PropTypes.arrayOf(PropTypes.object).isRequired,
|
alternateTitles: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
|
|
|
@ -19,6 +19,7 @@ function createMapStateToProps() {
|
||||||
episodeFileSize: episodeFile ? episodeFile.size : null,
|
episodeFileSize: episodeFile ? episodeFile.size : null,
|
||||||
releaseGroup: episodeFile ? episodeFile.releaseGroup : null,
|
releaseGroup: episodeFile ? episodeFile.releaseGroup : null,
|
||||||
customFormats: episodeFile ? episodeFile.customFormats : [],
|
customFormats: episodeFile ? episodeFile.customFormats : [],
|
||||||
|
customFormatScore: episodeFile ? episodeFile.customFormatScore : 0,
|
||||||
alternateTitles: series.alternateTitles
|
alternateTitles: series.alternateTitles
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { inputTypes, kinds, sizes } from 'Helpers/Props';
|
||||||
import Series from 'Series/Series';
|
import Series from 'Series/Series';
|
||||||
import createAllSeriesSelector from 'Store/Selectors/createAllSeriesSelector';
|
import createAllSeriesSelector from 'Store/Selectors/createAllSeriesSelector';
|
||||||
import createTagsSelector from 'Store/Selectors/createTagsSelector';
|
import createTagsSelector from 'Store/Selectors/createTagsSelector';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
import styles from './TagsModalContent.css';
|
import styles from './TagsModalContent.css';
|
||||||
|
|
||||||
interface TagsModalContentProps {
|
interface TagsModalContentProps {
|
||||||
|
@ -73,12 +74,12 @@ function TagsModalContent(props: TagsModalContentProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalContent onModalClose={onModalClose}>
|
<ModalContent onModalClose={onModalClose}>
|
||||||
<ModalHeader>Tags</ModalHeader>
|
<ModalHeader>{translate('Tags')}</ModalHeader>
|
||||||
|
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<Form>
|
<Form>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>Tags</FormLabel>
|
<FormLabel>{translate('Tags')}</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.TAG}
|
type={inputTypes.TAG}
|
||||||
|
@ -89,7 +90,7 @@ function TagsModalContent(props: TagsModalContentProps) {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>Apply Tags</FormLabel>
|
<FormLabel>{translate('ApplyTags')}</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.SELECT}
|
type={inputTypes.SELECT}
|
||||||
|
@ -97,17 +98,17 @@ function TagsModalContent(props: TagsModalContentProps) {
|
||||||
value={applyTags}
|
value={applyTags}
|
||||||
values={applyTagsOptions}
|
values={applyTagsOptions}
|
||||||
helpTexts={[
|
helpTexts={[
|
||||||
'How to apply tags to the selected series',
|
translate('ApplyTagsHelpTextHowToApplySeries'),
|
||||||
'Add: Add the tags the existing list of tags',
|
translate('ApplyTagsHelpTextAdd'),
|
||||||
'Remove: Remove the entered tags',
|
translate('ApplyTagsHelpTextRemove'),
|
||||||
'Replace: Replace the tags with the entered tags (enter no tags to clear all tags)',
|
translate('ApplyTagsHelpTextReplace'),
|
||||||
]}
|
]}
|
||||||
onChange={onApplyTagsChange}
|
onChange={onApplyTagsChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>Result</FormLabel>
|
<FormLabel>{translate('Result')}</FormLabel>
|
||||||
|
|
||||||
<div className={styles.result}>
|
<div className={styles.result}>
|
||||||
{seriesTags.map((id) => {
|
{seriesTags.map((id) => {
|
||||||
|
@ -124,7 +125,11 @@ function TagsModalContent(props: TagsModalContentProps) {
|
||||||
return (
|
return (
|
||||||
<Label
|
<Label
|
||||||
key={tag.id}
|
key={tag.id}
|
||||||
title={removeTag ? 'Removing tag' : 'Existing tag'}
|
title={
|
||||||
|
removeTag
|
||||||
|
? translate('RemovingTag')
|
||||||
|
: translate('ExistingTag')
|
||||||
|
}
|
||||||
kind={removeTag ? kinds.INVERSE : kinds.INFO}
|
kind={removeTag ? kinds.INVERSE : kinds.INFO}
|
||||||
size={sizes.LARGE}
|
size={sizes.LARGE}
|
||||||
>
|
>
|
||||||
|
@ -148,7 +153,7 @@ function TagsModalContent(props: TagsModalContentProps) {
|
||||||
return (
|
return (
|
||||||
<Label
|
<Label
|
||||||
key={tag.id}
|
key={tag.id}
|
||||||
title={'Adding tag'}
|
title={translate('AddingTag')}
|
||||||
kind={kinds.SUCCESS}
|
kind={kinds.SUCCESS}
|
||||||
size={sizes.LARGE}
|
size={sizes.LARGE}
|
||||||
>
|
>
|
||||||
|
@ -162,10 +167,10 @@ function TagsModalContent(props: TagsModalContentProps) {
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<Button onPress={onModalClose}>Cancel</Button>
|
<Button onPress={onModalClose}>{translate('Cancel')}</Button>
|
||||||
|
|
||||||
<Button kind={kinds.PRIMARY} onPress={onApplyPress}>
|
<Button kind={kinds.PRIMARY} onPress={onApplyPress}>
|
||||||
Apply
|
{translate('Apply')}
|
||||||
</Button>
|
</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
|
@ -103,10 +103,10 @@ function TagsModalContent(props: TagsModalContentProps) {
|
||||||
value={applyTags}
|
value={applyTags}
|
||||||
values={applyTagsOptions}
|
values={applyTagsOptions}
|
||||||
helpTexts={[
|
helpTexts={[
|
||||||
translate('ApplyTagsHelpTexts1'),
|
translate('ApplyTagsHelpTextHowToApplyDownloadClients'),
|
||||||
translate('ApplyTagsHelpTexts2'),
|
translate('ApplyTagsHelpTextAdd'),
|
||||||
translate('ApplyTagsHelpTexts3'),
|
translate('ApplyTagsHelpTextRemove'),
|
||||||
translate('ApplyTagsHelpTexts4'),
|
translate('ApplyTagsHelpTextReplace'),
|
||||||
]}
|
]}
|
||||||
onChange={onApplyTagsChange}
|
onChange={onApplyTagsChange}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -101,10 +101,10 @@ function TagsModalContent(props: TagsModalContentProps) {
|
||||||
value={applyTags}
|
value={applyTags}
|
||||||
values={applyTagsOptions}
|
values={applyTagsOptions}
|
||||||
helpTexts={[
|
helpTexts={[
|
||||||
translate('ApplyTagsHelpTexts1'),
|
translate('ApplyTagsHelpTextHowToApplyImportLists'),
|
||||||
translate('ApplyTagsHelpTexts2'),
|
translate('ApplyTagsHelpTextAdd'),
|
||||||
translate('ApplyTagsHelpTexts3'),
|
translate('ApplyTagsHelpTextRemove'),
|
||||||
translate('ApplyTagsHelpTexts4'),
|
translate('ApplyTagsHelpTextReplace'),
|
||||||
]}
|
]}
|
||||||
onChange={onApplyTagsChange}
|
onChange={onApplyTagsChange}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -101,10 +101,10 @@ function TagsModalContent(props: TagsModalContentProps) {
|
||||||
value={applyTags}
|
value={applyTags}
|
||||||
values={applyTagsOptions}
|
values={applyTagsOptions}
|
||||||
helpTexts={[
|
helpTexts={[
|
||||||
translate('ApplyTagsHelpTexts1'),
|
translate('ApplyTagsHelpTextHowToApplyIndexers'),
|
||||||
translate('ApplyTagsHelpTexts2'),
|
translate('ApplyTagsHelpTextAdd'),
|
||||||
translate('ApplyTagsHelpTexts3'),
|
translate('ApplyTagsHelpTextRemove'),
|
||||||
translate('ApplyTagsHelpTexts4'),
|
translate('ApplyTagsHelpTextReplace'),
|
||||||
]}
|
]}
|
||||||
onChange={onApplyTagsChange}
|
onChange={onApplyTagsChange}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import React from 'react';
|
||||||
import { createAction } from 'redux-actions';
|
import { createAction } from 'redux-actions';
|
||||||
import { batchActions } from 'redux-batched-actions';
|
import { batchActions } from 'redux-batched-actions';
|
||||||
|
import Icon from 'Components/Icon';
|
||||||
import episodeEntities from 'Episode/episodeEntities';
|
import episodeEntities from 'Episode/episodeEntities';
|
||||||
import { sortDirections } from 'Helpers/Props';
|
import { icons, sortDirections } from 'Helpers/Props';
|
||||||
import { createThunk, handleThunks } from 'Store/thunks';
|
import { createThunk, handleThunks } from 'Store/thunks';
|
||||||
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
import { updateItem } from './baseActions';
|
import { updateItem } from './baseActions';
|
||||||
import createFetchHandler from './Creators/createFetchHandler';
|
import createFetchHandler from './Creators/createFetchHandler';
|
||||||
import createHandleActions from './Creators/createHandleActions';
|
import createHandleActions from './Creators/createHandleActions';
|
||||||
|
@ -109,6 +112,15 @@ export const defaultState = {
|
||||||
label: 'Formats',
|
label: 'Formats',
|
||||||
isVisible: false
|
isVisible: false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'customFormatScore',
|
||||||
|
columnLabel: translate('CustomFormatScore'),
|
||||||
|
label: React.createElement(Icon, {
|
||||||
|
name: icons.SCORE,
|
||||||
|
title: translate('CustomFormatScore')
|
||||||
|
}),
|
||||||
|
isVisible: false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'status',
|
name: 'status',
|
||||||
label: 'Status',
|
label: 'Status',
|
||||||
|
|
|
@ -47,6 +47,10 @@ export const defaultState = {
|
||||||
|
|
||||||
quality: function(item, direction) {
|
quality: function(item, direction) {
|
||||||
return item.qualityWeight || 0;
|
return item.qualityWeight || 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
customFormats: function(item, direction) {
|
||||||
|
return item.customFormatScore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,9 +10,18 @@ function getTranslations() {
|
||||||
|
|
||||||
let translations = {};
|
let translations = {};
|
||||||
|
|
||||||
getTranslations().then((data) => {
|
export function fetchTranslations() {
|
||||||
|
return new Promise(async(resolve) => {
|
||||||
|
try {
|
||||||
|
const data = await getTranslations();
|
||||||
translations = data.strings;
|
translations = data.strings;
|
||||||
});
|
|
||||||
|
resolve(true);
|
||||||
|
} catch (error) {
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export default function translate(key, tokens) {
|
export default function translate(key, tokens) {
|
||||||
const translation = translations[key] || key;
|
const translation = translations[key] || key;
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { createBrowserHistory } from 'history';
|
||||||
|
import React from 'react';
|
||||||
|
import { render } from 'react-dom';
|
||||||
|
import createAppStore from 'Store/createAppStore';
|
||||||
|
import { fetchTranslations } from 'Utilities/String/translate';
|
||||||
|
import App from './App/App';
|
||||||
|
|
||||||
|
import 'Diag/ConsoleApi';
|
||||||
|
|
||||||
|
export async function bootstrap() {
|
||||||
|
const history = createBrowserHistory();
|
||||||
|
const store = createAppStore(history);
|
||||||
|
const hasTranslationsError = !(await fetchTranslations());
|
||||||
|
|
||||||
|
render(
|
||||||
|
<App
|
||||||
|
store={store}
|
||||||
|
history={history}
|
||||||
|
hasTranslationsError={hasTranslationsError}
|
||||||
|
/>,
|
||||||
|
document.getElementById('root')
|
||||||
|
);
|
||||||
|
}
|
|
@ -48,7 +48,15 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/Content/Fonts/fonts.css">
|
<link rel="stylesheet" type="text/css" href="/Content/Fonts/fonts.css">
|
||||||
<!-- webpack bundles head -->
|
|
||||||
|
<script>
|
||||||
|
window.Sonarr = {
|
||||||
|
urlBase: '__URL_BASE__'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<% for (key in htmlWebpackPlugin.files.js) { %><script type="text/javascript" src="<%= htmlWebpackPlugin.files.js[key] %>" data-no-hash></script><% } %>
|
||||||
|
<% for (key in htmlWebpackPlugin.files.css) { %><link href="<%= htmlWebpackPlugin.files.css[key] %>" rel="stylesheet"></link><% } %>
|
||||||
|
|
||||||
<title>Sonarr</title>
|
<title>Sonarr</title>
|
||||||
|
|
||||||
|
@ -77,7 +85,4 @@
|
||||||
<div id="portal-root"></div>
|
<div id="portal-root"></div>
|
||||||
<div id="root" class="root"></div>
|
<div id="root" class="root"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script src="/initialize.js" data-no-hash></script>
|
|
||||||
<!-- webpack bundles body -->
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
import { createBrowserHistory } from 'history';
|
|
||||||
import React from 'react';
|
|
||||||
import { render } from 'react-dom';
|
|
||||||
import createAppStore from 'Store/createAppStore';
|
|
||||||
import App from './App/App';
|
|
||||||
|
|
||||||
import './preload';
|
|
||||||
import './polyfills';
|
|
||||||
import 'Diag/ConsoleApi';
|
|
||||||
import 'Styles/globals.css';
|
|
||||||
import './index.css';
|
|
||||||
|
|
||||||
const history = createBrowserHistory();
|
|
||||||
const store = createAppStore(history);
|
|
||||||
|
|
||||||
render(
|
|
||||||
<App
|
|
||||||
store={store}
|
|
||||||
history={history}
|
|
||||||
/>,
|
|
||||||
document.getElementById('root')
|
|
||||||
);
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import './polyfills';
|
||||||
|
import 'Styles/globals.css';
|
||||||
|
import './index.css';
|
||||||
|
|
||||||
|
const initializeUrl = `${
|
||||||
|
window.Sonarr.urlBase
|
||||||
|
}/initialize.json?t=${Date.now()}`;
|
||||||
|
const response = await fetch(initializeUrl);
|
||||||
|
|
||||||
|
window.Sonarr = await response.json();
|
||||||
|
|
||||||
|
/* eslint-disable no-undef, @typescript-eslint/ban-ts-comment */
|
||||||
|
// @ts-ignore 2304
|
||||||
|
__webpack_public_path__ = `${window.Sonarr.urlBase}/`;
|
||||||
|
/* eslint-enable no-undef, @typescript-eslint/ban-ts-comment */
|
||||||
|
|
||||||
|
const { bootstrap } = await import('./bootstrap');
|
||||||
|
|
||||||
|
await bootstrap();
|
|
@ -1,2 +0,0 @@
|
||||||
/* eslint no-undef: 0 */
|
|
||||||
__webpack_public_path__ = `${window.Sonarr.urlBase}/`;
|
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6",
|
"target": "esnext",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"checkJs": false,
|
"checkJs": false,
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"module": "commonjs",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"author": "Team Sonarr",
|
"author": "Team Sonarr",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"readmeFilename": "readme.md",
|
"readmeFilename": "readme.md",
|
||||||
"main": "index.js",
|
"main": "index.ts",
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"defaults"
|
"defaults"
|
||||||
],
|
],
|
||||||
|
|
|
@ -120,6 +120,8 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||||
[TestCase("[HatSubs] Anime Title 1004 [E63F2984].mkv", "Anime Title", 1004, 0, 0)]
|
[TestCase("[HatSubs] Anime Title 1004 [E63F2984].mkv", "Anime Title", 1004, 0, 0)]
|
||||||
[TestCase("Anime Title 100 S3 - 01 (1080p) [5A493522]", "Anime Title 100 S3", 1, 0, 0)]
|
[TestCase("Anime Title 100 S3 - 01 (1080p) [5A493522]", "Anime Title 100 S3", 1, 0, 0)]
|
||||||
[TestCase("[SubsPlease] Anime Title 100 S3 - 01 (1080p) [5A493522]", "Anime Title 100 S3", 1, 0, 0)]
|
[TestCase("[SubsPlease] Anime Title 100 S3 - 01 (1080p) [5A493522]", "Anime Title 100 S3", 1, 0, 0)]
|
||||||
|
[TestCase("[CameEsp] Another Anime 100 - Another 100 Anime - 01 [720p][ESP-ENG][mkv]", "Another Anime 100 - Another 100 Anime", 1, 0, 0)]
|
||||||
|
[TestCase("[SubsPlease] Another Anime 100 - Another 100 Anime - 01 (1080p) [4E6B4518].mkv", "Another Anime 100 - Another 100 Anime", 1, 0, 0)]
|
||||||
|
|
||||||
// [TestCase("", "", 0, 0, 0)]
|
// [TestCase("", "", 0, 0, 0)]
|
||||||
public void should_parse_absolute_numbers(string postTitle, string title, int absoluteEpisodeNumber, int seasonNumber, int episodeNumber)
|
public void should_parse_absolute_numbers(string postTitle, string title, int absoluteEpisodeNumber, int seasonNumber, int episodeNumber)
|
||||||
|
|
|
@ -12,9 +12,9 @@ namespace NzbDrone.Core.Notifications.Discord
|
||||||
Release,
|
Release,
|
||||||
Poster,
|
Poster,
|
||||||
Fanart,
|
Fanart,
|
||||||
|
Indexer,
|
||||||
CustomFormats,
|
CustomFormats,
|
||||||
CustomFormatScore,
|
CustomFormatScore
|
||||||
Indexer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DiscordImportFieldType
|
public enum DiscordImportFieldType
|
||||||
|
|
|
@ -106,6 +106,11 @@ namespace NzbDrone.Core.Parser
|
||||||
new Regex(@"^\[(?<subgroup>.+?)\][-_. ]?(?<title>[^-]+?)(?:(?<![-_. ]|\b[0]\d+) - )(?:[-_. ]?(?<absoluteepisode>\d{2,3}(\.\d{1,2})?(?!\d+)))+(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>\[\w{8}\])?(?:$|\.mkv)",
|
new Regex(@"^\[(?<subgroup>.+?)\][-_. ]?(?<title>[^-]+?)(?:(?<![-_. ]|\b[0]\d+) - )(?:[-_. ]?(?<absoluteepisode>\d{2,3}(\.\d{1,2})?(?!\d+)))+(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>\[\w{8}\])?(?:$|\.mkv)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
|
||||||
|
// TODO: WIP
|
||||||
|
// Anime - [SubGroup] Title with trailing 3-digit number and sub title - Absolute Episode Number
|
||||||
|
new Regex(@"^\[(?<subgroup>.+?)\][-_. ]?(?<title>[^]]+?)(?:[-_. ]{3}?(?<absoluteepisode>\d{2}(\.\d{1,2})?(?!-?\d+|-[a-z]+)))+(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>\[\w{8}\])?(?:$|\.mkv)",
|
||||||
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
|
||||||
// Anime - [SubGroup] Title with trailing number Absolute Episode Number
|
// Anime - [SubGroup] Title with trailing number Absolute Episode Number
|
||||||
new Regex(@"^\[(?<subgroup>.+?)\][-_. ]?(?<title>[^-]+?)(?:(?<![-_. ]|\b[0]\d+)[_ ]+)(?:[-_. ]?(?<absoluteepisode>\d{3}(\.\d{1,2})?(?!\d+|-[a-z]+)))+(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>\[\w{8}\])?(?:$|\.mkv)",
|
new Regex(@"^\[(?<subgroup>.+?)\][-_. ]?(?<title>[^-]+?)(?:(?<![-_. ]|\b[0]\d+)[_ ]+)(?:[-_. ]?(?<absoluteepisode>\d{3}(\.\d{1,2})?(?!\d+|-[a-z]+)))+(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>\[\w{8}\])?(?:$|\.mkv)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace Sonarr.Api.V3.EpisodeFiles
|
||||||
public List<Language> Languages { get; set; }
|
public List<Language> Languages { get; set; }
|
||||||
public QualityModel Quality { get; set; }
|
public QualityModel Quality { get; set; }
|
||||||
public List<CustomFormatResource> CustomFormats { get; set; }
|
public List<CustomFormatResource> CustomFormats { get; set; }
|
||||||
|
public int CustomFormatScore { get; set; }
|
||||||
public MediaInfoResource MediaInfo { get; set; }
|
public MediaInfoResource MediaInfo { get; set; }
|
||||||
|
|
||||||
public bool QualityCutoffNotMet { get; set; }
|
public bool QualityCutoffNotMet { get; set; }
|
||||||
|
@ -67,6 +68,8 @@ namespace Sonarr.Api.V3.EpisodeFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
model.Series = series;
|
model.Series = series;
|
||||||
|
var customFormats = formatCalculationService?.ParseCustomFormat(model, model.Series);
|
||||||
|
var customFormatScore = series?.QualityProfile?.Value?.CalculateCustomFormatScore(customFormats) ?? 0;
|
||||||
|
|
||||||
return new EpisodeFileResource
|
return new EpisodeFileResource
|
||||||
{
|
{
|
||||||
|
@ -84,7 +87,8 @@ namespace Sonarr.Api.V3.EpisodeFiles
|
||||||
Quality = model.Quality,
|
Quality = model.Quality,
|
||||||
MediaInfo = model.MediaInfo.ToResource(model.SceneName),
|
MediaInfo = model.MediaInfo.ToResource(model.SceneName),
|
||||||
QualityCutoffNotMet = upgradableSpecification.QualityCutoffNotMet(series.QualityProfile.Value, model.Quality),
|
QualityCutoffNotMet = upgradableSpecification.QualityCutoffNotMet(series.QualityProfile.Value, model.Quality),
|
||||||
CustomFormats = formatCalculationService.ParseCustomFormat(model).ToResource(false)
|
CustomFormats = customFormats.ToResource(false),
|
||||||
|
CustomFormatScore = customFormatScore
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace Sonarr.Api.V3.ManualImport
|
||||||
public int QualityWeight { get; set; }
|
public int QualityWeight { get; set; }
|
||||||
public string DownloadId { get; set; }
|
public string DownloadId { get; set; }
|
||||||
public List<CustomFormatResource> CustomFormats { get; set; }
|
public List<CustomFormatResource> CustomFormats { get; set; }
|
||||||
|
public int CustomFormatScore { get; set; }
|
||||||
public IEnumerable<Rejection> Rejections { get; set; }
|
public IEnumerable<Rejection> Rejections { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +42,9 @@ namespace Sonarr.Api.V3.ManualImport
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var customFormats = model.CustomFormats;
|
||||||
|
var customFormatScore = model.Series?.QualityProfile?.Value?.CalculateCustomFormatScore(customFormats) ?? 0;
|
||||||
|
|
||||||
return new ManualImportResource
|
return new ManualImportResource
|
||||||
{
|
{
|
||||||
Id = HashConverter.GetHashInt31(model.Path),
|
Id = HashConverter.GetHashInt31(model.Path),
|
||||||
|
@ -56,7 +60,8 @@ namespace Sonarr.Api.V3.ManualImport
|
||||||
ReleaseGroup = model.ReleaseGroup,
|
ReleaseGroup = model.ReleaseGroup,
|
||||||
Quality = model.Quality,
|
Quality = model.Quality,
|
||||||
Languages = model.Languages,
|
Languages = model.Languages,
|
||||||
CustomFormats = model.CustomFormats.ToResource(false),
|
CustomFormats = customFormats.ToResource(false),
|
||||||
|
CustomFormatScore = customFormatScore,
|
||||||
|
|
||||||
// QualityWeight
|
// QualityWeight
|
||||||
DownloadId = model.DownloadId,
|
DownloadId = model.DownloadId,
|
||||||
|
|
|
@ -4062,53 +4062,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/v3/metadata/bulk": {
|
|
||||||
"put": {
|
|
||||||
"tags": [
|
|
||||||
"Metadata"
|
|
||||||
],
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/MetadataBulkResource"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "Success",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/MetadataResource"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"tags": [
|
|
||||||
"Metadata"
|
|
||||||
],
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/MetadataBulkResource"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "Success"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v3/metadata/schema": {
|
"/api/v3/metadata/schema": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
|
@ -4673,53 +4626,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/v3/notification/bulk": {
|
|
||||||
"put": {
|
|
||||||
"tags": [
|
|
||||||
"Notification"
|
|
||||||
],
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/NotificationBulkResource"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "Success",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/NotificationResource"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"tags": [
|
|
||||||
"Notification"
|
|
||||||
],
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/NotificationBulkResource"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "Success"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v3/notification/schema": {
|
"/api/v3/notification/schema": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
|
@ -7868,6 +7774,10 @@
|
||||||
},
|
},
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
},
|
||||||
|
"customFormatScore": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
"mediaInfo": {
|
"mediaInfo": {
|
||||||
"$ref": "#/components/schemas/MediaInfoResource"
|
"$ref": "#/components/schemas/MediaInfoResource"
|
||||||
},
|
},
|
||||||
|
@ -9301,31 +9211,6 @@
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"MetadataBulkResource": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"ids": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"nullable": true
|
|
||||||
},
|
|
||||||
"tags": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"nullable": true
|
|
||||||
},
|
|
||||||
"applyTags": {
|
|
||||||
"$ref": "#/components/schemas/ApplyTags"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"MetadataResource": {
|
"MetadataResource": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -9484,31 +9369,6 @@
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"NotificationBulkResource": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"ids": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"nullable": true
|
|
||||||
},
|
|
||||||
"tags": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"nullable": true
|
|
||||||
},
|
|
||||||
"applyTags": {
|
|
||||||
"$ref": "#/components/schemas/ApplyTags"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"NotificationResource": {
|
"NotificationResource": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -9685,6 +9545,24 @@
|
||||||
"$ref": "#/components/schemas/EpisodeResource"
|
"$ref": "#/components/schemas/EpisodeResource"
|
||||||
},
|
},
|
||||||
"nullable": true
|
"nullable": true
|
||||||
|
},
|
||||||
|
"languages": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/Language"
|
||||||
|
},
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"customFormats": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/CustomFormatResource"
|
||||||
|
},
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"customFormatScore": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
@ -10089,6 +9967,10 @@
|
||||||
},
|
},
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
},
|
||||||
|
"customFormatScore": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
"size": {
|
"size": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double"
|
"format": "double"
|
||||||
|
@ -11328,6 +11210,14 @@
|
||||||
},
|
},
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
},
|
||||||
|
"downloadClientIds": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
"autoTagIds": {
|
"autoTagIds": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
using System.Text;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using NzbDrone.Common;
|
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
|
||||||
using NzbDrone.Core.Analytics;
|
|
||||||
using NzbDrone.Core.Configuration;
|
|
||||||
|
|
||||||
namespace Sonarr.Http.Frontend
|
|
||||||
{
|
|
||||||
[Authorize(Policy = "UI")]
|
|
||||||
[ApiController]
|
|
||||||
public class InitializeJsController : Controller
|
|
||||||
{
|
|
||||||
private readonly IConfigFileProvider _configFileProvider;
|
|
||||||
private readonly IAnalyticsService _analyticsService;
|
|
||||||
|
|
||||||
private static string _apiKey;
|
|
||||||
private static string _urlBase;
|
|
||||||
private string _generatedContent;
|
|
||||||
|
|
||||||
public InitializeJsController(IConfigFileProvider configFileProvider,
|
|
||||||
IAnalyticsService analyticsService)
|
|
||||||
{
|
|
||||||
_configFileProvider = configFileProvider;
|
|
||||||
_analyticsService = analyticsService;
|
|
||||||
|
|
||||||
_apiKey = configFileProvider.ApiKey;
|
|
||||||
_urlBase = configFileProvider.UrlBase;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("/initialize.js")]
|
|
||||||
public IActionResult Index()
|
|
||||||
{
|
|
||||||
return Content(GetContent(), "application/javascript");
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetContent()
|
|
||||||
{
|
|
||||||
if (RuntimeInfo.IsProduction && _generatedContent != null)
|
|
||||||
{
|
|
||||||
return _generatedContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
var builder = new StringBuilder();
|
|
||||||
builder.AppendLine("window.Sonarr = {");
|
|
||||||
builder.AppendLine($" apiRoot: '{_urlBase}/api/v3',");
|
|
||||||
builder.AppendLine($" apiKey: '{_apiKey}',");
|
|
||||||
builder.AppendLine($" release: '{BuildInfo.Release}',");
|
|
||||||
builder.AppendLine($" version: '{BuildInfo.Version.ToString()}',");
|
|
||||||
builder.AppendLine($" instanceName: '{_configFileProvider.InstanceName.ToString()}',");
|
|
||||||
builder.AppendLine($" theme: '{_configFileProvider.Theme.ToString()}',");
|
|
||||||
builder.AppendLine($" branch: '{_configFileProvider.Branch.ToLower()}',");
|
|
||||||
builder.AppendLine($" analytics: {_analyticsService.IsEnabled.ToString().ToLowerInvariant()},");
|
|
||||||
builder.AppendLine($" userHash: '{HashUtil.AnonymousToken()}',");
|
|
||||||
builder.AppendLine($" urlBase: '{_urlBase}',");
|
|
||||||
builder.AppendLine($" isProduction: {RuntimeInfo.IsProduction.ToString().ToLowerInvariant()}");
|
|
||||||
builder.AppendLine("};");
|
|
||||||
|
|
||||||
_generatedContent = builder.ToString();
|
|
||||||
|
|
||||||
return _generatedContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
using System.Text;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Core.Analytics;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
|
||||||
|
namespace Sonarr.Http.Frontend
|
||||||
|
{
|
||||||
|
[Authorize(Policy = "UI")]
|
||||||
|
[ApiController]
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public class InitializeJsonController : Controller
|
||||||
|
{
|
||||||
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
|
private readonly IAnalyticsService _analyticsService;
|
||||||
|
|
||||||
|
private static string _apiKey;
|
||||||
|
private static string _urlBase;
|
||||||
|
private string _generatedContent;
|
||||||
|
|
||||||
|
public InitializeJsonController(IConfigFileProvider configFileProvider,
|
||||||
|
IAnalyticsService analyticsService)
|
||||||
|
{
|
||||||
|
_configFileProvider = configFileProvider;
|
||||||
|
_analyticsService = analyticsService;
|
||||||
|
|
||||||
|
_apiKey = configFileProvider.ApiKey;
|
||||||
|
_urlBase = configFileProvider.UrlBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("/initialize.json")]
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return Content(GetContent(), "application/json");
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetContent()
|
||||||
|
{
|
||||||
|
if (RuntimeInfo.IsProduction && _generatedContent != null)
|
||||||
|
{
|
||||||
|
return _generatedContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
var builder = new StringBuilder();
|
||||||
|
builder.AppendLine("{");
|
||||||
|
builder.AppendLine($" \"apiRoot\": \"{_urlBase}/api/v3\",");
|
||||||
|
builder.AppendLine($" \"apiKey\": \"{_apiKey}\",");
|
||||||
|
builder.AppendLine($" \"release\": \"{BuildInfo.Release}\",");
|
||||||
|
builder.AppendLine($" \"version\": \"{BuildInfo.Version.ToString()}\",");
|
||||||
|
builder.AppendLine($" \"instanceName\": \"{_configFileProvider.InstanceName.ToString()}\",");
|
||||||
|
builder.AppendLine($" \"theme\": \"{_configFileProvider.Theme.ToString()}\",");
|
||||||
|
builder.AppendLine($" \"branch\": \"{_configFileProvider.Branch.ToLower()}\",");
|
||||||
|
builder.AppendLine($" \"analytics\": {_analyticsService.IsEnabled.ToString().ToLowerInvariant()},");
|
||||||
|
builder.AppendLine($" \"userHash\": \"{HashUtil.AnonymousToken()}\",");
|
||||||
|
builder.AppendLine($" \"urlBase\": \"{_urlBase}\",");
|
||||||
|
builder.AppendLine($" \"isProduction\": {RuntimeInfo.IsProduction.ToString().ToLowerInvariant()}");
|
||||||
|
builder.AppendLine("}");
|
||||||
|
|
||||||
|
_generatedContent = builder.ToString();
|
||||||
|
|
||||||
|
return _generatedContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -62,9 +62,11 @@ namespace Sonarr.Http.Frontend.Mappers
|
||||||
url = cacheBreakProvider.AddCacheBreakerToPath(match.Groups["path"].Value);
|
url = cacheBreakProvider.AddCacheBreakerToPath(match.Groups["path"].Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Format("{0}=\"{1}{2}\"", match.Groups["attribute"].Value, UrlBase, url);
|
return $"{match.Groups["attribute"].Value}=\"{UrlBase}{url}\"";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
text = text.Replace("__URL_BASE__", UrlBase);
|
||||||
|
|
||||||
_generatedContent = text;
|
_generatedContent = text;
|
||||||
|
|
||||||
return _generatedContent;
|
return _generatedContent;
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Sonarr.Http.Frontend.Mappers
|
||||||
}
|
}
|
||||||
|
|
||||||
return resourceUrl.StartsWith("/content") ||
|
return resourceUrl.StartsWith("/content") ||
|
||||||
(resourceUrl.EndsWith(".js") && !resourceUrl.EndsWith("initialize.js")) ||
|
resourceUrl.EndsWith(".js") ||
|
||||||
resourceUrl.EndsWith(".map") ||
|
resourceUrl.EndsWith(".map") ||
|
||||||
resourceUrl.EndsWith(".css") ||
|
resourceUrl.EndsWith(".css") ||
|
||||||
(resourceUrl.EndsWith(".ico") && !resourceUrl.Equals("/favicon.ico")) ||
|
(resourceUrl.EndsWith(".ico") && !resourceUrl.Equals("/favicon.ico")) ||
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Sonarr.Http.Middleware
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.EndsWith("/initialize.js"))
|
if (path.EndsWith("/initialize.json"))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue