当前位置: 首页>>代码示例>>C#>>正文


C# Model.EpisodeParseResult类代码示例

本文整理汇总了C#中NzbDrone.Core.Model.EpisodeParseResult的典型用法代码示例。如果您正苦于以下问题:C# EpisodeParseResult类的具体用法?C# EpisodeParseResult怎么用?C# EpisodeParseResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EpisodeParseResult类属于NzbDrone.Core.Model命名空间,在下文中一共展示了EpisodeParseResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsSatisfiedBy

        public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
        {
            var series = _seriesProvider.FindSeries(subject.CleanTitle);

            if (series == null)
            {
                logger.Trace("{0} is not mapped to any series in DB. skipping", subject.CleanTitle);
                return false;
            }

            subject.Series = series;

            if (!series.Monitored)
            {
                logger.Debug("{0} is present in the DB but not tracked. skipping.", subject.CleanTitle);
                return false;
            }

            var episodes = _episodeProvider.GetEpisodesByParseResult(subject);

            //return monitored if any of the episodes are monitored
            if (episodes.Any(episode => !episode.Ignored))
            {
                return true;
            }

            logger.Debug("All episodes are ignored. skipping.");
            return false;
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:29,代码来源:MonitoredEpisodeSpecification.cs

示例2: Setup

        public void Setup()
        {
            Mocker.Resolve<QualityUpgradeSpecification>();
            _upgradeDisk = Mocker.Resolve<UpgradeDiskSpecification>();

            firstFile = new EpisodeFile { Quality = QualityTypes.Bluray1080p, Proper = true };
            secondFile = new EpisodeFile { Quality = QualityTypes.Bluray1080p, Proper = true };

            var singleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = null } };
            var doubleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = secondFile }, new Episode { EpisodeFile = null } };

            var fakeSeries = Builder<Series>.CreateNew()
                         .With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p })
                         .Build();

            parseResultMulti = new EpisodeParseResult
            {
                Series = fakeSeries,
                Quality = new QualityModel(QualityTypes.DVD, true),
                EpisodeNumbers = new List<int> { 3, 4 },
                SeasonNumber = 12,
                Episodes = doubleEpisodeList
            };

            parseResultSingle = new EpisodeParseResult
            {
                Series = fakeSeries,
                Quality = new QualityModel(QualityTypes.DVD, true),
                EpisodeNumbers = new List<int> { 3 },
                SeasonNumber = 12,
                Episodes = singleEpisodeList
            };
        }
开发者ID:Arista2,项目名称:NzbDrone,代码行数:33,代码来源:UpgradeDiskSpecificationFixtrue.cs

