Improve default series type handling (for daily series)
New: Display default series type when adding new/existing series when available Fixed: Don't override series type on series refresh
This commit is contained in:
parent
e9b537b6e6
commit
db42256dc3
|
@ -14,6 +14,7 @@ import ModalBody from 'Components/Modal/ModalBody';
|
|||
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||
import Popover from 'Components/Tooltip/Popover';
|
||||
import SeriesPoster from 'Series/SeriesPoster';
|
||||
import * as seriesTypes from 'Utilities/Series/seriesTypes';
|
||||
import SeriesMonitoringOptionsPopoverContent from 'AddSeries/SeriesMonitoringOptionsPopoverContent';
|
||||
import SeriesTypePopoverContent from 'AddSeries/SeriesTypePopoverContent';
|
||||
import styles from './AddNewSeriesModalContent.css';
|
||||
|
@ -27,10 +28,19 @@ class AddNewSeriesModalContent extends Component {
|
|||
super(props, context);
|
||||
|
||||
this.state = {
|
||||
seriesType: props.initialSeriesType === seriesTypes.STANDARD ?
|
||||
props.seriesType.value :
|
||||
props.initialSeriesType,
|
||||
searchForMissingEpisodes: false
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (this.props.seriesType.value !== prevProps.seriesType.value) {
|
||||
this.setState({ seriesType: this.props.seriesType.value });
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Listeners
|
||||
|
||||
|
@ -47,7 +57,12 @@ class AddNewSeriesModalContent extends Component {
|
|||
}
|
||||
|
||||
onAddSeriesPress = () => {
|
||||
this.props.onAddSeriesPress(this.state.searchForMissingEpisodes);
|
||||
const {
|
||||
searchForMissingEpisodes,
|
||||
seriesType
|
||||
} = this.state;
|
||||
|
||||
this.props.onAddSeriesPress(searchForMissingEpisodes, seriesType);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -200,6 +215,7 @@ class AddNewSeriesModalContent extends Component {
|
|||
name="seriesType"
|
||||
onChange={onInputChange}
|
||||
{...seriesType}
|
||||
value={this.state.seriesType}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
|
@ -262,6 +278,7 @@ AddNewSeriesModalContent.propTypes = {
|
|||
title: PropTypes.string.isRequired,
|
||||
year: PropTypes.number.isRequired,
|
||||
overview: PropTypes.string,
|
||||
initialSeriesType: PropTypes.string.isRequired,
|
||||
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
isAdding: PropTypes.bool.isRequired,
|
||||
addError: PropTypes.object,
|
||||
|
|
|
@ -55,14 +55,13 @@ class AddNewSeriesModalContentConnector extends Component {
|
|||
this.props.setAddSeriesDefault({ [name]: value });
|
||||
}
|
||||
|
||||
onAddSeriesPress = (searchForMissingEpisodes) => {
|
||||
onAddSeriesPress = (searchForMissingEpisodes, seriesType) => {
|
||||
const {
|
||||
tvdbId,
|
||||
rootFolderPath,
|
||||
monitor,
|
||||
qualityProfileId,
|
||||
languageProfileId,
|
||||
seriesType,
|
||||
seasonFolder,
|
||||
tags
|
||||
} = this.props;
|
||||
|
@ -73,7 +72,7 @@ class AddNewSeriesModalContentConnector extends Component {
|
|||
monitor: monitor.value,
|
||||
qualityProfileId: qualityProfileId.value,
|
||||
languageProfileId: languageProfileId.value,
|
||||
seriesType: seriesType.value,
|
||||
seriesType,
|
||||
seasonFolder: seasonFolder.value,
|
||||
tags: tags.value,
|
||||
searchForMissingEpisodes
|
||||
|
|
|
@ -58,6 +58,7 @@ class AddNewSeriesSearchResult extends Component {
|
|||
statistics,
|
||||
ratings,
|
||||
folder,
|
||||
seriesType,
|
||||
images,
|
||||
isExistingSeries,
|
||||
isSmallScreen
|
||||
|
@ -191,6 +192,7 @@ class AddNewSeriesSearchResult extends Component {
|
|||
year={year}
|
||||
overview={overview}
|
||||
folder={folder}
|
||||
initialSeriesType={seriesType}
|
||||
images={images}
|
||||
onModalClose={this.onAddSeriesModalClose}
|
||||
/>
|
||||
|
@ -210,6 +212,7 @@ AddNewSeriesSearchResult.propTypes = {
|
|||
statistics: PropTypes.object.isRequired,
|
||||
ratings: PropTypes.object.isRequired,
|
||||
folder: PropTypes.string.isRequired,
|
||||
seriesType: PropTypes.string.isRequired,
|
||||
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
isExistingSeries: PropTypes.bool.isRequired,
|
||||
isSmallScreen: PropTypes.bool.isRequired
|
||||
|
|
|
@ -90,6 +90,7 @@ function ImportSeriesRow(props) {
|
|||
<ImportSeriesSelectSeriesConnector
|
||||
id={id}
|
||||
isExistingSeries={isExistingSeries}
|
||||
onInputChange={onInputChange}
|
||||
/>
|
||||
</VirtualTableRowCell>
|
||||
</VirtualTableRow>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import _ from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { queueLookupSeries, setImportSeriesValue } from 'Store/Actions/importSeriesActions';
|
||||
import createImportSeriesItemSelector from 'Store/Selectors/createImportSeriesItemSelector';
|
||||
import * as seriesTypes from 'Utilities/Series/seriesTypes';
|
||||
import ImportSeriesSelectSeries from './ImportSeriesSelectSeries';
|
||||
|
||||
function createMapStateToProps() {
|
||||
|
@ -41,13 +41,23 @@ class ImportSeriesSelectSeriesConnector extends Component {
|
|||
onSeriesSelect = (tvdbId) => {
|
||||
const {
|
||||
id,
|
||||
items
|
||||
items,
|
||||
onInputChange
|
||||
} = this.props;
|
||||
|
||||
const selectedSeries = items.find((item) => item.tvdbId === tvdbId);
|
||||
|
||||
this.props.setImportSeriesValue({
|
||||
id,
|
||||
selectedSeries: _.find(items, { tvdbId })
|
||||
selectedSeries
|
||||
});
|
||||
|
||||
if (selectedSeries.seriesType !== seriesTypes.STANDARD) {
|
||||
onInputChange({
|
||||
name: 'seriesType',
|
||||
value: selectedSeries.seriesType
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -69,6 +79,7 @@ ImportSeriesSelectSeriesConnector.propTypes = {
|
|||
items: PropTypes.arrayOf(PropTypes.object),
|
||||
selectedSeries: PropTypes.object,
|
||||
isSelected: PropTypes.bool,
|
||||
onInputChange: PropTypes.func.isRequired,
|
||||
queueLookupSeries: PropTypes.func.isRequired,
|
||||
setImportSeriesValue: PropTypes.func.isRequired
|
||||
};
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import * as seriesTypes from 'Utilities/Series/seriesTypes';
|
||||
import SelectInput from './SelectInput';
|
||||
|
||||
const seriesTypeOptions = [
|
||||
{ key: 'standard', value: 'Standard' },
|
||||
{ key: 'daily', value: 'Daily' },
|
||||
{ key: 'anime', value: 'Anime' }
|
||||
{ key: seriesTypes.STANDARD, value: 'Standard' },
|
||||
{ key: seriesTypes.DAILY, value: 'Daily' },
|
||||
{ key: seriesTypes.ANIME, value: 'Anime' }
|
||||
];
|
||||
|
||||
function SeriesTypeSelectInput(props) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import getSectionState from 'Utilities/State/getSectionState';
|
|||
import updateSectionState from 'Utilities/State/updateSectionState';
|
||||
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
||||
import getNewSeries from 'Utilities/Series/getNewSeries';
|
||||
import * as seriesTypes from 'Utilities/Series/seriesTypes';
|
||||
import { createThunk, handleThunks } from 'Store/thunks';
|
||||
import createSetSettingValueReducer from './Creators/Reducers/createSetSettingValueReducer';
|
||||
import createHandleActions from './Creators/createHandleActions';
|
||||
|
@ -34,7 +35,7 @@ export const defaultState = {
|
|||
monitor: monitorOptions[0].key,
|
||||
qualityProfileId: 0,
|
||||
languageProfileId: 0,
|
||||
seriesType: 'standard',
|
||||
seriesType: seriesTypes.STANDARD,
|
||||
seasonFolder: true,
|
||||
tags: []
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import createAjaxRequest from 'Utilities/createAjaxRequest';
|
|||
import getSectionState from 'Utilities/State/getSectionState';
|
||||
import updateSectionState from 'Utilities/State/updateSectionState';
|
||||
import getNewSeries from 'Utilities/Series/getNewSeries';
|
||||
import * as seriesTypes from 'Utilities/Series/seriesTypes';
|
||||
import { createThunk, handleThunks } from 'Store/thunks';
|
||||
import createHandleActions from './Creators/createHandleActions';
|
||||
import { set, removeItem, updateItem } from './baseActions';
|
||||
|
@ -149,7 +150,9 @@ export const actionHandlers = handleThunks({
|
|||
abortCurrentLookup = abortRequest;
|
||||
|
||||
request.done((data) => {
|
||||
dispatch(updateItem({
|
||||
const selectedSeries = queued.selectedSeries || data[0];
|
||||
|
||||
const itemProps = {
|
||||
section,
|
||||
id: queued.id,
|
||||
isFetching: false,
|
||||
|
@ -157,9 +160,15 @@ export const actionHandlers = handleThunks({
|
|||
error: null,
|
||||
items: data,
|
||||
isQueued: false,
|
||||
selectedSeries: queued.selectedSeries || data[0],
|
||||
selectedSeries,
|
||||
updateOnly: true
|
||||
}));
|
||||
};
|
||||
|
||||
if (selectedSeries.seriesType !== seriesTypes.STANDARD) {
|
||||
itemProps.seriesType = selectedSeries.seriesType;
|
||||
}
|
||||
|
||||
dispatch(updateItem(itemProps));
|
||||
});
|
||||
|
||||
request.fail((xhr) => {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
export const ANIME = 'anime';
|
||||
export const DAILY = 'daily';
|
||||
export const STANDARD = 'standard';
|
|
@ -7,6 +7,7 @@ using NLog;
|
|||
using NzbDrone.Common.Cloud;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.DataAugmentation.DailySeries;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource.SkyHook.Resource;
|
||||
|
@ -19,14 +20,20 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
|||
private readonly IHttpClient _httpClient;
|
||||
private readonly Logger _logger;
|
||||
private readonly ISeriesService _seriesService;
|
||||
private readonly IDailySeriesService _dailySeriesService;
|
||||
private readonly IHttpRequestBuilderFactory _requestBuilder;
|
||||
|
||||
public SkyHookProxy(IHttpClient httpClient, ISonarrCloudRequestBuilder requestBuilder, ISeriesService seriesService, Logger logger)
|
||||
public SkyHookProxy(IHttpClient httpClient,
|
||||
ISonarrCloudRequestBuilder requestBuilder,
|
||||
ISeriesService seriesService,
|
||||
IDailySeriesService dailySeriesService,
|
||||
Logger logger)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_requestBuilder = requestBuilder.SkyHookTvdb;
|
||||
_logger = logger;
|
||||
_seriesService = seriesService;
|
||||
_dailySeriesService = dailySeriesService;
|
||||
_requestBuilder = requestBuilder.SkyHookTvdb;
|
||||
}
|
||||
|
||||
|
@ -127,8 +134,6 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
|||
|
||||
private Series MapSeries(ShowResource show)
|
||||
{
|
||||
|
||||
|
||||
var series = new Series();
|
||||
series.TvdbId = show.TvdbId;
|
||||
|
||||
|
@ -176,7 +181,12 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
|||
{
|
||||
series.Certification = show.ContentRating.ToUpper();
|
||||
}
|
||||
|
||||
|
||||
if (_dailySeriesService.IsDailySeries(series.TvdbId))
|
||||
{
|
||||
series.SeriesType = SeriesTypes.Daily;
|
||||
}
|
||||
|
||||
series.Actors = show.Actors.Select(MapActors).ToList();
|
||||
series.Seasons = show.Seasons.Select(MapSeason).ToList();
|
||||
series.Images = show.Images.Select(MapImage).ToList();
|
||||
|
|
|
@ -6,7 +6,6 @@ using NLog;
|
|||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Instrumentation.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.DataAugmentation.DailySeries;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
|
@ -23,7 +22,6 @@ namespace NzbDrone.Core.Tv
|
|||
private readonly ISeriesService _seriesService;
|
||||
private readonly IRefreshEpisodeService _refreshEpisodeService;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly IDailySeriesService _dailySeriesService;
|
||||
private readonly IDiskScanService _diskScanService;
|
||||
private readonly ICheckIfSeriesShouldBeRefreshed _checkIfSeriesShouldBeRefreshed;
|
||||
private readonly IConfigService _configService;
|
||||
|
@ -33,7 +31,7 @@ namespace NzbDrone.Core.Tv
|
|||
ISeriesService seriesService,
|
||||
IRefreshEpisodeService refreshEpisodeService,
|
||||
IEventAggregator eventAggregator,
|
||||
IDailySeriesService dailySeriesService,
|
||||
|
||||
IDiskScanService diskScanService,
|
||||
ICheckIfSeriesShouldBeRefreshed checkIfSeriesShouldBeRefreshed,
|
||||
IConfigService configService,
|
||||
|
@ -43,7 +41,6 @@ namespace NzbDrone.Core.Tv
|
|||
_seriesService = seriesService;
|
||||
_refreshEpisodeService = refreshEpisodeService;
|
||||
_eventAggregator = eventAggregator;
|
||||
_dailySeriesService = dailySeriesService;
|
||||
_diskScanService = diskScanService;
|
||||
_checkIfSeriesShouldBeRefreshed = checkIfSeriesShouldBeRefreshed;
|
||||
_configService = configService;
|
||||
|
@ -101,11 +98,6 @@ namespace NzbDrone.Core.Tv
|
|||
series.Genres = seriesInfo.Genres;
|
||||
series.Certification = seriesInfo.Certification;
|
||||
|
||||
if (_dailySeriesService.IsDailySeries(series.TvdbId))
|
||||
{
|
||||
series.SeriesType = SeriesTypes.Daily;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
series.Path = new DirectoryInfo(series.Path).FullName;
|
||||
|
|
Loading…
Reference in New Issue