renamed report rejection reason.

pull/4/head
kay.one 12 years ago
parent 28efb7c4ec
commit db37d020f4

@ -1,4 +1,4 @@
'use strict';
'use strict';
define(['app', 'Series/SeriesModel'], function () {

@ -113,49 +113,49 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_be_allowed_if_all_conditions_are_met()
{
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.None);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.None);
}
[Test]
public void should_not_be_allowed_if_profile_is_not_allowed()
{
WithProfileNotAllowed();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.QualityNotWanted);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.QualityNotWanted);
}
[Test]
public void should_not_be_allowed_if_size_is_not_allowed()
{
WithNotAcceptableSize();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.Size);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.Size);
}
[Test]
public void should_not_be_allowed_if_disk_is_not_upgrade()
{
WithNoDiskUpgrade();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.ExistingQualityIsEqualOrBetter);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.ExistingQualityIsEqualOrBetter);
}
[Test]
public void should_not_be_allowed_if_episode_is_already_in_queue()
{
WithEpisodeAlreadyInQueue();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.AlreadyInQueue);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.AlreadyInQueue);
}
[Test]
public void should_not_be_allowed_if_report_is_over_retention()
{
WithOverRetention();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.Retention);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.Retention);
}
[Test]
public void should_not_be_allowed_if_episode_aired_before_cutoff()
{
WithAiredBeforeCustomStartDateCutoff();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.AiredAfterCustomStartDate);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.AiredAfterCustomStartDate);
}
[Test]
@ -166,7 +166,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
WithProfileNotAllowed();
WithOverRetention();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.QualityNotWanted);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.QualityNotWanted);
}
[Test]
@ -174,7 +174,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
WithLanguageNotWanted();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.LanguageNotWanted);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.LanguageNotWanted);
}
}
}

@ -5,6 +5,7 @@ using System.Linq;
using FizzWare.NBuilder;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Jobs.Implementations;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Jobs;
@ -49,7 +50,7 @@ namespace NzbDrone.Core.Test.JobTests
{
var resultItems = Builder<SearchHistoryItem>.CreateListOfSize(5)
.All()
.With(e => e.SearchError = ReportRejectionType.None)
.With(e => e.SearchError = ReportRejectionReasons.None)
.With(e => e.Success = true)
.Build();

@ -5,6 +5,7 @@ using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
@ -56,7 +57,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.DailyEpisodeSearchTests
.CheckReport(_series, new {Episode = _episode}, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongEpisode);
.Be(ReportRejectionReasons.WrongEpisode);
}
[Test]
@ -68,7 +69,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.DailyEpisodeSearchTests
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongEpisode);
.Be(ReportRejectionReasons.WrongEpisode);
}
[Test]
@ -78,7 +79,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.DailyEpisodeSearchTests
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.None);
.Be(ReportRejectionReasons.None);
}
}
}

@ -5,6 +5,7 @@ using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
@ -57,7 +58,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.EpisodeSearchTests
.CheckReport(_series, new {Episode = _episode}, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongSeason);
.Be(ReportRejectionReasons.WrongSeason);
}
[Test]
@ -69,7 +70,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.EpisodeSearchTests
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongEpisode);
.Be(ReportRejectionReasons.WrongEpisode);
}
[Test]
@ -79,7 +80,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.EpisodeSearchTests
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.None);
.Be(ReportRejectionReasons.None);
}
[Test]
@ -94,7 +95,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.EpisodeSearchTests
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongSeason);
.Be(ReportRejectionReasons.WrongSeason);
}
[Test]
@ -109,7 +110,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.EpisodeSearchTests
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongEpisode);
.Be(ReportRejectionReasons.WrongEpisode);
}
[Test]
@ -125,7 +126,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.EpisodeSearchTests
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.None);
.Be(ReportRejectionReasons.None);
}
}
}