示例3: IsInQueue

        public virtual bool IsInQueue(EpisodeParseResult newParseResult)
        {
            try
            {
                var queue = GetQueue().Where(c => c.ParseResult != null);

                var matchigTitle = queue.Where(q => String.Equals(q.ParseResult.CleanTitle, newParseResult.Series.CleanTitle, StringComparison.InvariantCultureIgnoreCase));

                var matchingTitleWithQuality = matchigTitle.Where(q => q.ParseResult.Quality >= newParseResult.Quality);


                if (newParseResult.Series.IsDaily)
                {
                    return matchingTitleWithQuality.Any(q => q.ParseResult.AirDate.Value.Date == newParseResult.AirDate.Value.Date);
                }

                var matchingSeason = matchingTitleWithQuality.Where(q => q.ParseResult.SeasonNumber == newParseResult.SeasonNumber);

                if (newParseResult.FullSeason)
                {
                    return matchingSeason.Any();
                }

                return matchingSeason.Any(q => q.ParseResult.EpisodeNumbers != null && q.ParseResult.EpisodeNumbers.Any(e => newParseResult.EpisodeNumbers.Contains(e)));
            }

            catch (Exception ex)
            {
                logger.WarnException("Unable to connect to Nzbget to check queue.", ex);
                return false;
            }
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:32,代码来源:NzbgetProvider.cs

示例4: DownloadReport

        public virtual bool DownloadReport(EpisodeParseResult parseResult)
        {
            var downloadTitle = GetDownloadTitle(parseResult);

            var provider = GetActiveDownloadClient();

            bool success = provider.DownloadNzb(parseResult.NzbUrl, GetDownloadTitle(parseResult));

            if (success)
            {
                logger.Trace("Download added to Queue: {0}", downloadTitle);


                foreach (var episode in _episodeProvider.GetEpisodesByParseResult(parseResult))
                {
                    var history = new History();
                    history.Date = DateTime.Now;
                    history.Indexer = parseResult.Indexer;
                    history.IsProper = parseResult.Quality.Proper;
                    history.Quality = parseResult.Quality.QualityType;
                    history.NzbTitle = parseResult.OriginalString;
                    history.EpisodeId = episode.EpisodeId;
                    history.SeriesId = episode.SeriesId;

                    _historyProvider.Add(history);
                    _episodeProvider.MarkEpisodeAsFetched(episode.EpisodeId);

                    _signalRProvider.UpdateEpisodeStatus(episode.EpisodeId, EpisodeStatusType.Downloading);
                }

                _externalNotificationProvider.OnGrab(downloadTitle);
            }

            return success;
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:35,代码来源:DownloadProvider.cs

示例5: WithGermanRelease

 private void WithGermanRelease()
 {
     parseResult = Builder<EpisodeParseResult>
             .CreateNew()
             .With(p => p.Language = LanguageType.German)
             .Build();
 }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:7,代码来源:LanguageSpecificationFixture.cs

示例6: Setup

        public void Setup()
        {
            spec = Mocker.Resolve<AllowedDownloadSpecification>();
            parseResult = new EpisodeParseResult();

            Mocker.GetMock<QualityAllowedByProfileSpecification>()
                    .Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
                    .Returns(true);

            Mocker.GetMock<AcceptableSizeSpecification>()
                    .Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
                    .Returns(true);

            Mocker.GetMock<UpgradeDiskSpecification>()
                    .Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
                    .Returns(true);

            Mocker.GetMock<AlreadyInQueueSpecification>()
                    .Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
                    .Returns(false);

            Mocker.GetMock<RetentionSpecification>()
                    .Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
                    .Returns(true);
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:25,代码来源:AllowedDownloadSpecificationFixture.cs

示例7: WithEnglishRelease

 private void WithEnglishRelease()
 {
     parseResult = Builder<EpisodeParseResult>
             .CreateNew()
             .With(p => p.Language = LanguageType.English)
             .Build();
 }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:7,代码来源:LanguageSpecificationFixture.cs

示例8: Setup

        public void Setup()
        {
            _customStartDateSpecification = Mocker.Resolve<CustomStartDateSpecification>();

            firstEpisode = new Episode { AirDate = DateTime.Today };
            secondEpisode = new Episode { AirDate = DateTime.Today };

            fakeSeries = Builder<Series>.CreateNew()
                .With(c => c.Monitored = true)
                .With(c => c.CustomStartDate = null)
                .Build();

            parseResultMulti = new EpisodeParseResult
            {
                SeriesTitle = "Title",
                Series = fakeSeries,
                EpisodeNumbers = new List<int> { 3, 4 },
                SeasonNumber = 12,
                Episodes = new List<Episode> { firstEpisode, secondEpisode }
            };

            parseResultSingle = new EpisodeParseResult
            {
                SeriesTitle = "Title",
                Series = fakeSeries,
                EpisodeNumbers = new List<int> { 3 },
                SeasonNumber = 12,
                Episodes = new List<Episode> { firstEpisode }
            };
        }
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:30,代码来源:CustomStartDateSpecificationFixture.cs

示例9: CustomParser

        protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
        {
            if (currentResult != null)
            {
                currentResult.Size = 0;
            }

            return currentResult;
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:9,代码来源:Wombles.cs

示例10: Setup

        public void Setup()
        {
            retentionSpecification = Mocker.Resolve<RetentionSpecification>();

            parseResult = new EpisodeParseResult
            {
                Age = 100
            };
        }
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:9,代码来源:RetentionSpecificationFixture.cs

示例11: CustomParser

        protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
        {
            if (currentResult != null)
            {
                var sizeString = Regex.Match(item.Summary.Text, @"\d+\.\d{1,2} \w{3}", RegexOptions.IgnoreCase).Value;
                currentResult.Size = Parser.GetReportSize(sizeString);
            }

            return currentResult;
        }
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:10,代码来源:NzbsRUs.cs

示例12: IsSatisfiedBy

        public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
        {
            logger.Trace("Checking if report meets quality requirements. {0}", subject.Quality);
            if (!subject.Series.QualityProfile.Allowed.Contains(subject.Quality.Quality))
            {
                logger.Trace("Quality {0} rejected by Series' quality profile", subject.Quality);
                return false;
            }

            return true;
        }
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:11,代码来源:QualityAllowedByProfileSpecification.cs

示例13: IsSatisfiedBy

        public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
        {
            logger.Trace("Checking if report meets language requirements. {0}", subject.Language);
            if (subject.Language != LanguageType.English)
            {
                logger.Trace("Report Language: {0} rejected because it is not english", subject.Language);
                return false;
            }

            return true;
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:11,代码来源:LanguageSpecification.cs

示例14: IsSatisfiedBy

        public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
        {
            foreach (var file in _episodeProvider.GetEpisodesByParseResult(subject).Select(c => c.EpisodeFile).Where(c => c != null))
            {
                logger.Trace("Comparing file quality with report. Existing file is {0} proper:{1}", file.Quality, file.Proper);
                if (!_qualityUpgradeSpecification.IsSatisfiedBy(new Quality { QualityType = file.Quality, Proper = file.Proper }, subject.Quality, subject.Series.QualityProfile.Cutoff))
                    return false;
            }

            return true;
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:11,代码来源:UpgradeDiskSpecification.cs

示例15: IsSatisfiedBy

        public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
        {
            logger.Trace("Checking if report meets retention requirements. {0}", subject.Age);
            if (_configProvider.Retention > 0 && subject.Age > _configProvider.Retention)
            {
                logger.Trace("Quality {0} rejected by user's retention limit", subject.Age);
                return false;
            }

            return true;
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:11,代码来源:RetentionSpecification.cs


注:本文中的NzbDrone.Core.Model.EpisodeParseResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。