1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

renamed report rejection reason.

This commit is contained in:
kay.one 2013-03-06 12:30:53 -08:00
parent 28efb7c4ec
commit db37d020f4
25 changed files with 63 additions and 81 deletions

View File

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

View File

@ -113,49 +113,49 @@ private void WithLanguageNotWanted()
[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 @@ public void should_not_be_allowed_if_none_of_conditions_are_met()
WithProfileNotAllowed();
WithOverRetention();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.QualityNotWanted);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.QualityNotWanted);
}
[Test]
@ -174,7 +174,7 @@ public void should_not_be_allowed_if_language_is_not_wanted()
{
WithLanguageNotWanted();
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionType.LanguageNotWanted);
spec.IsSatisfiedBy(parseResult).Should().Be(ReportRejectionReasons.LanguageNotWanted);
}
}
}

View File

@ -5,6 +5,7 @@
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 @@ public void SeasonSearch_partial_season_success()
{
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();

View File

@ -5,6 +5,7 @@
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 @@ public void should_return_WrongEpisode_is_parseResult_doesnt_have_airdate()
.CheckReport(_series, new {Episode = _episode}, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongEpisode);
.Be(ReportRejectionReasons.WrongEpisode);
}
[Test]
@ -68,7 +69,7 @@ public void should_return_WrongEpisode_is_parseResult_airdate_doesnt_match_episo
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongEpisode);
.Be(ReportRejectionReasons.WrongEpisode);
}
[Test]
@ -78,7 +79,7 @@ public void should_not_return_error_when_airDates_match()
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.None);
.Be(ReportRejectionReasons.None);
}
}
}

View File

@ -5,6 +5,7 @@
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 @@ public void should_return_WrongSeason_when_season_doesnt_match()
.CheckReport(_series, new {Episode = _episode}, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongSeason);
.Be(ReportRejectionReasons.WrongSeason);
}
[Test]
@ -69,7 +70,7 @@ public void should_return_WrongEpisode_when_episode_doesnt_match()
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongEpisode);
.Be(ReportRejectionReasons.WrongEpisode);
}
[Test]
@ -79,7 +80,7 @@ public void should_not_return_error_when_season_and_episode_match()
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.None);
.Be(ReportRejectionReasons.None);
}
[Test]
@ -94,7 +95,7 @@ public void should_return_WrongSeason_when_season_doesnt_match_for_scene_series(
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongSeason);
.Be(ReportRejectionReasons.WrongSeason);
}
[Test]
@ -109,7 +110,7 @@ public void should_return_WrongEpisode_when_episode_doesnt_match_for_scene_serie
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.WrongEpisode);
.Be(ReportRejectionReasons.WrongEpisode);
}
[Test]
@ -125,7 +126,7 @@ public void should_not_return_error_when_season_and_episode_match_for_scene_seri
.CheckReport(_series, new { Episode = _episode }, _episodeParseResult, _searchHistoryItem)
.SearchError
.Should()
.Be(ReportRejectionType.None);
.Be(ReportRejectionReasons.None);
}
}
}

View File

@ -5,6 +5,7 @@
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 @@ public void should_return_wrongSeason_when_season_does_not_match()
{
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 @@ public void should_not_return_error_when_season_matches()
{
Mocker.Resolve<PartialSeasonSearch>()
.CheckReport(_series, new { SeasonNumber = 1, Episodes = _episodes }, _episodeParseResult, _searchHistoryItem)
.SearchError.Should().Be(ReportRejectionType.None);
.SearchError.Should().Be(ReportRejectionReasons.None);
}
}
}

View File

@ -93,14 +93,14 @@ private void WithQualityNeeded()
{
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 @@ public void should_process_higher_quality_results_first()
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 @@ public void should_process_newer_reports_first()
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 @@ public void should_return_valid_successes_when_one_or_more_downloaded()
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);

View File

@ -37,19 +37,19 @@ public AllowedDownloadSpecification()
{
}
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;
}
}
}

View File

@ -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,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -77,7 +77,7 @@ public void Start(ProgressNotification notification, dynamic options)
try
{
if (_isMonitoredEpisodeSpecification.IsSatisfiedBy(episodeParseResult) &&
_allowedDownloadSpecification.IsSatisfiedBy(episodeParseResult) == ReportRejectionType.None &&
_allowedDownloadSpecification.IsSatisfiedBy(episodeParseResult) == ReportRejectionReasons.None &&
_upgradeHistorySpecification.IsSatisfiedBy(episodeParseResult))
{
_downloadProvider.DownloadReport(episodeParseResult);

View File

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

View File

@ -67,7 +67,7 @@ public override SearchHistoryItem CheckReport(Series series, dynamic options, Ep
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;
}

View File

@ -83,7 +83,7 @@ public override SearchHistoryItem CheckReport(Series series, dynamic options, Ep
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 @@ public override SearchHistoryItem CheckReport(Series series, dynamic options, Ep
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 @@ public override SearchHistoryItem CheckReport(Series series, dynamic options, Ep
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 @@ public override SearchHistoryItem CheckReport(Series series, dynamic options, Ep
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;
}

View File

@ -87,7 +87,7 @@ public override SearchHistoryItem CheckReport(Series series, dynamic options, Ep
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;
}

View File

@ -107,7 +107,7 @@ public virtual SearchHistory ProcessReports(Series series, dynamic options, List
if(episodeParseResult.Series == null || ((ModelBase)episodeParseResult.Series).Id != series.Id)
{
item.SearchError = ReportRejectionType.WrongSeries;
item.SearchError = ReportRejectionReasons.WrongSeries;
continue;
}
@ -115,17 +115,17 @@ public virtual SearchHistory ProcessReports(Series series, dynamic options, List
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 @@ public virtual Boolean DownloadReport(ProgressNotification notification, Episode
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;

View File

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

View File

@ -1,4 +1,5 @@
using System;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Model;
using NzbDrone.Core.Qualities;
@ -14,7 +15,7 @@ public class SearchHistoryItem
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; }

View File

@ -116,7 +116,7 @@ public virtual Dictionary<string, ulong> FreeSpaceOnDrives()
}
catch (Exception ex)
{
Logger.WarnException("Error getting fromm space for: " + pathRoot, ex);
Logger.WarnException("Error getting disk space for: " + pathRoot, ex);
}
}
}

View File

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

View File

@ -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 @@ public class Episode : ModelBase
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]