@ -5,6 +5,7 @@ using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
@ -52,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.PartialSeasonSearchTests
{
Mocker.Resolve<PartialSeasonSearch>()
.CheckReport(_series, new { SeasonNumber = 2, Episodes = _episodes }, _episodeParseResult, _searchHistoryItem)
.SearchError.Should().Be(ReportRejectionType.WrongSeason);
.SearchError.Should().Be(ReportRejectionReasons.WrongSeason);
}
[Test]
@ -60,7 +61,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.PartialSeasonSearchTests
{
Mocker.Resolve<PartialSeasonSearch>()
.CheckReport(_series, new { SeasonNumber = 1, Episodes = _episodes }, _episodeParseResult, _searchHistoryItem)
.SearchError.Should().Be(ReportRejectionType.None);
.SearchError.Should().Be(ReportRejectionReasons.None);
}
}
}

@ -93,14 +93,14 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
{
Mocker.GetMock<AllowedDownloadSpecification>()
.Setup(s => s.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
.Returns(ReportRejectionType.None);
.Returns(ReportRejectionReasons.None);
}
private void WithQualityNotNeeded()
{
Mocker.GetMock<AllowedDownloadSpecification>()
.Setup(s => s.IsSatisfiedBy(It.IsAny<EpisodeParseResult>()))
.Returns(ReportRejectionType.ExistingQualityIsEqualOrBetter);
.Returns(ReportRejectionReasons.ExistingQualityIsEqualOrBetter);
}
[Test]
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
Mocker.GetMock<AllowedDownloadSpecification>()
.Setup(s => s.IsSatisfiedBy(It.Is<EpisodeParseResult>(d => d.Quality.Quality == Quality.Bluray1080p)))
.Returns(ReportRejectionType.None);
.Returns(ReportRejectionReasons.None);
var result = Mocker.Resolve<TestSearch>().ProcessReports(_matchingSeries, new { }, parseResults, _searchHistory, _notification);
@ -155,7 +155,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
parseResults[2].Age = 100;
Mocker.GetMock<AllowedDownloadSpecification>()
.Setup(s => s.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())).Returns(ReportRejectionType.None);
.Setup(s => s.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())).Returns(ReportRejectionReasons.None);
var result = Mocker.Resolve<TestSearch>().ProcessReports(_matchingSeries, new { }, parseResults, _searchHistory, _notification);
@ -323,7 +323,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
Mocker.GetMock<AllowedDownloadSpecification>()
.Setup(s => s.IsSatisfiedBy(It.Is<EpisodeParseResult>(d => d.Quality.Quality == Quality.Bluray1080p)))
.Returns(ReportRejectionType.None);
.Returns(ReportRejectionReasons.None);
//Act
var result = Mocker.Resolve<TestSearch>().ProcessReports(_matchingSeries, new { }, parseResults, _searchHistory, _notification);

