public void Execute(SeasonSearchCommand message) { var decisions = _releaseSearchService.SeasonSearch(message.SeriesId, message.SeasonNumber, false, true, message.Trigger == CommandTrigger.Manual, false); var processed = _processDownloadDecisions.ProcessDecisions(decisions); _logger.ProgressInfo("Season search completed. {0} reports downloaded.", processed.Grabbed.Count); }
private void SearchForEpisodes(List <Episode> episodes, bool monitoredOnly, bool userInvokedSearch) { _logger.ProgressInfo("Performing search for {0} episodes", episodes.Count); var downloadedCount = 0; foreach (var series in episodes.GroupBy(e => e.SeriesId)) { foreach (var season in series.Select(e => e).GroupBy(e => e.SeasonNumber)) { List <DownloadDecision> decisions; if (season.Count() > 1) { try { decisions = _releaseSearchService.SeasonSearch(series.Key, season.Key, season.ToList(), monitoredOnly, userInvokedSearch, false); } catch (Exception ex) { _logger.Error(ex, "Unable to search for episodes in season {0} of [{1}]", season.Key, series.Key); continue; } } else { try { decisions = _releaseSearchService.EpisodeSearch(season.First(), userInvokedSearch, false); } catch (Exception ex) { _logger.Error(ex, "Unable to search for episode: [{0}]", season.First()); continue; } } var processed = _processDownloadDecisions.ProcessDecisions(decisions); downloadedCount += processed.Grabbed.Count; } } _logger.ProgressInfo("Completed search for {0} episodes. {1} reports downloaded.", episodes.Count, downloadedCount); }
private List <ReleaseResource> GetSeasonReleases(int seriesId, int seasonNumber) { try { var decisions = _releaseSearchService.SeasonSearch(seriesId, seasonNumber, false, false, true, true); var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions); return(MapDecisions(prioritizedDecisions)); } catch (SearchFailedException ex) { throw new NzbDroneClientException(HttpStatusCode.BadRequest, ex.Message); } catch (Exception ex) { _logger.Error(ex, "Season search failed: " + ex.Message); throw new NzbDroneClientException(HttpStatusCode.InternalServerError, ex.Message); } }
public void Execute(SeriesSearchCommand message) { var series = _seriesService.GetSeries(message.SeriesId); var downloadedCount = 0; foreach (var season in series.Seasons.OrderBy(s => s.SeasonNumber)) { if (!season.Monitored) { _logger.Debug("Season {0} of {1} is not monitored, skipping search", season.SeasonNumber, series.Title); continue; } var decisions = _releaseSearchService.SeasonSearch(message.SeriesId, season.SeasonNumber, false, true, message.Trigger == CommandTrigger.Manual, false); downloadedCount += _processDownloadDecisions.ProcessDecisions(decisions).Grabbed.Count; } _logger.ProgressInfo("Series search completed. {0} reports downloaded.", downloadedCount); }