示例#1
0
        private Response ProcessRelease(ReleaseResource release)
        {
            _logger.Info("Release pushed: {0} - {1}", release.Title, release.DownloadUrl);

            var info = release.InjectTo<ReleaseInfo>();
            info.Guid = "PUSH-" + info.DownloadUrl;

            var decisions = _downloadDecisionMaker.GetRssDecision(new List<ReleaseInfo> { info });
            var processed = _downloadDecisionProcessor.ProcessDecisions(decisions);

            return MapDecisions(decisions).First().AsResponse();
        }
示例#2
0
        private bool BeValidRelease(ReleaseResource releaseResource)
        {
            releaseResource.Age.Should().BeGreaterOrEqualTo(-1);
            releaseResource.Title.Should().NotBeBlank();
            releaseResource.DownloadUrl.Should().NotBeBlank();
            releaseResource.SeriesTitle.Should().NotBeBlank();
            //TODO: uncomment these after moving to restsharp for rss
            //releaseResource.NzbInfoUrl.Should().NotBeBlank();
            //releaseResource.Size.Should().BeGreaterThan(0);

            return true;
        }
示例#3
0
        private Response DownloadRelease(ReleaseResource release)
        {
            var remoteEpisode = _remoteEpisodeCache.Find(release.Guid);

            if (remoteEpisode == null)
            {
                _logger.Debug("Couldn't find requested release in cache, cache timeout probably expired.");

                return new NotFoundResponse();
            }

            try
            {
                _downloadService.DownloadReport(remoteEpisode);
            }
            catch (ReleaseDownloadException ex)
            {
                _logger.ErrorException(ex.Message, ex);
                throw new NzbDroneClientException(HttpStatusCode.Conflict, "Getting release from indexer failed");
            }

            return release.AsResponse();
        }
示例#4
0
 private string GetCacheKey(ReleaseResource resource)
 {
     return(string.Concat(resource.IndexerId, "_", resource.Guid));
 }