@ -37,19 +37,19 @@ namespace NzbDrone.Core.DecisionEngine
{
}
public virtual ReportRejectionType IsSatisfiedBy(EpisodeParseResult subject)
public virtual ReportRejectionReasons IsSatisfiedBy(EpisodeParseResult subject)
{
if (!_qualityAllowedByProfileSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.QualityNotWanted;
if (!_customStartDateSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.AiredAfterCustomStartDate;
if (!_upgradeDiskSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.ExistingQualityIsEqualOrBetter;
if (!_languageSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.LanguageNotWanted;
if (!_retentionSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.Retention;
if (!_acceptableSizeSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.Size;
if (!_allowedReleaseGroupSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.ReleaseGroupNotWanted;
if (_alreadyInQueueSpecification.IsSatisfiedBy(subject)) return ReportRejectionType.AlreadyInQueue;
if (!_qualityAllowedByProfileSpecification.IsSatisfiedBy(subject)) return ReportRejectionReasons.QualityNotWanted;
if (!_customStartDateSpecification.IsSatisfiedBy(subject)) return ReportRejectionReasons.AiredAfterCustomStartDate;
if (!_upgradeDiskSpecification.IsSatisfiedBy(subject)) return ReportRejectionReasons.ExistingQualityIsEqualOrBetter;
if (!_languageSpecification.IsSatisfiedBy(subject)) return ReportRejectionReasons.LanguageNotWanted;
if (!_retentionSpecification.IsSatisfiedBy(subject)) return ReportRejectionReasons.Retention;
if (!_acceptableSizeSpecification.IsSatisfiedBy(subject)) return ReportRejectionReasons.Size;
if (!_allowedReleaseGroupSpecification.IsSatisfiedBy(subject)) return ReportRejectionReasons.ReleaseGroupNotWanted;
if (_alreadyInQueueSpecification.IsSatisfiedBy(subject)) return ReportRejectionReasons.AlreadyInQueue;
logger.Debug("Episode {0} is needed", subject);
return ReportRejectionType.None;
return ReportRejectionReasons.None;
}
}
}

@ -1,8 +1,6 @@
using System.Linq;
namespace NzbDrone.Core.Model
namespace NzbDrone.Core.DecisionEngine
{
public enum ReportRejectionType
public enum ReportRejectionReasons
{
None = 0,
WrongSeries = 1,

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Download.Clients.Nzbget
{

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Download.Clients.Nzbget
{

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Download.Clients.Nzbget
{

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
namespace NzbDrone.Core.Download.Clients.Nzbget

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
namespace NzbDrone.Core.Download.Clients.Sabnzbd

@ -77,7 +77,7 @@ namespace NzbDrone.Core.Jobs.Implementations
try
{
if (_isMonitoredEpisodeSpecification.IsSatisfiedBy(episodeParseResult) &&
_allowedDownloadSpecification.IsSatisfiedBy(episodeParseResult) == ReportRejectionType.None &&
_allowedDownloadSpecification.IsSatisfiedBy(episodeParseResult) == ReportRejectionReasons.None &&
_upgradeHistorySpecification.IsSatisfiedBy(episodeParseResult))
{
_downloadProvider.DownloadReport(episodeParseResult);

@ -327,7 +327,7 @@
<Compile Include="Qualities\Quality.cs" />
<Compile Include="Repository\Search\SearchHistoryItem.cs" />
<Compile Include="Repository\Search\SearchHistory.cs" />
<Compile Include="Model\ReportRejectionType.cs" />
<Compile Include="DecisionEngine\ReportRejectionReasons.cs" />
<Compile Include="Tv\Season.cs" />
<Compile Include="Providers\AutoConfigureProvider.cs">
<SubType>Code</SubType>

@ -67,7 +67,7 @@ namespace NzbDrone.Core.Providers.Search
if (!episodeParseResult.AirDate.HasValue || episodeParseResult.AirDate.Value != episode.AirDate.Value)
{
logger.Trace("Episode AirDate does not match searched episode number, skipping.");
item.SearchError = ReportRejectionType.WrongEpisode;
item.SearchError = ReportRejectionReasons.WrongEpisode;
return item;
}

@ -83,7 +83,7 @@ namespace NzbDrone.Core.Providers.Search
if (options.Episode.SceneSeasonNumber != episodeParseResult.SeasonNumber)
{
logger.Trace("Season number does not match searched season number, skipping.");
item.SearchError = ReportRejectionType.WrongSeason;
item.SearchError = ReportRejectionReasons.WrongSeason;
return item;
}
@ -91,7 +91,7 @@ namespace NzbDrone.Core.Providers.Search
if (!episodeParseResult.EpisodeNumbers.Contains(options.Episode.SceneEpisodeNumber))
{
logger.Trace("Episode number does not match searched episode number, skipping.");
item.SearchError = ReportRejectionType.WrongEpisode;
item.SearchError = ReportRejectionReasons.WrongEpisode;
return item;
}
@ -102,7 +102,7 @@ namespace NzbDrone.Core.Providers.Search
if(options.Episode.SeasonNumber != episodeParseResult.SeasonNumber)
{
logger.Trace("Season number does not match searched season number, skipping.");
item.SearchError = ReportRejectionType.WrongSeason;
item.SearchError = ReportRejectionReasons.WrongSeason;
return item;
}
@ -110,7 +110,7 @@ namespace NzbDrone.Core.Providers.Search
if (!episodeParseResult.EpisodeNumbers.Contains(options.Episode.EpisodeNumber))
{
logger.Trace("Episode number does not match searched episode number, skipping.");
item.SearchError = ReportRejectionType.WrongEpisode;
item.SearchError = ReportRejectionReasons.WrongEpisode;
return item;
}

@ -87,7 +87,7 @@ namespace NzbDrone.Core.Providers.Search
if(options.SeasonNumber != episodeParseResult.SeasonNumber)
{
logger.Trace("Season number does not match searched season number, skipping.");
item.SearchError = ReportRejectionType.WrongSeason;
item.SearchError = ReportRejectionReasons.WrongSeason;
return item;
}

@ -107,7 +107,7 @@ namespace NzbDrone.Core.Providers.Search
if(episodeParseResult.Series == null || ((ModelBase)episodeParseResult.Series).Id != series.Id)
{
item.SearchError = ReportRejectionType.WrongSeries;
item.SearchError = ReportRejectionReasons.WrongSeries;
continue;
}
@ -115,17 +115,17 @@ namespace NzbDrone.Core.Providers.Search
if (searchResult.Successes.Intersect(episodeParseResult.Episodes.Select(e => e.Id)).Any())
{
item.SearchError = ReportRejectionType.Skipped;
item.SearchError = ReportRejectionReasons.Skipped;
continue;
}
CheckReport(series, options, episodeParseResult, item);
if (item.SearchError != ReportRejectionType.None)
if (item.SearchError != ReportRejectionReasons.None)
continue;
item.SearchError = _allowedDownloadSpecification.IsSatisfiedBy(episodeParseResult);
if(item.SearchError == ReportRejectionType.None)
if(item.SearchError == ReportRejectionReasons.None)
{
if(DownloadReport(notification, episodeParseResult, item))
searchResult.Successes.AddRange(episodeParseResult.Episodes.Select(e => e.Id));
@ -153,13 +153,13 @@ namespace NzbDrone.Core.Providers.Search
return true;
}
item.SearchError = ReportRejectionType.DownloadClientFailure;
item.SearchError = ReportRejectionReasons.DownloadClientFailure;
}
catch (Exception e)
{
logger.ErrorException("Unable to add report to download queue." + episodeParseResult, e);
notification.CurrentMessage = String.Format("Unable to add report to download queue. {0}", episodeParseResult);
item.SearchError = ReportRejectionType.DownloadClientFailure;
item.SearchError = ReportRejectionReasons.DownloadClientFailure;
}
return false;

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Repository.Search

@ -1,4 +1,5 @@
using System;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Model;
using NzbDrone.Core.Qualities;
@ -14,7 +15,7 @@ namespace NzbDrone.Core.Repository.Search
public string NzbUrl { get; set; }
public string NzbInfoUrl { get; set; }
public bool Success { get; set; }
public ReportRejectionType SearchError { get; set; }
public ReportRejectionReasons SearchError { get; set; }
public Quality Quality { get; set; }
public bool Proper { get; set; }
public int Age { get; set; }

@ -116,7 +116,7 @@ namespace NzbDrone.Core.RootFolders
}
catch (Exception ex)
{
Logger.WarnException("Error getting fromm space for: " + pathRoot, ex);
Logger.WarnException("Error getting disk space for: " + pathRoot, ex);
}
}
}

@ -1,8 +1,4 @@
using System.Collections.Generic;
using NzbDrone.Core.Datastore;
using Sqo.Attributes;
namespace NzbDrone.Core.RootFolders
namespace NzbDrone.Core.RootFolders
{
public class UnmappedFolder
{

@ -1,5 +1,4 @@
using System.Linq;
using System;
using System;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Model;
@ -16,7 +15,7 @@ namespace NzbDrone.Core.Tv
public int EpisodeNumber { get; set; }
public string Title { get; set; }
//Todo: Since we're displaying next airing relative to the user's timezone we may want to store this as UTC (with airtime + UTC offset)
//Todo: Since we're displaying next airing relative to the user's time zone we may want to store this as UTC (with airtime + UTC offset)
public DateTime? AirDate { get; set; }
[Text]

Loading…
Cancel
Save