mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-19 17:32:38 +01:00
Fixed: Excluded movies on search results
This commit is contained in:
parent
9ad6b3a611
commit
9442f1fb04
@ -6,7 +6,6 @@ import { clearAddMovie, lookupMovie } from 'Store/Actions/addMovieActions';
|
||||
import { clearMovieFiles, fetchMovieFiles } from 'Store/Actions/movieFileActions';
|
||||
import { clearQueueDetails, fetchQueueDetails } from 'Store/Actions/queueActions';
|
||||
import { fetchRootFolders } from 'Store/Actions/rootFolderActions';
|
||||
import { fetchImportListExclusions } from 'Store/Actions/Settings/importListExclusions';
|
||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
||||
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
||||
@ -36,7 +35,6 @@ const mapDispatchToProps = {
|
||||
lookupMovie,
|
||||
clearAddMovie,
|
||||
fetchRootFolders,
|
||||
fetchImportListExclusions,
|
||||
fetchQueueDetails,
|
||||
clearQueueDetails,
|
||||
fetchMovieFiles,
|
||||
@ -56,7 +54,6 @@ class AddNewMovieConnector extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.props.fetchRootFolders();
|
||||
this.props.fetchImportListExclusions();
|
||||
this.props.fetchQueueDetails();
|
||||
}
|
||||
|
||||
@ -131,7 +128,6 @@ AddNewMovieConnector.propTypes = {
|
||||
lookupMovie: PropTypes.func.isRequired,
|
||||
clearAddMovie: PropTypes.func.isRequired,
|
||||
fetchRootFolders: PropTypes.func.isRequired,
|
||||
fetchImportListExclusions: PropTypes.func.isRequired,
|
||||
fetchQueueDetails: PropTypes.func.isRequired,
|
||||
clearQueueDetails: PropTypes.func.isRequired,
|
||||
fetchMovieFiles: PropTypes.func.isRequired,
|
||||
|
@ -71,7 +71,7 @@ class AddNewMovieSearchResult extends Component {
|
||||
images,
|
||||
existingMovieId,
|
||||
isExistingMovie,
|
||||
isExclusionMovie,
|
||||
isExcluded,
|
||||
isSmallScreen,
|
||||
colorImpairedMode,
|
||||
id,
|
||||
@ -167,7 +167,7 @@ class AddNewMovieSearchResult extends Component {
|
||||
}
|
||||
|
||||
{
|
||||
isExclusionMovie &&
|
||||
isExcluded &&
|
||||
<Icon
|
||||
className={styles.exclusionIcon}
|
||||
name={icons.DANGER}
|
||||
@ -335,7 +335,7 @@ AddNewMovieSearchResult.propTypes = {
|
||||
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
existingMovieId: PropTypes.number,
|
||||
isExistingMovie: PropTypes.bool.isRequired,
|
||||
isExclusionMovie: PropTypes.bool.isRequired,
|
||||
isExcluded: PropTypes.bool,
|
||||
isSmallScreen: PropTypes.bool.isRequired,
|
||||
id: PropTypes.number,
|
||||
monitored: PropTypes.bool.isRequired,
|
||||
@ -349,7 +349,8 @@ AddNewMovieSearchResult.propTypes = {
|
||||
};
|
||||
|
||||
AddNewMovieSearchResult.defaultProps = {
|
||||
genres: []
|
||||
genres: [],
|
||||
isExcluded: false
|
||||
};
|
||||
|
||||
export default AddNewMovieSearchResult;
|
||||
|
@ -1,27 +1,24 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||
import createExclusionMovieSelector from 'Store/Selectors/createExclusionMovieSelector';
|
||||
import createExistingMovieSelector from 'Store/Selectors/createExistingMovieSelector';
|
||||
import AddNewMovieSearchResult from './AddNewMovieSearchResult';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
createExistingMovieSelector(),
|
||||
createExclusionMovieSelector(),
|
||||
createDimensionsSelector(),
|
||||
(state) => state.queue.details.items,
|
||||
(state) => state.movieFiles.items,
|
||||
(state, { internalId }) => internalId,
|
||||
(state) => state.settings.ui.item.movieRuntimeFormat,
|
||||
(isExistingMovie, isExclusionMovie, dimensions, queueItems, movieFiles, internalId, movieRuntimeFormat) => {
|
||||
(isExistingMovie, dimensions, queueItems, movieFiles, internalId, movieRuntimeFormat) => {
|
||||
const queueItem = queueItems.find((item) => internalId > 0 && item.movieId === internalId);
|
||||
const movieFile = movieFiles.find((item) => internalId > 0 && item.movieId === internalId);
|
||||
|
||||
return {
|
||||
existingMovieId: internalId,
|
||||
isExistingMovie,
|
||||
isExclusionMovie,
|
||||
isSmallScreen: dimensions.isSmallScreen,
|
||||
queueItem,
|
||||
movieFile,
|
||||
|
@ -7,7 +7,6 @@ import withScrollPosition from 'Components/withScrollPosition';
|
||||
import { executeCommand } from 'Store/Actions/commandActions';
|
||||
import { addImportListExclusions, addMovies, clearAddMovie, fetchDiscoverMovies, setListMovieFilter, setListMovieSort, setListMovieTableOption, setListMovieView } from 'Store/Actions/discoverMovieActions';
|
||||
import { fetchRootFolders } from 'Store/Actions/rootFolderActions';
|
||||
import { fetchImportListExclusions } from 'Store/Actions/Settings/importListExclusions';
|
||||
import scrollPositions from 'Store/scrollPositions';
|
||||
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
||||
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||
@ -43,10 +42,6 @@ function createMapDispatchToProps(dispatch, props) {
|
||||
dispatch(fetchRootFolders());
|
||||
},
|
||||
|
||||
dispatchFetchImportListExclusions() {
|
||||
dispatch(fetchImportListExclusions());
|
||||
},
|
||||
|
||||
dispatchClearListMovie() {
|
||||
dispatch(clearAddMovie());
|
||||
},
|
||||
@ -96,7 +91,6 @@ class DiscoverMovieConnector extends Component {
|
||||
componentDidMount() {
|
||||
registerPagePopulator(this.repopulate);
|
||||
this.props.dispatchFetchRootFolders();
|
||||
this.props.dispatchFetchImportListExclusions();
|
||||
this.props.dispatchFetchListMovies();
|
||||
}
|
||||
|
||||
@ -144,7 +138,6 @@ class DiscoverMovieConnector extends Component {
|
||||
DiscoverMovieConnector.propTypes = {
|
||||
isSmallScreen: PropTypes.bool.isRequired,
|
||||
view: PropTypes.string.isRequired,
|
||||
dispatchFetchImportListExclusions: PropTypes.func.isRequired,
|
||||
dispatchFetchRootFolders: PropTypes.func.isRequired,
|
||||
dispatchFetchListMovies: PropTypes.func.isRequired,
|
||||
dispatchClearListMovie: PropTypes.func.isRequired,
|
||||
|
@ -1,14 +0,0 @@
|
||||
import _ from 'lodash';
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
function createExclusionMovieSelector() {
|
||||
return createSelector(
|
||||
(state, { tmdbId }) => tmdbId,
|
||||
(state) => state.settings.importListExclusions,
|
||||
(tmdbId, importListExclusions) => {
|
||||
return _.some(importListExclusions.items, { tmdbId });
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export default createExclusionMovieSelector;
|
@ -3,6 +3,7 @@
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.ImportLists.ImportExclusions;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
@ -22,13 +23,15 @@ public class MovieLookupController : RestController<MovieResource>
|
||||
private readonly INamingConfigService _namingService;
|
||||
private readonly IMapCoversToLocal _coverMapper;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IImportListExclusionService _importListExclusionService;
|
||||
|
||||
public MovieLookupController(ISearchForNewMovie searchProxy,
|
||||
IProvideMovieInfo movieInfo,
|
||||
IBuildFileNames fileNameBuilder,
|
||||
INamingConfigService namingService,
|
||||
IMapCoversToLocal coverMapper,
|
||||
IConfigService configService)
|
||||
IConfigService configService,
|
||||
IImportListExclusionService importListExclusionService)
|
||||
{
|
||||
_movieInfo = movieInfo;
|
||||
_searchProxy = searchProxy;
|
||||
@ -36,6 +39,7 @@ public MovieLookupController(ISearchForNewMovie searchProxy,
|
||||
_namingService = namingService;
|
||||
_coverMapper = coverMapper;
|
||||
_configService = configService;
|
||||
_importListExclusionService = importListExclusionService;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
@ -82,6 +86,8 @@ private IEnumerable<MovieResource> MapToResource(IEnumerable<Movie> movies)
|
||||
var availDelay = _configService.AvailabilityDelay;
|
||||
var namingConfig = _namingService.GetConfig();
|
||||
|
||||
var listExclusions = _importListExclusionService.All();
|
||||
|
||||
foreach (var currentMovie in movies)
|
||||
{
|
||||
var translation = currentMovie.MovieMetadata.Value.Translations.FirstOrDefault(t => t.Language == movieInfoLanguage);
|
||||
@ -97,6 +103,8 @@ private IEnumerable<MovieResource> MapToResource(IEnumerable<Movie> movies)
|
||||
|
||||
resource.Folder = _fileNameBuilder.GetMovieFolder(currentMovie, namingConfig);
|
||||
|
||||
resource.IsExcluded = listExclusions.Any(e => e.TmdbId == resource.TmdbId);
|
||||
|
||||
yield return resource;
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,11 @@ public MovieResource()
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
[SwaggerIgnore]
|
||||
public bool Grabbed { get; set; }
|
||||
|
||||
// Hiding this so people don't think its usable (only used for searches)
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
[SwaggerIgnore]
|
||||
public bool IsExcluded { get; set; }
|
||||
}
|
||||
|
||||
public static class MovieResourceMapper
|
||||
|
Loading…
Reference in New Issue
Block a user