diff --git a/src/NzbDrone.Core/Download/RedownloadFailedDownloadService.cs b/src/NzbDrone.Core/Download/RedownloadFailedDownloadService.cs index 0e5b3a13a..f49f3772e 100644 --- a/src/NzbDrone.Core/Download/RedownloadFailedDownloadService.cs +++ b/src/NzbDrone.Core/Download/RedownloadFailedDownloadService.cs @@ -5,6 +5,7 @@ using NzbDrone.Core.IndexerSearch; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Tv; +using System.Collections.Generic; namespace NzbDrone.Core.Download { @@ -38,7 +39,7 @@ namespace NzbDrone.Core.Download { _logger.Debug("Failed download contains a movie, searching again."); - _commandQueueManager.Push(new MoviesSearchCommand { MovieId = message.MovieId }); + _commandQueueManager.Push(new MoviesSearchCommand { MovieIds = new List { message.MovieId } }); return; } diff --git a/src/NzbDrone.Core/IndexerSearch/MissingMoviesSearchCommand.cs b/src/NzbDrone.Core/IndexerSearch/MissingMoviesSearchCommand.cs new file mode 100644 index 000000000..7c53532c3 --- /dev/null +++ b/src/NzbDrone.Core/IndexerSearch/MissingMoviesSearchCommand.cs @@ -0,0 +1,13 @@ +using NzbDrone.Core.Messaging.Commands; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NzbDrone.Core.IndexerSearch +{ + public class MissingMoviesSearchCommand : Command + { + public override bool SendUpdatesToClient => true; + } +} diff --git a/src/NzbDrone.Core/IndexerSearch/MoviesSearchCommand.cs b/src/NzbDrone.Core/IndexerSearch/MoviesSearchCommand.cs index da0b9a8c1..214c59d6b 100644 --- a/src/NzbDrone.Core/IndexerSearch/MoviesSearchCommand.cs +++ b/src/NzbDrone.Core/IndexerSearch/MoviesSearchCommand.cs @@ -1,10 +1,11 @@ using NzbDrone.Core.Messaging.Commands; +using System.Collections.Generic; namespace NzbDrone.Core.IndexerSearch { public class MoviesSearchCommand : Command { - public int MovieId { get; set; } + public List MovieIds { get; set; } public override bool SendUpdatesToClient => true; } diff --git a/src/NzbDrone.Core/IndexerSearch/MoviesSearchService.cs b/src/NzbDrone.Core/IndexerSearch/MoviesSearchService.cs index 656423178..5b8e4dd37 100644 --- a/src/NzbDrone.Core/IndexerSearch/MoviesSearchService.cs +++ b/src/NzbDrone.Core/IndexerSearch/MoviesSearchService.cs @@ -4,22 +4,23 @@ using NzbDrone.Common.Instrumentation.Extensions; using NzbDrone.Core.Download; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Tv; +using NzbDrone.Core.Datastore; namespace NzbDrone.Core.IndexerSearch { - public class MovieSearchService : IExecute + public class MovieSearchService : IExecute, IExecute { - private readonly IMovieService _seriesService; + private readonly IMovieService _movieService; private readonly ISearchForNzb _nzbSearchService; private readonly IProcessDownloadDecisions _processDownloadDecisions; private readonly Logger _logger; - public MovieSearchService(IMovieService seriesService, + public MovieSearchService(IMovieService movieService, ISearchForNzb nzbSearchService, IProcessDownloadDecisions processDownloadDecisions, Logger logger) { - _seriesService = seriesService; + _movieService = movieService; _nzbSearchService = nzbSearchService; _processDownloadDecisions = processDownloadDecisions; _logger = logger; @@ -27,20 +28,35 @@ namespace NzbDrone.Core.IndexerSearch public void Execute(MoviesSearchCommand message) { - var series = _seriesService.GetMovie(message.MovieId); - var downloadedCount = 0; - + foreach (var movieId in message.MovieIds) + { + var series = _movieService.GetMovie(movieId); + if (!series.Monitored) { _logger.Debug("Movie {0} is not monitored, skipping search", series.Title); } - var decisions = _nzbSearchService.MovieSearch(message.MovieId, false);//_nzbSearchService.SeasonSearch(message.MovieId, season.SeasonNumber, false, message.Trigger == CommandTrigger.Manual); + var decisions = _nzbSearchService.MovieSearch(movieId, false);//_nzbSearchService.SeasonSearch(message.MovieId, season.SeasonNumber, false, message.Trigger == CommandTrigger.Manual); downloadedCount += _processDownloadDecisions.ProcessDecisions(decisions).Grabbed.Count; - + } _logger.ProgressInfo("Movie search completed. {0} reports downloaded.", downloadedCount); } + + public void Execute(MissingMoviesSearchCommand message) + { + var movies = _movieService.MoviesWithoutFiles(new PagingSpec + { + Page = 1, + PageSize = 100000, + SortDirection = SortDirection.Ascending, + SortKey = "Id", + FilterExpression = + v => + v.Monitored == true + }).Records.ToList(); + } } } diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 1db0a9581..6f7eee5c0 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -583,6 +583,7 @@ + diff --git a/src/NzbDrone.Core/Tv/MovieScannedHandler.cs b/src/NzbDrone.Core/Tv/MovieScannedHandler.cs index 151ef0559..2eba01239 100644 --- a/src/NzbDrone.Core/Tv/MovieScannedHandler.cs +++ b/src/NzbDrone.Core/Tv/MovieScannedHandler.cs @@ -3,6 +3,7 @@ using NzbDrone.Core.IndexerSearch; using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Events; +using System.Collections.Generic; namespace NzbDrone.Core.Tv { @@ -37,7 +38,7 @@ namespace NzbDrone.Core.Tv if (movie.AddOptions.SearchForMovie) { - _commandQueueManager.Push(new MoviesSearchCommand { MovieId = movie.Id}); + _commandQueueManager.Push(new MoviesSearchCommand { MovieIds = new List { movie.Id } }); } movie.AddOptions = null; diff --git a/src/UI/Config.js b/src/UI/Config.js index 2115d076a..c2a64db58 100644 --- a/src/UI/Config.js +++ b/src/UI/Config.js @@ -7,12 +7,12 @@ module.exports = { }, Keys : { - DefaultProfileId : 'DefaultProfileId', - DefaultRootFolderId : 'DefaultRootFolderId', - UseSeasonFolder : 'UseSeasonFolder', - DefaultSeriesType : 'DefaultSeriesType', - MonitorEpisodes : 'MonitorEpisodes', - AdvancedSettings : 'advancedSettings' + DefaultProfileId : 'RadarrDefaultProfileId', + DefaultRootFolderId : 'RadarrDefaultRootFolderId', + UseSeasonFolder : 'RadarrUseSeasonFolder', + DefaultSeriesType : 'RadarrDefaultSeriesType', + MonitorEpisodes : 'RadarrMonitorEpisodes', + AdvancedSettings : 'RadarradvancedSettings' }, getValueJson : function (key, defaultValue) { @@ -48,7 +48,6 @@ module.exports = { }, setValue : function(key, value) { - console.log('Config: [{0}] => [{1}]'.format(key, value)); if (this.getValue(key) === value.toString()) { diff --git a/src/UI/Movies/Details/MoviesDetailsLayout.js b/src/UI/Movies/Details/MoviesDetailsLayout.js index 119c6bd71..77f710890 100644 --- a/src/UI/Movies/Details/MoviesDetailsLayout.js +++ b/src/UI/Movies/Details/MoviesDetailsLayout.js @@ -209,7 +209,7 @@ module.exports = Marionette.Layout.extend({ _moviesSearch : function() { CommandController.Execute('moviesSearch', { name : 'moviesSearch', - movieId : this.model.id + movieIds : [this.model.id] }); }, diff --git a/src/UI/Movies/Index/MoviesIndexLayout.js b/src/UI/Movies/Index/MoviesIndexLayout.js index 87a2de772..479c6df12 100644 --- a/src/UI/Movies/Index/MoviesIndexLayout.js +++ b/src/UI/Movies/Index/MoviesIndexLayout.js @@ -182,6 +182,27 @@ module.exports = Marionette.Layout.extend({ tooltip : 'Missing Only', icon : 'icon-sonarr-missing', callback : this._setFilter + }, + { + key : 'released', + title : '', + tooltip : 'Released', + icon : 'icon-sonarr-movie-released', + callback : this._setFilter + }, + { + key : 'announced', + title : '', + tooltip : 'Announced', + icon : 'icon-sonarr-movie-announced', + callback : this._setFilter + }, + { + key : 'cinemas', + title : '', + tooltip : 'In Cinemas', + icon : 'icon-sonarr-movie-cinemas', + callback : this._setFilter } ] }; diff --git a/src/UI/Movies/MoviesCollection.js b/src/UI/Movies/MoviesCollection.js index 193f47ef6..f2c53d80d 100644 --- a/src/UI/Movies/MoviesCollection.js +++ b/src/UI/Movies/MoviesCollection.js @@ -67,6 +67,21 @@ var Collection = PageableCollection.extend({ 'missing' : [ 'downloaded', false + ], + 'released' : [ + null, + null, + function(model) { return model.getStatus() == "released"; } + ], + 'announced' : [ + null, + null, + function(model) { return model.getStatus() == "announced"; } + ], + 'cinemas' : [ + null, + null, + function(model) { return model.getStatus() == "inCinemas"; } ] }, diff --git a/src/UI/Settings/DownloadClient/DroneFactory/DroneFactoryViewTemplate.hbs b/src/UI/Settings/DownloadClient/DroneFactory/DroneFactoryViewTemplate.hbs index a10f5d234..9043ad2f5 100644 --- a/src/UI/Settings/DownloadClient/DroneFactory/DroneFactoryViewTemplate.hbs +++ b/src/UI/Settings/DownloadClient/DroneFactory/DroneFactoryViewTemplate.hbs @@ -23,7 +23,7 @@
- +
\ No newline at end of file diff --git a/src/UI/Wanted/Missing/MissingLayout.js b/src/UI/Wanted/Missing/MissingLayout.js index b3aa9e378..1a7e6711f 100644 --- a/src/UI/Wanted/Missing/MissingLayout.js +++ b/src/UI/Wanted/Missing/MissingLayout.js @@ -165,11 +165,11 @@ module.exports = Marionette.Layout.extend({ })); CommandController.bindToCommand({ element : this.$('.x-search-selected'), - command : { name : 'episodeSearch' } + command : { name : 'moviesSearch' } }); CommandController.bindToCommand({ element : this.$('.x-search-missing'), - command : { name : 'missingEpisodeSearch' } + command : { name : 'missingMoviesSearch' } }); }, @@ -187,20 +187,20 @@ module.exports = Marionette.Layout.extend({ if (selected.length === 0) { Messenger.show({ type : 'error', - message : 'No episodes selected' + message : 'No movies selected' }); return; } var ids = _.pluck(selected, 'id'); - CommandController.Execute('episodeSearch', { - name : 'episodeSearch', - episodeIds : ids + CommandController.Execute('moviesSearch', { + name : 'moviesSearch', + movieIds : ids }); }, _searchMissing : function() { if (window.confirm('Are you sure you want to search for {0} missing movies? '.format(this.collection.state.totalRecords) + 'One API request to each indexer will be used for each movie. ' + 'This cannot be stopped once started.')) { - CommandController.Execute('missingEpisodeSearch', { name : 'missingEpisodeSearch' }); + CommandController.Execute('missingMoviesSearch', { name : 'missingMoviesSearch' }); } }, _toggleMonitoredOfSelected : function() { @@ -209,7 +209,7 @@ module.exports = Marionette.Layout.extend({ if (selected.length === 0) { Messenger.show({ type : 'error', - message : 'No episodes selected' + message : 'No movies selected' }); return; }