Merged branch develop into develop

Leonardo Galli 8 years ago
commit de5489ae9a

@ -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<int> { message.MovieId } });
return;
}

@ -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;
}
}

@ -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<int> MovieIds { get; set; }
public override bool SendUpdatesToClient => true;
}

@ -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<MoviesSearchCommand>
public class MovieSearchService : IExecute<MoviesSearchCommand>, IExecute<MissingMoviesSearchCommand>
{
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<Movie>
{
Page = 1,
PageSize = 100000,
SortDirection = SortDirection.Ascending,
SortKey = "Id",
FilterExpression =
v =>
v.Monitored == true
}).Records.ToList();
}
}
}

@ -583,6 +583,7 @@
<Compile Include="Http\HttpProxySettingsProvider.cs" />
<Compile Include="Http\TorcacheHttpInterceptor.cs" />
<Compile Include="IndexerSearch\Definitions\MovieSearchCriteria.cs" />
<Compile Include="IndexerSearch\MissingMoviesSearchCommand.cs" />
<Compile Include="IndexerSearch\MoviesSearchCommand.cs" />
<Compile Include="IndexerSearch\MoviesSearchService.cs" />
<Compile Include="Indexers\AwesomeHD\AwesomeHDRssParser.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<int> { movie.Id } });
}
movie.AddOptions = null;

@ -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()) {

@ -209,7 +209,7 @@ module.exports = Marionette.Layout.extend({
_moviesSearch : function() {
CommandController.Execute('moviesSearch', {
name : 'moviesSearch',
movieId : this.model.id
movieIds : [this.model.id]
});
},

@ -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
}
]
};

@ -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"; }
]
},

@ -23,7 +23,7 @@
</div>
<div class="col-sm-2 col-sm-pull-1">
<input type="number" name="downloadedMovieScanInterval" class="form-control" />
<input type="number" name="downloadedEpisodesScanInterval" class="form-control" />
</div>
</div>
</fieldset>

@ -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;
}

Loading…
Cancel
Save