diff --git a/frontend/src/AddMovie/AddNewMovie/AddNewMovieConnector.js b/frontend/src/AddMovie/AddNewMovie/AddNewMovieConnector.js index 8e50ce306..448fc1867 100644 --- a/frontend/src/AddMovie/AddNewMovie/AddNewMovieConnector.js +++ b/frontend/src/AddMovie/AddNewMovie/AddNewMovieConnector.js @@ -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, diff --git a/frontend/src/AddMovie/AddNewMovie/AddNewMovieSearchResult.js b/frontend/src/AddMovie/AddNewMovie/AddNewMovieSearchResult.js index f07a55173..df8266688 100644 --- a/frontend/src/AddMovie/AddNewMovie/AddNewMovieSearchResult.js +++ b/frontend/src/AddMovie/AddNewMovie/AddNewMovieSearchResult.js @@ -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 && 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, diff --git a/frontend/src/DiscoverMovie/DiscoverMovieConnector.js b/frontend/src/DiscoverMovie/DiscoverMovieConnector.js index ba4f8cd4e..9441b74b8 100644 --- a/frontend/src/DiscoverMovie/DiscoverMovieConnector.js +++ b/frontend/src/DiscoverMovie/DiscoverMovieConnector.js @@ -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, diff --git a/frontend/src/Store/Selectors/createExclusionMovieSelector.js b/frontend/src/Store/Selectors/createExclusionMovieSelector.js deleted file mode 100644 index 0e5919071..000000000 --- a/frontend/src/Store/Selectors/createExclusionMovieSelector.js +++ /dev/null @@ -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; diff --git a/src/Radarr.Api.V3/Movies/MovieLookupController.cs b/src/Radarr.Api.V3/Movies/MovieLookupController.cs index 079b9ecf5..7b7d11747 100644 --- a/src/Radarr.Api.V3/Movies/MovieLookupController.cs +++ b/src/Radarr.Api.V3/Movies/MovieLookupController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; 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 @@ namespace Radarr.Api.V3.Movies 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 @@ namespace Radarr.Api.V3.Movies _namingService = namingService; _coverMapper = coverMapper; _configService = configService; + _importListExclusionService = importListExclusionService; } [NonAction] @@ -82,6 +86,8 @@ namespace Radarr.Api.V3.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 @@ namespace Radarr.Api.V3.Movies resource.Folder = _fileNameBuilder.GetMovieFolder(currentMovie, namingConfig); + resource.IsExcluded = listExclusions.Any(e => e.TmdbId == resource.TmdbId); + yield return resource; } } diff --git a/src/Radarr.Api.V3/Movies/MovieResource.cs b/src/Radarr.Api.V3/Movies/MovieResource.cs index 14b983bab..71594a74e 100644 --- a/src/Radarr.Api.V3/Movies/MovieResource.cs +++ b/src/Radarr.Api.V3/Movies/MovieResource.cs @@ -88,6 +88,11 @@ namespace Radarr.Api.V3.Movies [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