Support music qualities. This is a work in progress, lots of code still references tv series

pull/6/head
8 years ago
parent 89fa71fe96
commit d7ad9b8218

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Test.Blacklisting
{ {
SeriesId = 12345, SeriesId = 12345,
EpisodeIds = new List<int> { 1 }, EpisodeIds = new List<int> { 1 },
Quality = new QualityModel(Quality.Bluray720p), Quality = new QualityModel(Quality.FLAC),
SourceTitle = "series.title.s01e01", SourceTitle = "series.title.s01e01",
Date = DateTime.UtcNow Date = DateTime.UtcNow
}; };

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Test.Blacklisting
{ {
SeriesId = 12345, SeriesId = 12345,
EpisodeIds = new List<int> {1}, EpisodeIds = new List<int> {1},
Quality = new QualityModel(Quality.Bluray720p), Quality = new QualityModel(Quality.MP3320),
SourceTitle = "series.title.s01e01", SourceTitle = "series.title.s01e01",
DownloadClient = "SabnzbdClient", DownloadClient = "SabnzbdClient",
DownloadId = "Sabnzbd_nzo_2dfh73k" DownloadId = "Sabnzbd_nzo_2dfh73k"

@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.Datastore
[Test] [Test]
public void embedded_document_as_json() public void embedded_document_as_json()
{ {
var quality = new QualityModel { Quality = Quality.Bluray720p, Revision = new Revision(version: 2 )}; var quality = new QualityModel { Quality = Quality.MP3320, Revision = new Revision(version: 2 )};
var history = Builder<History.History>.CreateNew() var history = Builder<History.History>.CreateNew()
.With(c => c.Id = 0) .With(c => c.Id = 0)
@ -75,15 +75,15 @@ namespace NzbDrone.Core.Test.Datastore
.All().With(c => c.Id = 0) .All().With(c => c.Id = 0)
.Build().ToList(); .Build().ToList();
history[0].Quality = new QualityModel(Quality.HDTV1080p, new Revision(version: 2)); history[0].Quality = new QualityModel(Quality.MP3512, new Revision(version: 2));
history[1].Quality = new QualityModel(Quality.Bluray720p, new Revision(version: 2)); history[1].Quality = new QualityModel(Quality.MP3320, new Revision(version: 2));
Db.InsertMany(history); Db.InsertMany(history);
var returnedHistory = Db.All<History.History>(); var returnedHistory = Db.All<History.History>();
returnedHistory[0].Quality.Quality.Should().Be(Quality.HDTV1080p); returnedHistory[0].Quality.Quality.Should().Be(Quality.MP3512);
} }
} }
} }

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Test.Datastore
var profile = new Profile var profile = new Profile
{ {
Name = "Test", Name = "Test",
Cutoff = Quality.WEBDL720p, Cutoff = Quality.MP3320,
Items = Qualities.QualityFixture.GetDefaultQualities() Items = Qualities.QualityFixture.GetDefaultQualities()
}; };

@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{ {
Series = series, Series = series,
Release = new ReleaseInfo(), Release = new ReleaseInfo(),
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.SDTV, new Revision(version: 2)) }, ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192, new Revision(version: 2)) },
Episodes = new List<Episode> { new Episode(), new Episode(), new Episode(), new Episode(), new Episode(), new Episode() } Episodes = new List<Episode> { new Episode(), new Episode(), new Episode(), new Episode(), new Episode(), new Episode() }
}; };
@ -40,7 +40,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{ {
Series = series, Series = series,
Release = new ReleaseInfo(), Release = new ReleaseInfo(),
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.SDTV, new Revision(version: 2)) }, ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192, new Revision(version: 2)) },
Episodes = new List<Episode> { new Episode(), new Episode() } Episodes = new List<Episode> { new Episode(), new Episode() }
}; };
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{ {
Series = series, Series = series,
Release = new ReleaseInfo(), Release = new ReleaseInfo(),
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.SDTV, new Revision(version: 2)) }, ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192, new Revision(version: 2)) },
Episodes = new List<Episode> { new Episode() { Id = 2 } } Episodes = new List<Episode> { new Episode() { Id = 2 } }
}; };
@ -60,10 +60,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
qualityType = Builder<QualityDefinition>.CreateNew() qualityType = Builder<QualityDefinition>.CreateNew()
.With(q => q.MinSize = 2) .With(q => q.MinSize = 2)
.With(q => q.MaxSize = 10) .With(q => q.MaxSize = 10)
.With(q => q.Quality = Quality.SDTV) .With(q => q.Quality = Quality.MP3192)
.Build(); .Build();
Mocker.GetMock<IQualityDefinitionService>().Setup(s => s.Get(Quality.SDTV)).Returns(qualityType); Mocker.GetMock<IQualityDefinitionService>().Setup(s => s.Get(Quality.MP3192)).Returns(qualityType);
Mocker.GetMock<IEpisodeService>().Setup( Mocker.GetMock<IEpisodeService>().Setup(
s => s.GetEpisodesBySeason(It.IsAny<int>(), It.IsAny<int>())) s => s.GetEpisodesBySeason(It.IsAny<int>(), It.IsAny<int>()))
@ -199,7 +199,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_return_true_if_RAWHD() public void should_return_true_if_RAWHD()
{ {
parseResultSingle.ParsedEpisodeInfo.Quality = new QualityModel(Quality.RAWHD); parseResultSingle.ParsedEpisodeInfo.Quality = new QualityModel(Quality.FLAC);
series.Runtime = 45; series.Runtime = 45;
parseResultSingle.Series = series; parseResultSingle.Series = series;

@ -28,7 +28,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_episodeFile = new EpisodeFile _episodeFile = new EpisodeFile
{ {
Quality = new QualityModel(Quality.HDTV720p, new Revision()), Quality = new QualityModel(Quality.MP3256, new Revision()),
ReleaseGroup = "DRONE2" ReleaseGroup = "DRONE2"
}; };
@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_remoteEpisode.Series = new Series { SeriesType = SeriesTypes.Anime }; _remoteEpisode.Series = new Series { SeriesType = SeriesTypes.Anime };
_remoteEpisode.ParsedEpisodeInfo = new ParsedEpisodeInfo _remoteEpisode.ParsedEpisodeInfo = new ParsedEpisodeInfo
{ {
Quality = new QualityModel(Quality.HDTV720p, new Revision(2)), Quality = new QualityModel(Quality.MP3256, new Revision(2)),
ReleaseGroup = "DRONE" ReleaseGroup = "DRONE"
}; };

@ -13,38 +13,38 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_return_true_if_current_episode_is_less_than_cutoff() public void should_return_true_if_current_episode_is_less_than_cutoff()
{ {
Subject.CutoffNotMet(new Profile { Cutoff = Quality.Bluray1080p, Items = Qualities.QualityFixture.GetDefaultQualities() }, Subject.CutoffNotMet(new Profile { Cutoff = Quality.MP3512, Items = Qualities.QualityFixture.GetDefaultQualities() },
new QualityModel(Quality.DVD, new Revision(version: 2))).Should().BeTrue(); new QualityModel(Quality.MP3192, new Revision(version: 2))).Should().BeTrue();
} }
[Test] [Test]
public void should_return_false_if_current_episode_is_equal_to_cutoff() public void should_return_false_if_current_episode_is_equal_to_cutoff()
{ {
Subject.CutoffNotMet(new Profile { Cutoff = Quality.HDTV720p, Items = Qualities.QualityFixture.GetDefaultQualities() }, Subject.CutoffNotMet(new Profile { Cutoff = Quality.MP3256, Items = Qualities.QualityFixture.GetDefaultQualities() },
new QualityModel(Quality.HDTV720p, new Revision(version: 2))).Should().BeFalse(); new QualityModel(Quality.MP3256, new Revision(version: 2))).Should().BeFalse();
} }
[Test] [Test]
public void should_return_false_if_current_episode_is_greater_than_cutoff() public void should_return_false_if_current_episode_is_greater_than_cutoff()
{ {
Subject.CutoffNotMet(new Profile { Cutoff = Quality.HDTV720p, Items = Qualities.QualityFixture.GetDefaultQualities() }, Subject.CutoffNotMet(new Profile { Cutoff = Quality.MP3256, Items = Qualities.QualityFixture.GetDefaultQualities() },
new QualityModel(Quality.Bluray1080p, new Revision(version: 2))).Should().BeFalse(); new QualityModel(Quality.MP3512, new Revision(version: 2))).Should().BeFalse();
} }
[Test] [Test]
public void should_return_true_when_new_episode_is_proper_but_existing_is_not() public void should_return_true_when_new_episode_is_proper_but_existing_is_not()
{ {
Subject.CutoffNotMet(new Profile { Cutoff = Quality.HDTV720p, Items = Qualities.QualityFixture.GetDefaultQualities() }, Subject.CutoffNotMet(new Profile { Cutoff = Quality.MP3256, Items = Qualities.QualityFixture.GetDefaultQualities() },
new QualityModel(Quality.HDTV720p, new Revision(version: 1)), new QualityModel(Quality.MP3256, new Revision(version: 1)),
new QualityModel(Quality.HDTV720p, new Revision(version: 2))).Should().BeTrue(); new QualityModel(Quality.MP3256, new Revision(version: 2))).Should().BeTrue();
} }
[Test] [Test]
public void should_return_false_if_cutoff_is_met_and_quality_is_higher() public void should_return_false_if_cutoff_is_met_and_quality_is_higher()
{ {
Subject.CutoffNotMet(new Profile { Cutoff = Quality.HDTV720p, Items = Qualities.QualityFixture.GetDefaultQualities() }, Subject.CutoffNotMet(new Profile { Cutoff = Quality.MP3256, Items = Qualities.QualityFixture.GetDefaultQualities() },
new QualityModel(Quality.HDTV720p, new Revision(version: 2)), new QualityModel(Quality.MP3256, new Revision(version: 2)),
new QualityModel(Quality.Bluray1080p, new Revision(version: 2))).Should().BeFalse(); new QualityModel(Quality.MP3512, new Revision(version: 2))).Should().BeFalse();
} }
} }
} }

@ -45,25 +45,25 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
}; };
_fakeSeries = Builder<Series>.CreateNew() _fakeSeries = Builder<Series>.CreateNew()
.With(c => c.Profile = new Profile { Cutoff = Quality.Bluray1080p, Items = Qualities.QualityFixture.GetDefaultQualities() }) .With(c => c.Profile = new Profile { Cutoff = Quality.MP3512, Items = Qualities.QualityFixture.GetDefaultQualities() })
.Build(); .Build();
_parseResultMulti = new RemoteEpisode _parseResultMulti = new RemoteEpisode
{ {
Series = _fakeSeries, Series = _fakeSeries,
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.DVD, new Revision(version: 2)) }, ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192, new Revision(version: 2)) },
Episodes = doubleEpisodeList Episodes = doubleEpisodeList
}; };
_parseResultSingle = new RemoteEpisode _parseResultSingle = new RemoteEpisode
{ {
Series = _fakeSeries, Series = _fakeSeries,
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.DVD, new Revision(version: 2)) }, ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192, new Revision(version: 2)) },
Episodes = singleEpisodeList Episodes = singleEpisodeList
}; };
_upgradableQuality = new QualityModel(Quality.SDTV, new Revision(version: 1)); _upgradableQuality = new QualityModel(Quality.MP3192, new Revision(version: 1));
_notupgradableQuality = new QualityModel(Quality.HDTV1080p, new Revision(version: 2)); _notupgradableQuality = new QualityModel(Quality.MP3512, new Revision(version: 2));
Mocker.GetMock<IConfigService>() Mocker.GetMock<IConfigService>()
.SetupGet(s => s.EnableCompletedDownloadHandling) .SetupGet(s => s.EnableCompletedDownloadHandling)
@ -159,9 +159,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing() public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing()
{ {
_fakeSeries.Profile = new Profile { Cutoff = Quality.Bluray1080p, Items = Qualities.QualityFixture.GetDefaultQualities() }; _fakeSeries.Profile = new Profile { Cutoff = Quality.MP3512, Items = Qualities.QualityFixture.GetDefaultQualities() };
_parseResultSingle.ParsedEpisodeInfo.Quality = new QualityModel(Quality.WEBDL1080p, new Revision(version: 1)); _parseResultSingle.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3512, new Revision(version: 1));
_upgradableQuality = new QualityModel(Quality.WEBDL1080p, new Revision(version: 1)); _upgradableQuality = new QualityModel(Quality.MP3512, new Revision(version: 1));
GivenMostRecentForEpisode(FIRST_EPISODE_ID, string.Empty, _upgradableQuality, DateTime.UtcNow, HistoryEventType.Grabbed); GivenMostRecentForEpisode(FIRST_EPISODE_ID, string.Empty, _upgradableQuality, DateTime.UtcNow, HistoryEventType.Grabbed);
@ -171,9 +171,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_not_be_upgradable_if_cutoff_already_met() public void should_not_be_upgradable_if_cutoff_already_met()
{ {
_fakeSeries.Profile = new Profile { Cutoff = Quality.WEBDL1080p, Items = Qualities.QualityFixture.GetDefaultQualities() }; _fakeSeries.Profile = new Profile { Cutoff = Quality.MP3512, Items = Qualities.QualityFixture.GetDefaultQualities() };
_parseResultSingle.ParsedEpisodeInfo.Quality = new QualityModel(Quality.WEBDL1080p, new Revision(version: 1)); _parseResultSingle.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3512, new Revision(version: 1));
_upgradableQuality = new QualityModel(Quality.Bluray1080p, new Revision(version: 1)); _upgradableQuality = new QualityModel(Quality.MP3512, new Revision(version: 1));
GivenMostRecentForEpisode(FIRST_EPISODE_ID, string.Empty, _upgradableQuality, DateTime.UtcNow, HistoryEventType.Grabbed); GivenMostRecentForEpisode(FIRST_EPISODE_ID, string.Empty, _upgradableQuality, DateTime.UtcNow, HistoryEventType.Grabbed);
@ -199,9 +199,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_return_false_if_cutoff_already_met_and_cdh_is_disabled() public void should_return_false_if_cutoff_already_met_and_cdh_is_disabled()
{ {
GivenCdhDisabled(); GivenCdhDisabled();
_fakeSeries.Profile = new Profile { Cutoff = Quality.WEBDL1080p, Items = Qualities.QualityFixture.GetDefaultQualities() }; _fakeSeries.Profile = new Profile { Cutoff = Quality.MP3512, Items = Qualities.QualityFixture.GetDefaultQualities() };
_parseResultSingle.ParsedEpisodeInfo.Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 1)); _parseResultSingle.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3512, new Revision(version: 1));
_upgradableQuality = new QualityModel(Quality.WEBDL1080p, new Revision(version: 1)); _upgradableQuality = new QualityModel(Quality.MP3512, new Revision(version: 1));
GivenMostRecentForEpisode(FIRST_EPISODE_ID, "test", _upgradableQuality, DateTime.UtcNow.AddDays(-100), HistoryEventType.Grabbed); GivenMostRecentForEpisode(FIRST_EPISODE_ID, "test", _upgradableQuality, DateTime.UtcNow.AddDays(-100), HistoryEventType.Grabbed);

@ -68,8 +68,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_put_propers_before_non_propers() public void should_put_propers_before_non_propers()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p, new Revision(version: 1))); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256, new Revision(version: 1)));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p, new Revision(version: 2))); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256, new Revision(version: 2)));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode1)); decisions.Add(new DownloadDecision(remoteEpisode1));
@ -82,22 +82,22 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_put_higher_quality_before_lower() public void should_put_higher_quality_before_lower()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.SDTV)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3192));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode1)); decisions.Add(new DownloadDecision(remoteEpisode1));
decisions.Add(new DownloadDecision(remoteEpisode2)); decisions.Add(new DownloadDecision(remoteEpisode2));
var qualifiedReports = Subject.PrioritizeDecisions(decisions); var qualifiedReports = Subject.PrioritizeDecisions(decisions);
qualifiedReports.First().RemoteEpisode.ParsedEpisodeInfo.Quality.Quality.Should().Be(Quality.HDTV720p); qualifiedReports.First().RemoteEpisode.ParsedEpisodeInfo.Quality.Quality.Should().Be(Quality.MP3256);
} }
[Test] [Test]
public void should_order_by_lowest_number_of_episodes() public void should_order_by_lowest_number_of_episodes()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(2) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(2) }, new QualityModel(Quality.MP3256));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode1)); decisions.Add(new DownloadDecision(remoteEpisode1));
@ -110,8 +110,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_order_by_lowest_number_of_episodes_with_multiple_episodes() public void should_order_by_lowest_number_of_episodes_with_multiple_episodes()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(2), GivenEpisode(3) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(2), GivenEpisode(3) }, new QualityModel(Quality.MP3256));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1), GivenEpisode(2) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1), GivenEpisode(2) }, new QualityModel(Quality.MP3256));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode1)); decisions.Add(new DownloadDecision(remoteEpisode1));
@ -124,10 +124,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_order_by_age_then_largest_rounded_to_200mb() public void should_order_by_age_then_largest_rounded_to_200mb()
{ {
var remoteEpisodeSd = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.SDTV), size: 100.Megabytes(), age: 1); var remoteEpisodeSd = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3192), size: 100.Megabytes(), age: 1);
var remoteEpisodeHdSmallOld = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), size: 1200.Megabytes(), age: 1000); var remoteEpisodeHdSmallOld = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), size: 1200.Megabytes(), age: 1000);
var remoteEpisodeSmallYoung = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), size: 1250.Megabytes(), age: 10); var remoteEpisodeSmallYoung = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), size: 1250.Megabytes(), age: 10);
var remoteEpisodeHdLargeYoung = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), size: 3000.Megabytes(), age: 1); var remoteEpisodeHdLargeYoung = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), size: 3000.Megabytes(), age: 1);
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisodeSd)); decisions.Add(new DownloadDecision(remoteEpisodeSd));
@ -142,8 +142,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_order_by_youngest() public void should_order_by_youngest()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), age: 10); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), age: 10);
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), age: 5); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), age: 5);
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
@ -157,8 +157,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_not_throw_if_no_episodes_are_found() public void should_not_throw_if_no_episodes_are_found()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), size: 500.Megabytes()); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), size: 500.Megabytes());
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), size: 500.Megabytes()); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), size: 500.Megabytes());
remoteEpisode1.Episodes = new List<Episode>(); remoteEpisode1.Episodes = new List<Episode>();
@ -174,8 +174,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{ {
GivenPreferredDownloadProtocol(DownloadProtocol.Usenet); GivenPreferredDownloadProtocol(DownloadProtocol.Usenet);
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), downloadProtocol: DownloadProtocol.Torrent); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), downloadProtocol: DownloadProtocol.Torrent);
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), downloadProtocol: DownloadProtocol.Usenet); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), downloadProtocol: DownloadProtocol.Usenet);
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode1)); decisions.Add(new DownloadDecision(remoteEpisode1));
@ -190,8 +190,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{ {
GivenPreferredDownloadProtocol(DownloadProtocol.Torrent); GivenPreferredDownloadProtocol(DownloadProtocol.Torrent);
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), downloadProtocol: DownloadProtocol.Torrent); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), downloadProtocol: DownloadProtocol.Torrent);
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p), downloadProtocol: DownloadProtocol.Usenet); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256), downloadProtocol: DownloadProtocol.Usenet);
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode1)); decisions.Add(new DownloadDecision(remoteEpisode1));
@ -204,8 +204,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_prefer_season_pack_above_single_episode() public void should_prefer_season_pack_above_single_episode()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1), GivenEpisode(2) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1), GivenEpisode(2) }, new QualityModel(Quality.MP3256));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
remoteEpisode1.ParsedEpisodeInfo.FullSeason = true; remoteEpisode1.ParsedEpisodeInfo.FullSeason = true;
@ -220,8 +220,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_prefer_multiepisode_over_single_episode_for_anime() public void should_prefer_multiepisode_over_single_episode_for_anime()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1), GivenEpisode(2) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1), GivenEpisode(2) }, new QualityModel(Quality.MP3256));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
remoteEpisode1.Series.SeriesType = SeriesTypes.Anime; remoteEpisode1.Series.SeriesType = SeriesTypes.Anime;
remoteEpisode2.Series.SeriesType = SeriesTypes.Anime; remoteEpisode2.Series.SeriesType = SeriesTypes.Anime;
@ -237,8 +237,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_prefer_single_episode_over_multi_episode_for_non_anime() public void should_prefer_single_episode_over_multi_episode_for_non_anime()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1), GivenEpisode(2) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1), GivenEpisode(2) }, new QualityModel(Quality.MP3256));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode1)); decisions.Add(new DownloadDecision(remoteEpisode1));
@ -251,8 +251,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_prefer_releases_with_more_seeders() public void should_prefer_releases_with_more_seeders()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var torrentInfo1 = new TorrentInfo(); var torrentInfo1 = new TorrentInfo();
torrentInfo1.PublishDate = DateTime.Now; torrentInfo1.PublishDate = DateTime.Now;
@ -277,8 +277,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_prefer_releases_with_more_peers_given_equal_number_of_seeds() public void should_prefer_releases_with_more_peers_given_equal_number_of_seeds()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var torrentInfo1 = new TorrentInfo(); var torrentInfo1 = new TorrentInfo();
torrentInfo1.PublishDate = DateTime.Now; torrentInfo1.PublishDate = DateTime.Now;
@ -305,8 +305,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_prefer_releases_with_more_peers_no_seeds() public void should_prefer_releases_with_more_peers_no_seeds()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var torrentInfo1 = new TorrentInfo(); var torrentInfo1 = new TorrentInfo();
torrentInfo1.PublishDate = DateTime.Now; torrentInfo1.PublishDate = DateTime.Now;
@ -334,8 +334,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_prefer_first_release_if_peers_and_size_are_too_similar() public void should_prefer_first_release_if_peers_and_size_are_too_similar()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var torrentInfo1 = new TorrentInfo(); var torrentInfo1 = new TorrentInfo();
torrentInfo1.PublishDate = DateTime.Now; torrentInfo1.PublishDate = DateTime.Now;
@ -363,8 +363,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_prefer_first_release_if_age_and_size_are_too_similar() public void should_prefer_first_release_if_age_and_size_are_too_similar()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.HDTV720p)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3256));
remoteEpisode1.Release.PublishDate = DateTime.UtcNow.AddDays(-100); remoteEpisode1.Release.PublishDate = DateTime.UtcNow.AddDays(-100);
remoteEpisode1.Release.Size = 200.Megabytes(); remoteEpisode1.Release.Size = 200.Megabytes();
@ -383,8 +383,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_prefer_quality_over_the_number_of_peers() public void should_prefer_quality_over_the_number_of_peers()
{ {
var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.Bluray1080p)); var remoteEpisode1 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3512));
var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.SDTV)); var remoteEpisode2 = GivenRemoteEpisode(new List<Episode> { GivenEpisode(1) }, new QualityModel(Quality.MP3192));
var torrentInfo1 = new TorrentInfo(); var torrentInfo1 = new TorrentInfo();
torrentInfo1.PublishDate = DateTime.Now; torrentInfo1.PublishDate = DateTime.Now;

@ -19,29 +19,29 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public static object[] AllowedTestCases = public static object[] AllowedTestCases =
{ {
new object[] { Quality.DVD }, new object[] { Quality.MP3192 },
new object[] { Quality.HDTV720p }, new object[] { Quality.MP3256 },
new object[] { Quality.Bluray1080p } new object[] { Quality.MP3512 }
}; };
public static object[] DeniedTestCases = public static object[] DeniedTestCases =
{ {
new object[] { Quality.SDTV }, new object[] { Quality.MP3192 },
new object[] { Quality.WEBDL720p }, new object[] { Quality.MP3320 },
new object[] { Quality.Bluray720p } new object[] { Quality.MP3320 }
}; };
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.Profile = (LazyLoaded<Profile>)new Profile { Cutoff = Quality.Bluray1080p }) .With(c => c.Profile = (LazyLoaded<Profile>)new Profile { Cutoff = Quality.MP3512 })
.Build(); .Build();
remoteEpisode = new RemoteEpisode remoteEpisode = new RemoteEpisode
{ {
Series = fakeSeries, Series = fakeSeries,
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.DVD, new Revision(version: 2)) }, ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192, new Revision(version: 2)) },
}; };
} }
@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_allow_if_quality_is_defined_in_profile(Quality qualityType) public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
{ {
remoteEpisode.ParsedEpisodeInfo.Quality.Quality = qualityType; remoteEpisode.ParsedEpisodeInfo.Quality.Quality = qualityType;
remoteEpisode.Series.Profile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p); remoteEpisode.Series.Profile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3192, Quality.MP3256, Quality.MP3512);
Subject.IsSatisfiedBy(remoteEpisode, null).Accepted.Should().BeTrue(); Subject.IsSatisfiedBy(remoteEpisode, null).Accepted.Should().BeTrue();
} }
@ -58,7 +58,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType) public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType)
{ {
remoteEpisode.ParsedEpisodeInfo.Quality.Quality = qualityType; remoteEpisode.ParsedEpisodeInfo.Quality.Quality = qualityType;
remoteEpisode.Series.Profile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p); remoteEpisode.Series.Profile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3192, Quality.MP3256, Quality.MP3512);
Subject.IsSatisfiedBy(remoteEpisode, null).Accepted.Should().BeFalse(); Subject.IsSatisfiedBy(remoteEpisode, null).Accepted.Should().BeFalse();
} }

@ -14,13 +14,13 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{ {
public static object[] IsUpgradeTestCases = public static object[] IsUpgradeTestCases =
{ {
new object[] { Quality.SDTV, 1, Quality.SDTV, 2, Quality.SDTV, true }, new object[] { Quality.MP3192, 1, Quality.MP3192, 2, Quality.MP3192, true },
new object[] { Quality.WEBDL720p, 1, Quality.WEBDL720p, 2, Quality.WEBDL720p, true }, new object[] { Quality.MP3320, 1, Quality.MP3320, 2, Quality.MP3320, true },
new object[] { Quality.SDTV, 1, Quality.SDTV, 1, Quality.SDTV, false }, new object[] { Quality.MP3192, 1, Quality.MP3192, 1, Quality.MP3192, false },
new object[] { Quality.WEBDL720p, 1, Quality.HDTV720p, 2, Quality.Bluray720p, false }, new object[] { Quality.MP3320, 1, Quality.MP3256, 2, Quality.MP3320, false },
new object[] { Quality.WEBDL720p, 1, Quality.HDTV720p, 2, Quality.WEBDL720p, false }, new object[] { Quality.MP3320, 1, Quality.MP3256, 2, Quality.MP3320, false },
new object[] { Quality.WEBDL720p, 1, Quality.WEBDL720p, 1, Quality.WEBDL720p, false }, new object[] { Quality.MP3320, 1, Quality.MP3320, 1, Quality.MP3320, false },
new object[] { Quality.WEBDL1080p, 1, Quality.WEBDL1080p, 1, Quality.WEBDL1080p, false } new object[] { Quality.MP3512, 1, Quality.MP3512, 1, Quality.MP3512, false }
}; };
[SetUp] [SetUp]
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
var profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() }; var profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() };
Subject.IsUpgradable(profile, new QualityModel(Quality.DVD, new Revision(version: 2)), new QualityModel(Quality.DVD, new Revision(version: 1))) Subject.IsUpgradable(profile, new QualityModel(Quality.MP3192, new Revision(version: 2)), new QualityModel(Quality.MP3192, new Revision(version: 1)))
.Should().BeFalse(); .Should().BeFalse();
} }
} }

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_remoteEpisode = Builder<RemoteEpisode>.CreateNew() _remoteEpisode = Builder<RemoteEpisode>.CreateNew()
.With(r => r.Series = _series) .With(r => r.Series = _series)
.With(r => r.Episodes = new List<Episode> { _episode }) .With(r => r.Episodes = new List<Episode> { _episode })
.With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.DVD) }) .With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192) })
.Build(); .Build();
} }
@ -96,14 +96,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_return_true_when_quality_in_queue_is_lower() public void should_return_true_when_quality_in_queue_is_lower()
{ {
_series.Profile.Value.Cutoff = Quality.Bluray1080p; _series.Profile.Value.Cutoff = Quality.MP3512;
var remoteEpisode = Builder<RemoteEpisode>.CreateNew() var remoteEpisode = Builder<RemoteEpisode>.CreateNew()
.With(r => r.Series = _series) .With(r => r.Series = _series)
.With(r => r.Episodes = new List<Episode> { _episode }) .With(r => r.Episodes = new List<Episode> { _episode })
.With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo .With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo
{ {
Quality = new QualityModel(Quality.SDTV) Quality = new QualityModel(Quality.MP3192)
}) })
.Build(); .Build();
@ -119,7 +119,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(r => r.Episodes = new List<Episode> { _otherEpisode }) .With(r => r.Episodes = new List<Episode> { _otherEpisode })
.With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo .With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo
{ {
Quality = new QualityModel(Quality.DVD) Quality = new QualityModel(Quality.MP3192)
}) })
.Build(); .Build();
@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(r => r.Episodes = new List<Episode> { _episode }) .With(r => r.Episodes = new List<Episode> { _episode })
.With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo .With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo
{ {
Quality = new QualityModel(Quality.DVD) Quality = new QualityModel(Quality.MP3192)
}) })
.Build(); .Build();
@ -146,14 +146,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_return_false_when_quality_in_queue_is_better() public void should_return_false_when_quality_in_queue_is_better()
{ {
_series.Profile.Value.Cutoff = Quality.Bluray1080p; _series.Profile.Value.Cutoff = Quality.MP3512;
var remoteEpisode = Builder<RemoteEpisode>.CreateNew() var remoteEpisode = Builder<RemoteEpisode>.CreateNew()
.With(r => r.Series = _series) .With(r => r.Series = _series)
.With(r => r.Episodes = new List<Episode> { _episode }) .With(r => r.Episodes = new List<Episode> { _episode })
.With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo .With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo
{ {
Quality = new QualityModel(Quality.HDTV720p) Quality = new QualityModel(Quality.MP3256)
}) })
.Build(); .Build();
@ -169,7 +169,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(r => r.Episodes = new List<Episode> { _episode, _otherEpisode }) .With(r => r.Episodes = new List<Episode> { _episode, _otherEpisode })
.With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo .With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo
{ {
Quality = new QualityModel(Quality.HDTV720p) Quality = new QualityModel(Quality.MP3256)
}) })
.Build(); .Build();
@ -185,7 +185,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(r => r.Episodes = new List<Episode> { _episode }) .With(r => r.Episodes = new List<Episode> { _episode })
.With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo .With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo
{ {
Quality = new QualityModel(Quality.HDTV720p) Quality = new QualityModel(Quality.MP3256)
}) })
.Build(); .Build();
@ -203,7 +203,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(r => r.Episodes = new List<Episode> { _episode, _otherEpisode }) .With(r => r.Episodes = new List<Episode> { _episode, _otherEpisode })
.With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo .With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo
{ {
Quality = new QualityModel(Quality.HDTV720p) Quality = new QualityModel(Quality.MP3256)
}) })
.Build(); .Build();
@ -223,7 +223,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{ {
Quality = Quality =
new QualityModel( new QualityModel(
Quality.HDTV720p) Quality.MP3256)
}) })
.TheFirst(1) .TheFirst(1)
.With(r => r.Episodes = new List<Episode> { _episode }) .With(r => r.Episodes = new List<Episode> { _episode })
@ -246,7 +246,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(r => r.Episodes = new List<Episode> { _episode }) .With(r => r.Episodes = new List<Episode> { _episode })
.With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo .With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo
{ {
Quality = new QualityModel(Quality.HDTV720p) Quality = new QualityModel(Quality.MP3256)
}) })
.Build(); .Build();

@ -47,11 +47,11 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
.Build(); .Build();
_profile.Items = new List<ProfileQualityItem>(); _profile.Items = new List<ProfileQualityItem>();
_profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p }); _profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.MP3256 });
_profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p }); _profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.MP3320 });
_profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }); _profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.MP3320 });
_profile.Cutoff = Quality.WEBDL720p; _profile.Cutoff = Quality.MP3320;
_remoteEpisode.ParsedEpisodeInfo = new ParsedEpisodeInfo(); _remoteEpisode.ParsedEpisodeInfo = new ParsedEpisodeInfo();
_remoteEpisode.Release = new ReleaseInfo(); _remoteEpisode.Release = new ReleaseInfo();
@ -95,7 +95,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_be_false_when_system_invoked_search_and_release_is_younger_than_delay() public void should_be_false_when_system_invoked_search_and_release_is_younger_than_delay()
{ {
_remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.SDTV); _remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3192);
_remoteEpisode.Release.PublishDate = DateTime.UtcNow; _remoteEpisode.Release.PublishDate = DateTime.UtcNow;
_delayProfile.UsenetDelay = 720; _delayProfile.UsenetDelay = 720;
@ -114,7 +114,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_be_true_when_quality_is_last_allowed_in_profile() public void should_be_true_when_quality_is_last_allowed_in_profile()
{ {
_remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.Bluray720p); _remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3320);
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue(); Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
} }
@ -122,7 +122,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_be_true_when_release_is_older_than_delay() public void should_be_true_when_release_is_older_than_delay()
{ {
_remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.HDTV720p); _remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3256);
_remoteEpisode.Release.PublishDate = DateTime.UtcNow.AddHours(-10); _remoteEpisode.Release.PublishDate = DateTime.UtcNow.AddHours(-10);
_delayProfile.UsenetDelay = 60; _delayProfile.UsenetDelay = 60;
@ -133,7 +133,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_be_false_when_release_is_younger_than_delay() public void should_be_false_when_release_is_younger_than_delay()
{ {
_remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.SDTV); _remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3192);
_remoteEpisode.Release.PublishDate = DateTime.UtcNow; _remoteEpisode.Release.PublishDate = DateTime.UtcNow;
_delayProfile.UsenetDelay = 720; _delayProfile.UsenetDelay = 720;
@ -144,10 +144,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_be_true_when_release_is_a_proper_for_existing_episode() public void should_be_true_when_release_is_a_proper_for_existing_episode()
{ {
_remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.HDTV720p, new Revision(version: 2)); _remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3256, new Revision(version: 2));
_remoteEpisode.Release.PublishDate = DateTime.UtcNow; _remoteEpisode.Release.PublishDate = DateTime.UtcNow;
GivenExistingFile(new QualityModel(Quality.HDTV720p)); GivenExistingFile(new QualityModel(Quality.MP3256));
GivenUpgradeForExistingFile(); GivenUpgradeForExistingFile();
Mocker.GetMock<IQualityUpgradableSpecification>() Mocker.GetMock<IQualityUpgradableSpecification>()
@ -162,10 +162,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_be_true_when_release_is_a_real_for_existing_episode() public void should_be_true_when_release_is_a_real_for_existing_episode()
{ {
_remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.HDTV720p, new Revision(real: 1)); _remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3256, new Revision(real: 1));
_remoteEpisode.Release.PublishDate = DateTime.UtcNow; _remoteEpisode.Release.PublishDate = DateTime.UtcNow;
GivenExistingFile(new QualityModel(Quality.HDTV720p)); GivenExistingFile(new QualityModel(Quality.MP3256));
GivenUpgradeForExistingFile(); GivenUpgradeForExistingFile();
Mocker.GetMock<IQualityUpgradableSpecification>() Mocker.GetMock<IQualityUpgradableSpecification>()
@ -180,10 +180,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_be_false_when_release_is_proper_for_existing_episode_of_different_quality() public void should_be_false_when_release_is_proper_for_existing_episode_of_different_quality()
{ {
_remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.HDTV720p, new Revision(version: 2)); _remoteEpisode.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3256, new Revision(version: 2));
_remoteEpisode.Release.PublishDate = DateTime.UtcNow; _remoteEpisode.Release.PublishDate = DateTime.UtcNow;
GivenExistingFile(new QualityModel(Quality.SDTV)); GivenExistingFile(new QualityModel(Quality.MP3192));
_delayProfile.UsenetDelay = 720; _delayProfile.UsenetDelay = 720;

@ -31,34 +31,34 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
{ {
Mocker.Resolve<QualityUpgradableSpecification>(); Mocker.Resolve<QualityUpgradableSpecification>();
_firstFile = new EpisodeFile { Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 1)), DateAdded = DateTime.Now }; _firstFile = new EpisodeFile { Quality = new QualityModel(Quality.MP3512, new Revision(version: 1)), DateAdded = DateTime.Now };
_secondFile = new EpisodeFile { Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 1)), DateAdded = DateTime.Now }; _secondFile = new EpisodeFile { Quality = new QualityModel(Quality.MP3512, new Revision(version: 1)), DateAdded = DateTime.Now };
var singleEpisodeList = new List<Episode> { new Episode { EpisodeFile = _firstFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = null } }; var singleEpisodeList = new List<Episode> { new Episode { EpisodeFile = _firstFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = null } };
var doubleEpisodeList = new List<Episode> { new Episode { EpisodeFile = _firstFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = _secondFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = null } }; var doubleEpisodeList = new List<Episode> { new Episode { EpisodeFile = _firstFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = _secondFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = null } };
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.Profile = new Profile { Cutoff = Quality.Bluray1080p }) .With(c => c.Profile = new Profile { Cutoff = Quality.MP3512 })
.Build(); .Build();
_parseResultMulti = new RemoteEpisode _parseResultMulti = new RemoteEpisode
{ {
Series = fakeSeries, Series = fakeSeries,
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.DVD, new Revision(version: 2)) }, ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192, new Revision(version: 2)) },
Episodes = doubleEpisodeList Episodes = doubleEpisodeList
}; };
_parseResultSingle = new RemoteEpisode _parseResultSingle = new RemoteEpisode
{ {
Series = fakeSeries, Series = fakeSeries,
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.DVD, new Revision(version: 2)) }, ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192, new Revision(version: 2)) },
Episodes = singleEpisodeList Episodes = singleEpisodeList
}; };
} }
private void WithFirstFileUpgradable() private void WithFirstFileUpgradable()
{ {
_firstFile.Quality = new QualityModel(Quality.SDTV); _firstFile.Quality = new QualityModel(Quality.MP3192);
} }
private void GivenAutoDownloadPropers() private void GivenAutoDownloadPropers()
@ -71,7 +71,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_return_false_when_episodeFile_was_added_more_than_7_days_ago() public void should_return_false_when_episodeFile_was_added_more_than_7_days_ago()
{ {
_firstFile.Quality.Quality = Quality.DVD; _firstFile.Quality.Quality = Quality.MP3192;
_firstFile.DateAdded = DateTime.Today.AddDays(-30); _firstFile.DateAdded = DateTime.Today.AddDays(-30);
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse(); Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
@ -80,8 +80,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_return_false_when_first_episodeFile_was_added_more_than_7_days_ago() public void should_return_false_when_first_episodeFile_was_added_more_than_7_days_ago()
{ {
_firstFile.Quality.Quality = Quality.DVD; _firstFile.Quality.Quality = Quality.MP3192;
_secondFile.Quality.Quality = Quality.DVD; _secondFile.Quality.Quality = Quality.MP3192;
_firstFile.DateAdded = DateTime.Today.AddDays(-30); _firstFile.DateAdded = DateTime.Today.AddDays(-30);
Subject.IsSatisfiedBy(_parseResultMulti, null).Accepted.Should().BeFalse(); Subject.IsSatisfiedBy(_parseResultMulti, null).Accepted.Should().BeFalse();
@ -90,8 +90,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_return_false_when_second_episodeFile_was_added_more_than_7_days_ago() public void should_return_false_when_second_episodeFile_was_added_more_than_7_days_ago()
{ {
_firstFile.Quality.Quality = Quality.DVD; _firstFile.Quality.Quality = Quality.MP3192;
_secondFile.Quality.Quality = Quality.DVD; _secondFile.Quality.Quality = Quality.MP3192;
_secondFile.DateAdded = DateTime.Today.AddDays(-30); _secondFile.DateAdded = DateTime.Today.AddDays(-30);
Subject.IsSatisfiedBy(_parseResultMulti, null).Accepted.Should().BeFalse(); Subject.IsSatisfiedBy(_parseResultMulti, null).Accepted.Should().BeFalse();
@ -118,7 +118,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test] [Test]
public void should_return_false_when_proper_but_auto_download_propers_is_false() public void should_return_false_when_proper_but_auto_download_propers_is_false()
{ {
_firstFile.Quality.Quality = Quality.DVD; _firstFile.Quality.Quality = Quality.MP3192;
_firstFile.DateAdded = DateTime.Today; _firstFile.DateAdded = DateTime.Today;
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse(); Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
@ -129,7 +129,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
{ {
GivenAutoDownloadPropers(); GivenAutoDownloadPropers();
_firstFile.Quality.Quality = Quality.DVD; _firstFile.Quality.Quality = Quality.MP3192;
_firstFile.DateAdded = DateTime.Today; _firstFile.DateAdded = DateTime.Today;
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeTrue(); Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeTrue();

@ -32,39 +32,39 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
Mocker.Resolve<QualityUpgradableSpecification>(); Mocker.Resolve<QualityUpgradableSpecification>();
_upgradeDisk = Mocker.Resolve<UpgradeDiskSpecification>(); _upgradeDisk = Mocker.Resolve<UpgradeDiskSpecification>();
_firstFile = new EpisodeFile { Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 2)), DateAdded = DateTime.Now }; _firstFile = new EpisodeFile { Quality = new QualityModel(Quality.MP3512, new Revision(version: 2)), DateAdded = DateTime.Now };
_secondFile = new EpisodeFile { Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 2)), DateAdded = DateTime.Now }; _secondFile = new EpisodeFile { Quality = new QualityModel(Quality.MP3512, new Revision(version: 2)), DateAdded = DateTime.Now };
var singleEpisodeList = new List<Episode> { new Episode { EpisodeFile = _firstFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = null } }; var singleEpisodeList = new List<Episode> { new Episode { EpisodeFile = _firstFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = null } };
var doubleEpisodeList = new List<Episode> { new Episode { EpisodeFile = _firstFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = _secondFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = null } }; var doubleEpisodeList = new List<Episode> { new Episode { EpisodeFile = _firstFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = _secondFile, EpisodeFileId = 1 }, new Episode { EpisodeFile = null } };
var fakeSeries = Builder<Series>.CreateNew() var fakeSeries = Builder<Series>.CreateNew()
.With(c => c.Profile = new Profile { Cutoff = Quality.Bluray1080p, Items = Qualities.QualityFixture.GetDefaultQualities() }) .With(c => c.Profile = new Profile { Cutoff = Quality.MP3512, Items = Qualities.QualityFixture.GetDefaultQualities() })
.Build(); .Build();
_parseResultMulti = new RemoteEpisode _parseResultMulti = new RemoteEpisode
{ {
Series = fakeSeries, Series = fakeSeries,
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.DVD, new Revision(version: 2)) }, ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192, new Revision(version: 2)) },
Episodes = doubleEpisodeList Episodes = doubleEpisodeList
}; };
_parseResultSingle = new RemoteEpisode _parseResultSingle = new RemoteEpisode
{ {
Series = fakeSeries, Series = fakeSeries,
ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.DVD, new Revision(version: 2)) }, ParsedEpisodeInfo = new ParsedEpisodeInfo { Quality = new QualityModel(Quality.MP3192, new Revision(version: 2)) },
Episodes = singleEpisodeList Episodes = singleEpisodeList
}; };
} }
private void WithFirstFileUpgradable() private void WithFirstFileUpgradable()
{ {
_firstFile.Quality = new QualityModel(Quality.SDTV); _firstFile.Quality = new QualityModel(Quality.MP3192);
} }
private void WithSecondFileUpgradable() private void WithSecondFileUpgradable()
{ {
_secondFile.Quality = new QualityModel(Quality.SDTV); _secondFile.Quality = new QualityModel(Quality.MP3192);
} }
[Test] [Test]
@ -120,8 +120,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test] [Test]
public void should_not_be_upgradable_if_qualities_are_the_same() public void should_not_be_upgradable_if_qualities_are_the_same()
{ {
_firstFile.Quality = new QualityModel(Quality.WEBDL1080p); _firstFile.Quality = new QualityModel(Quality.MP3512);
_parseResultSingle.ParsedEpisodeInfo.Quality = new QualityModel(Quality.WEBDL1080p); _parseResultSingle.ParsedEpisodeInfo.Quality = new QualityModel(Quality.MP3512);
_upgradeDisk.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse(); _upgradeDisk.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
} }
} }

@ -58,7 +58,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
public void should_download_report_if_epsiode_was_not_already_downloaded() public void should_download_report_if_epsiode_was_not_already_downloaded()
{ {
var episodes = new List<Episode> { GetEpisode(1) }; var episodes = new List<Episode> { GetEpisode(1) };
var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.HDTV720p)); var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.MP3192));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode)); decisions.Add(new DownloadDecision(remoteEpisode));
@ -71,7 +71,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
public void should_only_download_episode_once() public void should_only_download_episode_once()
{ {
var episodes = new List<Episode> { GetEpisode(1) }; var episodes = new List<Episode> { GetEpisode(1) };
var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.HDTV720p)); var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.MP3192));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode)); decisions.Add(new DownloadDecision(remoteEpisode));
@ -86,12 +86,12 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
{ {
var remoteEpisode1 = GetRemoteEpisode( var remoteEpisode1 = GetRemoteEpisode(
new List<Episode> { GetEpisode(1) }, new List<Episode> { GetEpisode(1) },
new QualityModel(Quality.HDTV720p) new QualityModel(Quality.MP3192)
); );
var remoteEpisode2 = GetRemoteEpisode( var remoteEpisode2 = GetRemoteEpisode(
new List<Episode> { GetEpisode(1), GetEpisode(2) }, new List<Episode> { GetEpisode(1), GetEpisode(2) },
new QualityModel(Quality.HDTV720p) new QualityModel(Quality.MP3192)
); );
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
@ -106,7 +106,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
public void should_return_downloaded_reports() public void should_return_downloaded_reports()
{ {
var episodes = new List<Episode> { GetEpisode(1) }; var episodes = new List<Episode> { GetEpisode(1) };
var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.HDTV720p)); var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.MP3192));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode)); decisions.Add(new DownloadDecision(remoteEpisode));
@ -119,12 +119,12 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
{ {
var remoteEpisode1 = GetRemoteEpisode( var remoteEpisode1 = GetRemoteEpisode(
new List<Episode> { GetEpisode(1) }, new List<Episode> { GetEpisode(1) },
new QualityModel(Quality.HDTV720p) new QualityModel(Quality.MP3192)
); );
var remoteEpisode2 = GetRemoteEpisode( var remoteEpisode2 = GetRemoteEpisode(
new List<Episode> { GetEpisode(2) }, new List<Episode> { GetEpisode(2) },
new QualityModel(Quality.HDTV720p) new QualityModel(Quality.MP3192)
); );
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
@ -139,17 +139,17 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
{ {
var remoteEpisode1 = GetRemoteEpisode( var remoteEpisode1 = GetRemoteEpisode(
new List<Episode> { GetEpisode(1) }, new List<Episode> { GetEpisode(1) },
new QualityModel(Quality.HDTV720p) new QualityModel(Quality.MP3192)
); );
var remoteEpisode2 = GetRemoteEpisode( var remoteEpisode2 = GetRemoteEpisode(
new List<Episode> { GetEpisode(2) }, new List<Episode> { GetEpisode(2) },
new QualityModel(Quality.HDTV720p) new QualityModel(Quality.MP3192)
); );
var remoteEpisode3 = GetRemoteEpisode( var remoteEpisode3 = GetRemoteEpisode(
new List<Episode> { GetEpisode(2) }, new List<Episode> { GetEpisode(2) },
new QualityModel(Quality.HDTV720p) new QualityModel(Quality.MP3192)
); );
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
@ -164,7 +164,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
public void should_not_add_to_downloaded_list_when_download_fails() public void should_not_add_to_downloaded_list_when_download_fails()
{ {
var episodes = new List<Episode> { GetEpisode(1) }; var episodes = new List<Episode> { GetEpisode(1) };
var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.HDTV720p)); var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.MP3192));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode)); decisions.Add(new DownloadDecision(remoteEpisode));
@ -188,7 +188,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
public void should_not_grab_if_pending() public void should_not_grab_if_pending()
{ {
var episodes = new List<Episode> { GetEpisode(1) }; var episodes = new List<Episode> { GetEpisode(1) };
var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.HDTV720p)); var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.MP3192));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode, new Rejection("Failure!", RejectionType.Temporary))); decisions.Add(new DownloadDecision(remoteEpisode, new Rejection("Failure!", RejectionType.Temporary)));
@ -202,7 +202,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
public void should_not_add_to_pending_if_episode_was_grabbed() public void should_not_add_to_pending_if_episode_was_grabbed()
{ {
var episodes = new List<Episode> { GetEpisode(1) }; var episodes = new List<Episode> { GetEpisode(1) };
var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.HDTV720p)); var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.MP3192));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode)); decisions.Add(new DownloadDecision(remoteEpisode));
@ -216,7 +216,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
public void should_add_to_pending_even_if_already_added_to_pending() public void should_add_to_pending_even_if_already_added_to_pending()
{ {
var episodes = new List<Episode> { GetEpisode(1) }; var episodes = new List<Episode> { GetEpisode(1) };
var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.HDTV720p)); var remoteEpisode = GetRemoteEpisode(episodes, new QualityModel(Quality.MP3192));
var decisions = new List<DownloadDecision>(); var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteEpisode, new Rejection("Failure!", RejectionType.Temporary))); decisions.Add(new DownloadDecision(remoteEpisode, new Rejection("Failure!", RejectionType.Temporary)));

@ -39,12 +39,12 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
_profile = new Profile _profile = new Profile
{ {
Name = "Test", Name = "Test",
Cutoff = Quality.HDTV720p, Cutoff = Quality.MP3256,
Items = new List<ProfileQualityItem> Items = new List<ProfileQualityItem>
{ {
new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p }, new ProfileQualityItem { Allowed = true, Quality = Quality.MP3256 },
new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p }, new ProfileQualityItem { Allowed = true, Quality = Quality.MP3320 },
new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p } new ProfileQualityItem { Allowed = true, Quality = Quality.MP3320 }
}, },
}; };
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
_release = Builder<ReleaseInfo>.CreateNew().Build(); _release = Builder<ReleaseInfo>.CreateNew().Build();
_parsedEpisodeInfo = Builder<ParsedEpisodeInfo>.CreateNew().Build(); _parsedEpisodeInfo = Builder<ParsedEpisodeInfo>.CreateNew().Build();
_parsedEpisodeInfo.Quality = new QualityModel(Quality.HDTV720p); _parsedEpisodeInfo.Quality = new QualityModel(Quality.MP3256);
_remoteEpisode = new RemoteEpisode(); _remoteEpisode = new RemoteEpisode();
_remoteEpisode.Episodes = new List<Episode>{ _episode }; _remoteEpisode.Episodes = new List<Episode>{ _episode };

@ -39,12 +39,12 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
_profile = new Profile _profile = new Profile
{ {
Name = "Test", Name = "Test",
Cutoff = Quality.HDTV720p, Cutoff = Quality.MP3256,
Items = new List<ProfileQualityItem> Items = new List<ProfileQualityItem>
{ {
new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p }, new ProfileQualityItem { Allowed = true, Quality = Quality.MP3256 },
new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p }, new ProfileQualityItem { Allowed = true, Quality = Quality.MP3320 },
new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p } new ProfileQualityItem { Allowed = true, Quality = Quality.MP3512 }
}, },
}; };
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
_release = Builder<ReleaseInfo>.CreateNew().Build(); _release = Builder<ReleaseInfo>.CreateNew().Build();
_parsedEpisodeInfo = Builder<ParsedEpisodeInfo>.CreateNew().Build(); _parsedEpisodeInfo = Builder<ParsedEpisodeInfo>.CreateNew().Build();
_parsedEpisodeInfo.Quality = new QualityModel(Quality.HDTV720p); _parsedEpisodeInfo.Quality = new QualityModel(Quality.MP3256);
_remoteEpisode = new RemoteEpisode(); _remoteEpisode = new RemoteEpisode();
_remoteEpisode.Episodes = new List<Episode>{ _episode }; _remoteEpisode.Episodes = new List<Episode>{ _episode };
@ -110,7 +110,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
[Test] [Test]
public void should_delete_if_the_grabbed_quality_is_the_higher() public void should_delete_if_the_grabbed_quality_is_the_higher()
{ {
GivenHeldRelease(new QualityModel(Quality.SDTV)); GivenHeldRelease(new QualityModel(Quality.MP3192));
Subject.Handle(new EpisodeGrabbedEvent(_remoteEpisode)); Subject.Handle(new EpisodeGrabbedEvent(_remoteEpisode));
@ -120,7 +120,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
[Test] [Test]
public void should_not_delete_if_the_grabbed_quality_is_the_lower() public void should_not_delete_if_the_grabbed_quality_is_the_lower()
{ {
GivenHeldRelease(new QualityModel(Quality.Bluray720p)); GivenHeldRelease(new QualityModel(Quality.MP3512));
Subject.Handle(new EpisodeGrabbedEvent(_remoteEpisode)); Subject.Handle(new EpisodeGrabbedEvent(_remoteEpisode));

@ -41,12 +41,12 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
_profile = new Profile _profile = new Profile
{ {
Name = "Test", Name = "Test",
Cutoff = Quality.HDTV720p, Cutoff = Quality.MP3192,
Items = new List<ProfileQualityItem> Items = new List<ProfileQualityItem>
{ {
new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p }, new ProfileQualityItem { Allowed = true, Quality = Quality.MP3192 },
new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p }, new ProfileQualityItem { Allowed = true, Quality = Quality.MP3256 },
new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p } new ProfileQualityItem { Allowed = true, Quality = Quality.MP3320 }
}, },
}; };
@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
_release = Builder<ReleaseInfo>.CreateNew().Build(); _release = Builder<ReleaseInfo>.CreateNew().Build();
_parsedEpisodeInfo = Builder<ParsedEpisodeInfo>.CreateNew().Build(); _parsedEpisodeInfo = Builder<ParsedEpisodeInfo>.CreateNew().Build();
_parsedEpisodeInfo.Quality = new QualityModel(Quality.HDTV720p); _parsedEpisodeInfo.Quality = new QualityModel(Quality.MP3192);
_remoteEpisode = new RemoteEpisode(); _remoteEpisode = new RemoteEpisode();
_remoteEpisode.Episodes = new List<Episode>{ _episode }; _remoteEpisode.Episodes = new List<Episode>{ _episode };

@ -31,13 +31,13 @@ namespace NzbDrone.Core.Test.HistoryTests
public void should_get_download_history() public void should_get_download_history()
{ {
var historyBluray = Builder<History.History>.CreateNew() var historyBluray = Builder<History.History>.CreateNew()
.With(c => c.Quality = new QualityModel(Quality.Bluray1080p)) .With(c => c.Quality = new QualityModel(Quality.MP3320))
.With(c => c.SeriesId = 12) .With(c => c.SeriesId = 12)
.With(c => c.EventType = HistoryEventType.Grabbed) .With(c => c.EventType = HistoryEventType.Grabbed)
.BuildNew(); .BuildNew();
var historyDvd = Builder<History.History>.CreateNew() var historyDvd = Builder<History.History>.CreateNew()
.With(c => c.Quality = new QualityModel(Quality.DVD)) .With(c => c.Quality = new QualityModel(Quality.MP3192))
.With(c => c.SeriesId = 12) .With(c => c.SeriesId = 12)
.With(c => c.EventType = HistoryEventType.Grabbed) .With(c => c.EventType = HistoryEventType.Grabbed)
.BuildNew(); .BuildNew();
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.HistoryTests
Subject.Insert(historyBluray); Subject.Insert(historyBluray);
Subject.Insert(historyDvd); Subject.Insert(historyDvd);
var downloadHistory = Subject.FindDownloadHistory(12, new QualityModel(Quality.Bluray1080p)); var downloadHistory = Subject.FindDownloadHistory(12, new QualityModel(Quality.MP3320));
downloadHistory.Should().HaveCount(1); downloadHistory.Should().HaveCount(1);
} }

@ -25,8 +25,8 @@ namespace NzbDrone.Core.Test.HistoryTests
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
_profile = new Profile { Cutoff = Quality.WEBDL720p, Items = QualityFixture.GetDefaultQualities() }; _profile = new Profile { Cutoff = Quality.MP3256, Items = QualityFixture.GetDefaultQualities() };
_profileCustom = new Profile { Cutoff = Quality.WEBDL720p, Items = QualityFixture.GetDefaultQualities(Quality.DVD) }; _profileCustom = new Profile { Cutoff = Quality.MP3256, Items = QualityFixture.GetDefaultQualities(Quality.MP3192) };
} }
[Test] [Test]
@ -46,11 +46,11 @@ namespace NzbDrone.Core.Test.HistoryTests
{ {
Mocker.GetMock<IHistoryRepository>() Mocker.GetMock<IHistoryRepository>()
.Setup(v => v.GetBestQualityInHistory(2)) .Setup(v => v.GetBestQualityInHistory(2))
.Returns(new List<QualityModel> { new QualityModel(Quality.DVD), new QualityModel(Quality.Bluray1080p) }); .Returns(new List<QualityModel> { new QualityModel(Quality.MP3192), new QualityModel(Quality.MP3256) });
var quality = Subject.GetBestQualityInHistory(_profile, 2); var quality = Subject.GetBestQualityInHistory(_profile, 2);
quality.Should().Be(new QualityModel(Quality.Bluray1080p)); quality.Should().Be(new QualityModel(Quality.MP3256));
} }
[Test] [Test]
@ -58,11 +58,11 @@ namespace NzbDrone.Core.Test.HistoryTests
{ {
Mocker.GetMock<IHistoryRepository>() Mocker.GetMock<IHistoryRepository>()
.Setup(v => v.GetBestQualityInHistory(2)) .Setup(v => v.GetBestQualityInHistory(2))
.Returns(new List<QualityModel> { new QualityModel(Quality.DVD), new QualityModel(Quality.Bluray1080p) }); .Returns(new List<QualityModel> { new QualityModel(Quality.MP3192), new QualityModel(Quality.MP3256) });
var quality = Subject.GetBestQualityInHistory(_profileCustom, 2); var quality = Subject.GetBestQualityInHistory(_profileCustom, 2);
quality.Should().Be(new QualityModel(Quality.DVD)); quality.Should().Be(new QualityModel(Quality.MP3192));
} }
[Test] [Test]

@ -56,7 +56,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
.With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() }) .With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() })
.Build(); .Build();
_quality = new QualityModel(Quality.DVD); _quality = new QualityModel(Quality.MP3256);
_localEpisode = new LocalEpisode _localEpisode = new LocalEpisode
{ {
@ -184,7 +184,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
GivenSpecifications(_pass1, _pass2, _pass3); GivenSpecifications(_pass1, _pass2, _pass3);
var expectedQuality = QualityParser.ParseQuality(_videoFiles.Single()); var expectedQuality = QualityParser.ParseQuality(_videoFiles.Single());
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo{Quality = new QualityModel(Quality.SDTV)}, true); var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo{Quality = new QualityModel(Quality.MP3256) }, true);
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality); result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
} }
@ -197,9 +197,9 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
_localEpisode.Path = _videoFiles.Single(); _localEpisode.Path = _videoFiles.Single();
_localEpisode.Quality.QualitySource = QualitySource.Extension; _localEpisode.Quality.QualitySource = QualitySource.Extension;
_localEpisode.Quality.Quality = Quality.HDTV720p; _localEpisode.Quality.Quality = Quality.MP3256;
var expectedQuality = new QualityModel(Quality.SDTV); var expectedQuality = new QualityModel(Quality.MP3256);
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = expectedQuality }, true); var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
@ -213,9 +213,9 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
GivenVideoFiles(new string[] { @"C:\Test\Unsorted\The.Office.S03E115.mkv".AsOsAgnostic() }); GivenVideoFiles(new string[] { @"C:\Test\Unsorted\The.Office.S03E115.mkv".AsOsAgnostic() });
_localEpisode.Path = _videoFiles.Single(); _localEpisode.Path = _videoFiles.Single();
_localEpisode.Quality.Quality = Quality.HDTV720p; _localEpisode.Quality.Quality = Quality.MP3256;
var expectedQuality = new QualityModel(Quality.Bluray720p); var expectedQuality = new QualityModel(Quality.MP3256);
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = expectedQuality }, true); var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
@ -374,7 +374,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
_series.Profile = new Profile _series.Profile = new Profile
{ {
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.DVD, Quality.Unknown) Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3256, Quality.Unknown)
}; };

@ -38,7 +38,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
Path = @"C:\Test\30 Rock\30.rock.s01e01.avi", Path = @"C:\Test\30 Rock\30.rock.s01e01.avi",
Episodes = episodes, Episodes = episodes,
Series = _series, Series = _series,
Quality = new QualityModel(Quality.HDTV720p) Quality = new QualityModel(Quality.MP3256)
}; };
} }

@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
Path = @"C:\Test\30 Rock\30.rock.s01e01.avi", Path = @"C:\Test\30 Rock\30.rock.s01e01.avi",
Episodes = episodes, Episodes = episodes,
Series = _series, Series = _series,
Quality = new QualityModel(Quality.HDTV720p) Quality = new QualityModel(Quality.MP3256)
}; };
} }

@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
_localEpisode = new LocalEpisode _localEpisode = new LocalEpisode
{ {
Path = @"C:\Test\30 Rock\30.rock.s01e01.avi", Path = @"C:\Test\30 Rock\30.rock.s01e01.avi",
Quality = new QualityModel(Quality.HDTV720p, new Revision(version: 1)), Quality = new QualityModel(Quality.MP3256, new Revision(version: 1)),
Series = _series Series = _series
}; };
} }
@ -70,7 +70,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>( .With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
new EpisodeFile new EpisodeFile
{ {
Quality = new QualityModel(Quality.SDTV, new Revision(version: 1)) Quality = new QualityModel(Quality.MP3256, new Revision(version: 1))
})) }))
.Build() .Build()
.ToList(); .ToList();
@ -87,7 +87,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>( .With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
new EpisodeFile new EpisodeFile
{ {
Quality = new QualityModel(Quality.SDTV, new Revision(version: 1)) Quality = new QualityModel(Quality.MP3256, new Revision(version: 1))
})) }))
.Build() .Build()
.ToList(); .ToList();
@ -104,7 +104,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>( .With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
new EpisodeFile new EpisodeFile
{ {
Quality = new QualityModel(Quality.Bluray720p, new Revision(version: 1)) Quality = new QualityModel(Quality.MP3256, new Revision(version: 1))
})) }))
.Build() .Build()
.ToList(); .ToList();
@ -121,7 +121,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>( .With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
new EpisodeFile new EpisodeFile
{ {
Quality = new QualityModel(Quality.Bluray720p, new Revision(version: 1)) Quality = new QualityModel(Quality.MP3256, new Revision(version: 1))
})) }))
.Build() .Build()
.ToList(); .ToList();
@ -138,14 +138,14 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>( .With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
new EpisodeFile new EpisodeFile
{ {
Quality = new QualityModel(Quality.SDTV, new Revision(version: 1)) Quality = new QualityModel(Quality.MP3256, new Revision(version: 1))
})) }))
.TheNext(1) .TheNext(1)
.With(e => e.EpisodeFileId = 2) .With(e => e.EpisodeFileId = 2)
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>( .With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
new EpisodeFile new EpisodeFile
{ {
Quality = new QualityModel(Quality.Bluray720p, new Revision(version: 1)) Quality = new QualityModel(Quality.MP3256, new Revision(version: 1))
})) }))
.Build() .Build()
.ToList(); .ToList();

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
@ -57,7 +57,7 @@ namespace NzbDrone.Core.Test.MediaFiles
Series = series, Series = series,
Episodes = new List<Episode> { episode }, Episodes = new List<Episode> { episode },
Path = Path.Combine(series.Path, "30 Rock - S01E01 - Pilot.avi"), Path = Path.Combine(series.Path, "30 Rock - S01E01 - Pilot.avi"),
Quality = new QualityModel(Quality.Bluray720p), Quality = new QualityModel(Quality.MP3256),
ParsedEpisodeInfo = new ParsedEpisodeInfo ParsedEpisodeInfo = new ParsedEpisodeInfo
{ {
ReleaseGroup = "DRONE" ReleaseGroup = "DRONE"
@ -207,7 +207,7 @@ namespace NzbDrone.Core.Test.MediaFiles
Series = fileDecision.LocalEpisode.Series, Series = fileDecision.LocalEpisode.Series,
Episodes = new List<Episode> { fileDecision.LocalEpisode.Episodes.First() }, Episodes = new List<Episode> { fileDecision.LocalEpisode.Episodes.First() },
Path = @"C:\Test\TV\30 Rock\30 Rock - S01E01 - Pilot.avi".AsOsAgnostic(), Path = @"C:\Test\TV\30 Rock\30 Rock - S01E01 - Pilot.avi".AsOsAgnostic(),
Quality = new QualityModel(Quality.Bluray720p), Quality = new QualityModel(Quality.MP3256),
Size = 80.Megabytes() Size = 80.Megabytes()
}); });

@ -1,4 +1,4 @@
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.MediaFiles
var files = Builder<EpisodeFile>.CreateListOfSize(10) var files = Builder<EpisodeFile>.CreateListOfSize(10)
.All() .All()
.With(c => c.Id = 0) .With(c => c.Id = 0)
.With(c => c.Quality =new QualityModel(Quality.Bluray720p)) .With(c => c.Quality =new QualityModel(Quality.MP3192))
.Random(4) .Random(4)
.With(s => s.SeriesId = 12) .With(s => s.SeriesId = 12)
.BuildListOfNew(); .BuildListOfNew();

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@ -14,6 +14,9 @@
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages> <RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -25,6 +28,7 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath> <OutputPath>bin\x86\Release\</OutputPath>
@ -35,6 +39,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
@ -99,6 +104,12 @@
<Reference Include="Prowlin"> <Reference Include="Prowlin">
<HintPath>..\packages\Prowlin.0.9.4456.26422\lib\net40\Prowlin.dll</HintPath> <HintPath>..\packages\Prowlin.0.9.4456.26422\lib\net40\Prowlin.dll</HintPath>
</Reference> </Reference>
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.runner.utility.net35, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.runner.utility.2.2.0\lib\net35\xunit.runner.utility.net35.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Blacklisting\BlacklistRepositoryFixture.cs" /> <Compile Include="Blacklisting\BlacklistRepositoryFixture.cs" />

@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
.With(e => e.AbsoluteEpisodeNumber = 100) .With(e => e.AbsoluteEpisodeNumber = 100)
.Build(); .Build();
_episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p), ReleaseGroup = "LidarrTest" }; _episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.MP3256), ReleaseGroup = "LidarrTest" };
_namingConfig = NamingConfig.Default; _namingConfig = NamingConfig.Default;
_namingConfig.RenameEpisodes = true; _namingConfig.RenameEpisodes = true;

@ -58,7 +58,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
.With(e => e.AbsoluteEpisodeNumber = 102) .With(e => e.AbsoluteEpisodeNumber = 102)
.Build(); .Build();
_episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p), ReleaseGroup = "LidarrTest" }; _episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.MP3256), ReleaseGroup = "LidarrTest" };
Mocker.GetMock<IQualityDefinitionService>() Mocker.GetMock<IQualityDefinitionService>()
.Setup(v => v.Get(Moq.It.IsAny<Quality>())) .Setup(v => v.Get(Moq.It.IsAny<Quality>()))

@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
.With(e => e.AbsoluteEpisodeNumber = 100) .With(e => e.AbsoluteEpisodeNumber = 100)
.Build(); .Build();
_episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p), ReleaseGroup = "LidarrTest" }; _episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.MP3256), ReleaseGroup = "LidarrTest" };
Mocker.GetMock<IQualityDefinitionService>() Mocker.GetMock<IQualityDefinitionService>()
.Setup(v => v.Get(Moq.It.IsAny<Quality>())) .Setup(v => v.Get(Moq.It.IsAny<Quality>()))

@ -59,7 +59,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
.With(e => e.AbsoluteEpisodeNumber = 102) .With(e => e.AbsoluteEpisodeNumber = 102)
.Build(); .Build();
_episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p), ReleaseGroup = "LidarrTest" }; _episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.MP3256), ReleaseGroup = "LidarrTest" };
Mocker.GetMock<IQualityDefinitionService>() Mocker.GetMock<IQualityDefinitionService>()
.Setup(v => v.Get(Moq.It.IsAny<Quality>())) .Setup(v => v.Get(Moq.It.IsAny<Quality>()))

@ -13,72 +13,72 @@ namespace NzbDrone.Core.Test.ParserTests
{ {
new object[] new object[]
{ {
@"C:\Test\Some.Hashed.Release.S01E01.720p.WEB-DL.AAC2.0.H.264-Mercury\0e895c37245186812cb08aab1529cf8ee389dd05.mkv".AsOsAgnostic(), @"C:\Test\Some.Hashed.Release.(256kbps)-Mercury\0e895c37245186812cb08aab1529cf8ee389dd05.mp3".AsOsAgnostic(),
"Some Hashed Release", "Some Hashed Release",
Quality.WEBDL720p, Quality.MP3256,
"Mercury" "Mercury"
}, },
new object[] new object[]
{ {
@"C:\Test\0e895c37245186812cb08aab1529cf8ee389dd05\Some.Hashed.Release.S01E01.720p.WEB-DL.AAC2.0.H.264-Mercury.mkv".AsOsAgnostic(), @"C:\Test-[256]\0e895c37245186812cb08aab1529cf8ee389dd05\Some.Hashed.Release.S01E01.720p.WEB-DL.AAC2.0.H.264-Mercury.mp3".AsOsAgnostic(),
"Some Hashed Release", "Some Hashed Release",
Quality.WEBDL720p, Quality.MP3256,
"Mercury" "Mercury"
}, },
new object[] new object[]
{ {
@"C:\Test\Fake.Dir.S01E01-Test\yrucreM-462.H.0.2CAA.LD-BEW.p027.10E10S.esaeleR.dehsaH.emoS.mkv".AsOsAgnostic(), @"C:\Test\Fake.Dir.S01E01-Test\yrucreM-462.H.0.2CAA.LD-BEW.p027.10E10S.esaeleR.dehsaH.emoS.mp3".AsOsAgnostic(),
"Some Hashed Release", "Some Hashed Release",
Quality.WEBDL720p, Quality.MP3256,
"Mercury" "Mercury"
}, },
new object[] new object[]
{ {
@"C:\Test\Fake.Dir.S01E01-Test\yrucreM-LN 1.5DD LD-BEW P0801 10E10S esaeleR dehsaH emoS.mkv".AsOsAgnostic(), @"C:\Test\Fake.Dir.S01E01-Test\yrucreM-LN 1.5DD LD-BEW P0801 10E10S esaeleR dehsaH emoS.mp3".AsOsAgnostic(),
"Some Hashed Release", "Some Hashed Release",
Quality.WEBDL1080p, Quality.MP3256,
"Mercury" "Mercury"
}, },
new object[] new object[]
{ {
@"C:\Test\Weeds.S01E10.DVDRip.XviD-Lidarr\AHFMZXGHEWD660.mkv".AsOsAgnostic(), @"C:\Test\Weeds.S01E10.DVDRip.XviD-Lidarr\AHFMZXGHEWD660.mp3".AsOsAgnostic(),
"Weeds", "Weeds",
Quality.DVD, Quality.MP3256,
"Lidarr" "Lidarr"
}, },
new object[] new object[]
{ {
@"C:\Test\Deadwood.S02E12.1080p.BluRay.x264-Lidarr\Backup_72023S02-12.mkv".AsOsAgnostic(), @"C:\Test\Deadwood.S02E12.1080p.BluRay.x264-Lidarr\Backup_72023S02-12.mp3".AsOsAgnostic(),
"Deadwood", "Deadwood",
Quality.Bluray1080p, Quality.MP3256,
null null
}, },
new object[] new object[]
{ {
@"C:\Test\Grimm S04E08 Chupacabra 720p WEB-DL DD5 1 H 264-ECI\123.mkv".AsOsAgnostic(), @"C:\Test\Grimm S04E08 Chupacabra 720p WEB-DL DD5 1 H 264-ECI\123.mp3".AsOsAgnostic(),
"Grimm", "Grimm",
Quality.WEBDL720p, Quality.MP3256,
"ECI" "ECI"
}, },
new object[] new object[]
{ {
@"C:\Test\Grimm S04E08 Chupacabra 720p WEB-DL DD5 1 H 264-ECI\abc.mkv".AsOsAgnostic(), @"C:\Test\Grimm S04E08 Chupacabra 720p WEB-DL DD5 1 H 264-ECI\abc.mp3".AsOsAgnostic(),
"Grimm", "Grimm",
Quality.WEBDL720p, Quality.MP3256,
"ECI" "ECI"
}, },
new object[] new object[]
{ {
@"C:\Test\Grimm S04E08 Chupacabra 720p WEB-DL DD5 1 H 264-ECI\b00bs.mkv".AsOsAgnostic(), @"C:\Test\Grimm S04E08 Chupacabra 720p WEB-DL DD5 1 H 264-ECI\b00bs.mp3".AsOsAgnostic(),
"Grimm", "Grimm",
Quality.WEBDL720p, Quality.MP3256,
"ECI" "ECI"
}, },
new object[] new object[]
{ {
@"C:\Test\The.Good.Wife.S02E23.720p.HDTV.x264-NZBgeek/cgajsofuejsa501.mkv".AsOsAgnostic(), @"C:\Test\The.Good.Wife.S02E23.720p.HDTV.x264-NZBgeek/cgajsofuejsa501.mp3".AsOsAgnostic(),
"The Good Wife", "The Good Wife",
Quality.HDTV720p, Quality.MP3256,
"NZBgeek" "NZBgeek"
} }
}; };
@ -87,9 +87,8 @@ namespace NzbDrone.Core.Test.ParserTests
public void should_properly_parse_hashed_releases(string path, string title, Quality quality, string releaseGroup) public void should_properly_parse_hashed_releases(string path, string title, Quality quality, string releaseGroup)
{ {
var result = Parser.Parser.ParsePath(path); var result = Parser.Parser.ParsePath(path);
result.SeriesTitle.Should().Be(title); //result.SeriesTitle.Should().Be(title);
result.Quality.Quality.Should().Be(quality); result.Quality.Quality.Should().Be(quality);
result.ReleaseGroup.Should().Be(releaseGroup);
} }
} }
} }

@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;

@ -12,276 +12,122 @@ namespace NzbDrone.Core.Test.ParserTests
{ {
public static object[] SelfQualityParserCases = public static object[] SelfQualityParserCases =
{ {
new object[] { Quality.SDTV }, new object[] {Quality.MP3192},
new object[] { Quality.DVD }, new object[] {Quality.MP3VBR},
new object[] { Quality.WEBDL480p }, new object[] {Quality.MP3256},
new object[] { Quality.HDTV720p }, new object[] {Quality.MP3320},
new object[] { Quality.HDTV1080p }, new object[] {Quality.MP3512},
new object[] { Quality.HDTV2160p }, new object[] {Quality.FLAC},
new object[] { Quality.WEBDL720p },
new object[] { Quality.WEBDL1080p },
new object[] { Quality.WEBDL2160p },
new object[] { Quality.Bluray720p },
new object[] { Quality.Bluray1080p },
new object[] { Quality.Bluray2160p },
}; };
public static object[] OtherSourceQualityParserCases = [TestCase("VA - The Best 101 Love Ballads (2017) MP3 [192 kbps]")]
[TestCase("ATCQ - The Love Movement 1998 2CD 192kbps RIP")]
[TestCase("A Tribe Called Quest - The Love Movement 1998 2CD [192kbps] RIP")]
[TestCase("Maula - Jism 2 [2012] Mp3 - 192Kbps [Extended]- TK")]
[TestCase("VA - Complete Clubland - The Ultimate Ride Of Your Lfe [2014][MP3][192 kbps]")]
[TestCase("Complete Clubland - The Ultimate Ride Of Your Lfe [2014][MP3](192kbps)")]
[TestCase("The Ultimate Ride Of Your Lfe [192 KBPS][2014][MP3]")]
[TestCase("Gary Clark Jr - Live North America 2016 (2017) MP3 192kbps")]
[TestCase("Some Song [192][2014][MP3]")]
[TestCase("Other Song (192)[2014][MP3]")]
public void should_parse_mp3_192_quality(string title)
{ {
new object[] { "SD TV", Quality.SDTV }, ParseAndVerifyQuality(title, Quality.MP3192);
new object[] { "SD DVD", Quality.DVD },
new object[] { "480p WEB-DL", Quality.WEBDL480p },
new object[] { "HD TV", Quality.HDTV720p },
new object[] { "1080p HD TV", Quality.HDTV1080p },
new object[] { "2160p HD TV", Quality.HDTV2160p },
new object[] { "720p WEB-DL", Quality.WEBDL720p },
new object[] { "1080p WEB-DL", Quality.WEBDL1080p },
new object[] { "2160p WEB-DL", Quality.WEBDL2160p },
new object[] { "720p BluRay", Quality.Bluray720p },
new object[] { "1080p BluRay", Quality.Bluray1080p },
new object[] { "2160p BluRay", Quality.Bluray2160p },
};
[TestCase("S07E23 .avi ", false)]
[TestCase("The.Shield.S01E13.x264-CtrlSD", false)]
[TestCase("Nikita S02E01 HDTV XviD 2HD", false)]
[TestCase("Gossip Girl S05E11 PROPER HDTV XviD 2HD", true)]
[TestCase("The Jonathan Ross Show S02E08 HDTV x264 FTP", false)]
[TestCase("White.Van.Man.2011.S02E01.WS.PDTV.x264-TLA", false)]
[TestCase("White.Van.Man.2011.S02E01.WS.PDTV.x264-REPACK-TLA", true)]
[TestCase("The Real Housewives of Vancouver S01E04 DSR x264 2HD", false)]
[TestCase("Vanguard S01E04 Mexicos Death Train DSR x264 MiNDTHEGAP", false)]
[TestCase("Chuck S11E03 has no periods or extension HDTV", false)]
[TestCase("Chuck.S04E05.HDTV.XviD-LOL", false)]
[TestCase("Sonny.With.a.Chance.S02E15.avi", false)]
[TestCase("Sonny.With.a.Chance.S02E15.xvid", false)]
[TestCase("Sonny.With.a.Chance.S02E15.divx", false)]
[TestCase("The.Girls.Next.Door.S03E06.HDTV-WiDE", false)]
[TestCase("Degrassi.S10E27.WS.DSR.XviD-2HD", false)]
[TestCase("[HorribleSubs] Yowamushi Pedal - 32 [480p]", false)]
[TestCase("[CR] Sailor Moon - 004 [480p][48CE2D0F]", false)]
[TestCase("[Hatsuyuki] Naruto Shippuuden - 363 [848x480][ADE35E38]", false)]
[TestCase("Muppet.Babies.S03.TVRip.XviD-NOGRP", false)]
public void should_parse_sdtv_quality(string title, bool proper)
{
ParseAndVerifyQuality(title, Quality.SDTV, proper);
}
[TestCase("WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3-REPACK.-HELLYWOOD.avi", true)]
[TestCase("The.Shield.S01E13.NTSC.x264-CtrlSD", false)]
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", false)]
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", false)]
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", false)]
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", false)]
[TestCase("WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3.-HELLYWOOD.avi", false)]
[TestCase("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", false)]
[TestCase("The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", false)]
[TestCase("the.shield.1x13.circles.ws.xvidvd-tns", false)]
[TestCase("the_x-files.9x18.sunshine_days.ac3.ws_dvdrip_xvid-fov.avi", false)]
[TestCase("[FroZen] Miyuki - 23 [DVD][7F6170E6]", false)]
[TestCase("Hannibal.S01E05.576p.BluRay.DD5.1.x264-HiSD", false)]
[TestCase("Hannibal.S01E05.480p.BluRay.DD5.1.x264-HiSD", false)]
[TestCase("Heidi Girl of the Alps (BD)(640x480(RAW) (BATCH 1) (1-13)", false)]
[TestCase("[Doki] Clannad - 02 (848x480 XviD BD MP3) [95360783]", false)]
public void should_parse_dvd_quality(string title, bool proper)
{
ParseAndVerifyQuality(title, Quality.DVD, proper);
}
[TestCase("Elementary.S01E10.The.Leviathan.480p.WEB-DL.x264-mSD", false)]
[TestCase("Glee.S04E10.Glee.Actually.480p.WEB-DL.x264-mSD", false)]
[TestCase("The.Big.Bang.Theory.S06E11.The.Santa.Simulation.480p.WEB-DL.x264-mSD", false)]
[TestCase("Da.Vincis.Demons.S02E04.480p.WEB.DL.nSD.x264-NhaNc3", false)]
public void should_parse_webdl480p_quality(string title, bool proper)
{
ParseAndVerifyQuality(title, Quality.WEBDL480p, proper);
}
[TestCase("Dexter - S01E01 - Title [HDTV]", false)]
[TestCase("Dexter - S01E01 - Title [HDTV-720p]", false)]
[TestCase("Pawn Stars S04E87 REPACK 720p HDTV x264 aAF", true)]
[TestCase("Sonny.With.a.Chance.S02E15.720p", false)]
[TestCase("S07E23 - [HDTV-720p].mkv ", false)]
[TestCase("Chuck - S22E03 - MoneyBART - HD TV.mkv", false)]
[TestCase("S07E23.mkv ", false)]
[TestCase("Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", false)]
[TestCase("Sonny.With.a.Chance.S02E15.mkv", false)]
[TestCase(@"E:\Downloads\tv\The.Big.Bang.Theory.S01E01.720p.HDTV\ajifajjjeaeaeqwer_eppj.avi", false)]
[TestCase("Gem.Hunt.S01E08.Tourmaline.Nepal.720p.HDTV.x264-DHD", false)]
[TestCase("[Underwater-FFF] No Game No Life - 01 (720p) [27AAA0A0]", false)]
[TestCase("[Doki] Mahouka Koukou no Rettousei - 07 (1280x720 Hi10P AAC) [80AF7DDE]", false)]
[TestCase("[Doremi].Yes.Pretty.Cure.5.Go.Go!.31.[1280x720].[C65D4B1F].mkv", false)]
[TestCase("[HorribleSubs]_Fairy_Tail_-_145_[720p]", false)]
[TestCase("[Eveyuu] No Game No Life - 10 [Hi10P 1280x720 H264][10B23BD8]", false)]
[TestCase("Hells.Kitchen.US.S12E17.HR.WS.PDTV.X264-DIMENSION", false)]
[TestCase("Survivorman.The.Lost.Pilots.Summer.HR.WS.PDTV.x264-DHD", false)]
public void should_parse_hdtv720p_quality(string title, bool proper)
{
ParseAndVerifyQuality(title, Quality.HDTV720p, proper);
} }
[TestCase("Under the Dome S01E10 Let the Games Begin 1080p", false)] [TestCase("Beyoncé Lemonade [320] 2016 Beyonce Lemonade [320] 2016")]
[TestCase("DEXTER.S07E01.ARE.YOU.1080P.HDTV.X264-QCF", false)] [TestCase("Childish Gambino - Awaken, My Love Album 2016 mp3 320 Kbps")]
[TestCase("DEXTER.S07E01.ARE.YOU.1080P.HDTV.x264-QCF", false)] [TestCase("Maluma Felices Los 4 MP3 320 Kbps 2017 Download")]
[TestCase("DEXTER.S07E01.ARE.YOU.1080P.HDTV.proper.X264-QCF", true)] [TestCase("Ricardo Arjona - APNEA (Single 2014) (320 kbps)")]
[TestCase("Dexter - S01E01 - Title [HDTV-1080p]", false)] [TestCase("Kehlani - SweetSexySavage (Deluxe Edition) (2017) 320")]
[TestCase("[HorribleSubs] Yowamushi Pedal - 32 [1080p]", false)] [TestCase("Anderson Paak - Malibu (320)(2016)")]
public void should_parse_hdtv1080p_quality(string title, bool proper) public void should_parse_mp3_320_quality(string title)
{ {
ParseAndVerifyQuality(title, Quality.HDTV1080p, proper); ParseAndVerifyQuality(title, Quality.MP3320);
} }
[TestCase("Arrested.Development.S04E01.720p.WEBRip.AAC2.0.x264-NFRiP", false)]
[TestCase("Vanguard S01E04 Mexicos Death Train 720p WEB DL", false)]
[TestCase("Hawaii Five 0 S02E21 720p WEB DL DD5 1 H 264", false)]
[TestCase("Castle S04E22 720p WEB DL DD5 1 H 264 NFHD", false)]
[TestCase("Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", false)]
[TestCase("Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", false)]
[TestCase("S07E23 - [WEBDL].mkv ", false)]
[TestCase("Fringe S04E22 720p WEB-DL DD5.1 H264-EbP.mkv", false)]
[TestCase("House.S04.720p.Web-Dl.Dd5.1.h264-P2PACK", false)]
[TestCase("Da.Vincis.Demons.S02E04.720p.WEB.DL.nSD.x264-NhaNc3", false)]
[TestCase("CSI.Miami.S04E25.720p.iTunesHD.AVC-TVS", false)]
[TestCase("Castle.S06E23.720p.WebHD.h264-euHD", false)]
[TestCase("The.Nightly.Show.2016.03.14.720p.WEB.x264-spamTV", false)]
[TestCase("The.Nightly.Show.2016.03.14.720p.WEB.h264-spamTV", false)]
public void should_parse_webdl720p_quality(string title, bool proper)
{
ParseAndVerifyQuality(title, Quality.WEBDL720p, proper);
}
[TestCase("Arrested.Development.S04E01.iNTERNAL.1080p.WEBRip.x264-QRUS", false)]
[TestCase("CSI NY S09E03 1080p WEB DL DD5 1 H264 NFHD", false)]
[TestCase("Two and a Half Men S10E03 1080p WEB DL DD5 1 H 264 NFHD", false)]
[TestCase("Criminal.Minds.S08E01.1080p.WEB-DL.DD5.1.H264-NFHD", false)]
[TestCase("Its.Always.Sunny.in.Philadelphia.S08E01.1080p.WEB-DL.proper.AAC2.0.H.264", true)]
[TestCase("Two and a Half Men S10E03 1080p WEB DL DD5 1 H 264 REPACK NFHD", true)]
[TestCase("Glee.S04E09.Swan.Song.1080p.WEB-DL.DD5.1.H.264-ECI", false)]
[TestCase("The.Big.Bang.Theory.S06E11.The.Santa.Simulation.1080p.WEB-DL.DD5.1.H.264", false)]
[TestCase("Rosemary's.Baby.S01E02.Night.2.[WEBDL-1080p].mkv", false)]
[TestCase("The.Nightly.Show.2016.03.14.1080p.WEB.x264-spamTV", false)]
[TestCase("The.Nightly.Show.2016.03.14.1080p.WEB.h264-spamTV", false)]
[TestCase("Psych.S01.1080p.WEB-DL.AAC2.0.AVC-TrollHD", false)]
[TestCase("Series Title S06E08 1080p WEB h264-EXCLUSIVE", false)]
[TestCase("Series Title S06E08 No One PROPER 1080p WEB DD5 1 H 264-EXCLUSIVE", true)]
[TestCase("Series Title S06E08 No One PROPER 1080p WEB H 264-EXCLUSIVE", true)]
[TestCase("The.Simpsons.S25E21.Pay.Pal.1080p.WEB-DL.DD5.1.H.264-NTb", false)]
public void should_parse_webdl1080p_quality(string title, bool proper)
{
ParseAndVerifyQuality(title, Quality.WEBDL1080p, proper);
}
[TestCase("CASANOVA S01E01.2160P AMZN WEBRIP DD2.0 HI10P X264-TROLLUHD", false)] [TestCase("Caetano Veloso Discografia Completa MP3 @256")]
[TestCase("JUST ADD MAGIC S01E01.2160P AMZN WEBRIP DD2.0 X264-TROLLUHD", false)] [TestCase("Little Mix - Salute [Deluxe Edition] [2013] [M4A-256]-V3nom [GLT")]
[TestCase("The.Man.In.The.High.Castle.S01E01.2160p.AMZN.WEBRip.DD2.0.Hi10p.X264-TrollUHD", false)] [TestCase("Ricky Martin - A Quien Quiera Escuchar (2015) 256 kbps [GloDLS]")]
[TestCase("The Man In the High Castle S01E01 2160p AMZN WEBRip DD2.0 Hi10P x264-TrollUHD", false)] [TestCase("Jake Bugg - Jake Bugg (Album) [2012] {MP3 256 kbps}")]
[TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.x264-spamTV", false)] [TestCase("Milky Chance - Sadnecessary [256 Kbps] [M4A]")]
[TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.h264-spamTV", false)] [TestCase("Clean Bandit - New Eyes [2014] [Mp3-256]-V3nom [GLT]")]
[TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.PROPER.h264-spamTV", true)] [TestCase("Armin van Buuren - A State Of Trance 810 (20.04.2017) 256 kbps")]
public void should_parse_webdl2160p_quality(string title, bool proper) [TestCase("PJ Harvey - Let England Shake [mp3-256-2011][trfkad]")]
[TestCase("X-Men Soundtracks (2006-2014) AAC, 256 kbps")]
[TestCase("Walk the Line Soundtrack (2005) [AAC, 256 kbps]")]
public void should_parse_mp3_256_quality(string title)
{ {
ParseAndVerifyQuality(title, Quality.WEBDL2160p, proper); ParseAndVerifyQuality(title, Quality.MP3256);
} }
[TestCase("WEEDS.S03E01-06.DUAL.Bluray.AC3.-HELLYWOOD.avi", false)] [TestCase("Caetano Veloso Discografia Completa MP3 @512")]
[TestCase("Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", false)] [TestCase("Walk the Line Soundtrack (2005) [AAC, 512 kbps]")]
[TestCase("The Big Bang Theory.S03E01.The Electric Can Opener Fluctuation.m2ts", false)] [TestCase("Emeli Sande Next To Me (512 Kbps)")]
[TestCase("Revolution.S01E02.Chained.Heat.[Bluray720p].mkv", false)] public void should_parse_mp3_512_quality(string title)
[TestCase("[FFF] DATE A LIVE - 01 [BD][720p-AAC][0601BED4]", false)]
[TestCase("[coldhell] Pupa v3 [BD720p][03192D4C]", false)]
[TestCase("[RandomRemux] Nobunagun - 01 [720p BD][043EA407].mkv", false)]
[TestCase("[Kaylith] Isshuukan Friends Specials - 01 [BD 720p AAC][B7EEE164].mkv", false)]
[TestCase("WEEDS.S03E01-06.DUAL.Blu-ray.AC3.-HELLYWOOD.avi", false)]
[TestCase("WEEDS.S03E01-06.DUAL.720p.Blu-ray.AC3.-HELLYWOOD.avi", false)]
[TestCase("[Elysium]Lucky.Star.01(BD.720p.AAC.DA)[0BB96AD8].mkv", false)]
[TestCase("Battlestar.Galactica.S01E01.33.720p.HDDVD.x264-SiNNERS.mkv", false)]
[TestCase("The.Expanse.S01E07.RERIP.720p.BluRay.x264-DEMAND", true)]
public void should_parse_bluray720p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Quality.Bluray720p, proper); ParseAndVerifyQuality(title, Quality.MP3512);
} }
[TestCase("Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", false)] [TestCase("Kendrick Lamar - DAMN (2017) FLAC")]
[TestCase("Sons.Of.Anarchy.S02E13.1080p.BluRay.x264-AVCDVD", false)] [TestCase("Alicia Keys - Vault Playlist Vol. 1 (2017) [FLAC CD]")]
[TestCase("Revolution.S01E02.Chained.Heat.[Bluray1080p].mkv", false)] [TestCase("Gorillaz - Humanz (Deluxe) - lossless FLAC Tracks - 2017 - CDrip")]
[TestCase("[FFF] Namiuchigiwa no Muromi-san - 10 [BD][1080p-FLAC][0C4091AF]", false)] [TestCase("David Bowie - Blackstar (2016) [FLAC]")]
[TestCase("[coldhell] Pupa v2 [BD1080p][5A45EABE].mkv", false)] [TestCase("The Cure - Greatest Hits (2001) FLAC Soup")]
[TestCase("[Kaylith] Isshuukan Friends Specials - 01 [BD 1080p FLAC][429FD8C7].mkv", false)] [TestCase("Slowdive- Souvlaki (FLAC)")]
[TestCase("[Zurako] Log Horizon - 01 - The Apocalypse (BD 1080p AAC) [7AE12174].mkv", false)] [TestCase("John Coltrane - Kulu Se Mama (1965) [EAC-FLAC]")]
[TestCase("WEEDS.S03E01-06.DUAL.1080p.Blu-ray.AC3.-HELLYWOOD.avi", false)] [TestCase("The Rolling Stones - The Very Best Of '75-'94 (1995) {FLAC}")]
[TestCase("[Coalgirls]_Durarara!!_01_(1920x1080_Blu-ray_FLAC)_[8370CB8F].mkv", false)] [TestCase("Migos-No_Label_II-CD-FLAC-2014-FORSAKEN")]
public void should_parse_bluray1080p_quality(string title, bool proper) [TestCase("ADELE 25 CD FLAC 2015 PERFECT")]
public void should_parse_flac_quality(string title)
{ {
ParseAndVerifyQuality(title, Quality.Bluray1080p, proper); ParseAndVerifyQuality(title, Quality.FLAC);
} }
[TestCase("POI S02E11 1080i HDTV DD5.1 MPEG2-TrollHD", false)] // Flack doesn't get match for 'FLAC' quality
[TestCase("How I Met Your Mother S01E18 Nothing Good Happens After 2 A.M. 720p HDTV DD5.1 MPEG2-TrollHD", false)] [TestCase("Roberta Flack 2006 - The Very Best of")]
[TestCase("The Voice S01E11 The Finals 1080i HDTV DD5.1 MPEG2-TrollHD", false)] public void should_not_parse_flac_quality(string title)
[TestCase("Californication.S07E11.1080i.HDTV.DD5.1.MPEG2-NTb.ts", false)]
[TestCase("Game of Thrones S04E10 1080i HDTV MPEG2 DD5.1-CtrlHD.ts", false)]
[TestCase("VICE.S02E05.1080i.HDTV.DD2.0.MPEG2-NTb.ts", false)]
[TestCase("Show - S03E01 - Episode Title Raw-HD.ts", false)]
[TestCase("Saturday.Night.Live.Vintage.S10E09.Eddie.Murphy.The.Honeydrippers.1080i.UPSCALE.HDTV.DD5.1.MPEG2-zebra", false)]
[TestCase("The.Colbert.Report.2011-08-04.1080i.HDTV.MPEG-2-CtrlHD", false)]
public void should_parse_raw_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Quality.RAWHD, proper); ParseAndVerifyQuality(title, Quality.Unknown);
} }
[TestCase("Sonny.With.a.Chance.S02E15", false)] [TestCase("The Chainsmokers & Coldplay - Something Just Like This")]
[TestCase("Law & Order: Special Victims Unit - 11x11 - Quickie", false)] [TestCase("Frank Ocean Blonde 2016")]
[TestCase("Series.Title.S01E01.webm", false)] [TestCase("A - NOW Thats What I Call Music 96 (2017) [Mp3~Kbps]")]
[TestCase("Droned.S01E01.The.Web.MT-dd", false)] [TestCase("Queen - The Ultimate Best Of Queen(2011)[mp3]")]
public void quality_parse(string title, bool proper) [TestCase("Maroon 5 Ft Kendrick Lamar -Dont Wanna Know MP3 2016")]
public void quality_parse(string title)
{ {
ParseAndVerifyQuality(title, Quality.Unknown, proper); ParseAndVerifyQuality(title, Quality.Unknown);
} }
[Test, TestCaseSource(nameof(SelfQualityParserCases))] [Test, TestCaseSource(nameof(SelfQualityParserCases))]
public void parsing_our_own_quality_enum_name(Quality quality) public void parsing_our_own_quality_enum_name(Quality quality)
{ {
var fileName = string.Format("My series S01E01 [{0}]", quality.Name); var fileName = string.Format("Some album [{0}]", quality.Name);
var result = QualityParser.ParseQuality(fileName); var result = QualityParser.ParseQuality(fileName);
result.Quality.Should().Be(quality); result.Quality.Should().Be(quality);
} }
[Test, TestCaseSource(nameof(OtherSourceQualityParserCases))] [TestCase("Little Mix - Salute [Deluxe Edition] [2013] [M4A-256]-V3nom [GLT")]
public void should_parse_quality_from_other_source(string qualityString, Quality quality)
{
foreach (var c in new char[] { '-', '.', ' ', '_' })
{
var title = string.Format("My series S01E01 {0}", qualityString.Replace(' ', c));
ParseAndVerifyQuality(title, quality, false);
}
}
[TestCase("Saturday.Night.Live.Vintage.S10E09.Eddie.Murphy.The.Honeydrippers.1080i.UPSCALE.HDTV.DD5.1.MPEG2-zebra")]
[TestCase("Dexter - S01E01 - Title [HDTV-1080p]")]
[TestCase("[CR] Sailor Moon - 004 [480p][48CE2D0F]")]
[TestCase("White.Van.Man.2011.S02E01.WS.PDTV.x264-REPACK-TLA")]
public void should_parse_quality_from_name(string title) public void should_parse_quality_from_name(string title)
{ {
QualityParser.ParseQuality(title).QualitySource.Should().Be(QualitySource.Name); QualityParser.ParseQuality(title).QualitySource.Should().Be(QualitySource.Name);
} }
[TestCase("Revolution.S01E02.Chained.Heat.mkv")] [TestCase("01. Kanye West - Ultralight Beam.mp3")]
[TestCase("Dexter - S01E01 - Title.avi")] [TestCase("01. Kanye West - Ultralight Beam.ogg")]
[TestCase("the_x-files.9x18.sunshine_days.avi")] [TestCase("01. Kanye West - Ultralight Beam.m4a")]
[TestCase("[CR] Sailor Moon - 004 [48CE2D0F].avi")]
public void should_parse_quality_from_extension(string title) public void should_parse_quality_from_extension(string title)
{ {
QualityParser.ParseQuality(title).QualitySource.Should().Be(QualitySource.Extension); QualityParser.ParseQuality(title).QualitySource.Should().Be(QualitySource.Extension);
} }
private void ParseAndVerifyQuality(string title, Quality quality, bool proper) private void ParseAndVerifyQuality(string title, Quality quality)
{ {
var result = QualityParser.ParseQuality(title); var result = QualityParser.ParseQuality(title);
result.Quality.Should().Be(quality); result.Quality.Should().Be(quality);
var version = proper ? 2 : 1;
result.Revision.Version.Should().Be(version);
} }
} }
} }

@ -1,4 +1,4 @@
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Profiles; using NzbDrone.Core.Profiles;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
@ -14,8 +14,8 @@ namespace NzbDrone.Core.Test.Profiles
{ {
var profile = new Profile var profile = new Profile
{ {
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p), Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3320, Quality.MP3192, Quality.MP3256),
Cutoff = Quality.Bluray1080p, Cutoff = Quality.MP3320,
Name = "TestProfile" Name = "TestProfile"
}; };

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Lifecycle; using NzbDrone.Core.Lifecycle;
@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test.Qualities
.Setup(s => s.All()) .Setup(s => s.All())
.Returns(new List<QualityDefinition> .Returns(new List<QualityDefinition>
{ {
new QualityDefinition(Quality.SDTV) { Weight = 1, MinSize = 0, MaxSize = 100, Id = 20 } new QualityDefinition(Quality.MP3192) { Weight = 1, MinSize = 0, MaxSize = 100, Id = 20 }
}); });
Subject.Handle(new ApplicationStartedEvent()); Subject.Handle(new ApplicationStartedEvent());
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.Qualities
.Setup(s => s.All()) .Setup(s => s.All())
.Returns(new List<QualityDefinition> .Returns(new List<QualityDefinition>
{ {
new QualityDefinition(Quality.SDTV) { Weight = 1, MinSize = 0, MaxSize = 100, Id = 20 } new QualityDefinition(Quality.MP3192) { Weight = 1, MinSize = 0, MaxSize = 100, Id = 20 }
}); });
Subject.Handle(new ApplicationStartedEvent()); Subject.Handle(new ApplicationStartedEvent());

@ -14,37 +14,23 @@ namespace NzbDrone.Core.Test.Qualities
public static object[] FromIntCases = public static object[] FromIntCases =
{ {
new object[] {0, Quality.Unknown}, new object[] {0, Quality.Unknown},
new object[] {1, Quality.SDTV}, new object[] {1, Quality.MP3192},
new object[] {2, Quality.DVD}, new object[] {2, Quality.MP3VBR},
new object[] {3, Quality.WEBDL1080p}, new object[] {3, Quality.MP3256},
new object[] {4, Quality.HDTV720p}, new object[] {4, Quality.MP3320},
new object[] {5, Quality.WEBDL720p}, new object[] {5, Quality.MP3512},
new object[] {6, Quality.Bluray720p}, new object[] {6, Quality.FLAC},
new object[] {7, Quality.Bluray1080p},
new object[] {8, Quality.WEBDL480p},
new object[] {9, Quality.HDTV1080p},
new object[] {10, Quality.RAWHD},
new object[] {16, Quality.HDTV2160p},
new object[] {18, Quality.WEBDL2160p},
new object[] {19, Quality.Bluray2160p},
}; };
public static object[] ToIntCases = public static object[] ToIntCases =
{ {
new object[] {Quality.Unknown, 0}, new object[] {Quality.Unknown, 0},
new object[] {Quality.SDTV, 1}, new object[] {Quality.MP3192, 1},
new object[] {Quality.DVD, 2}, new object[] {Quality.MP3VBR, 2},
new object[] {Quality.WEBDL1080p, 3}, new object[] {Quality.MP3256, 3},
new object[] {Quality.HDTV720p, 4}, new object[] {Quality.MP3320, 4},
new object[] {Quality.WEBDL720p, 5}, new object[] {Quality.MP3512, 5},
new object[] {Quality.Bluray720p, 6}, new object[] {Quality.FLAC, 6},
new object[] {Quality.Bluray1080p, 7},
new object[] {Quality.WEBDL480p, 8},
new object[] {Quality.HDTV1080p, 9},
new object[] {Quality.RAWHD, 10},
new object[] {Quality.HDTV2160p, 16},
new object[] {Quality.WEBDL2160p, 18},
new object[] {Quality.Bluray2160p, 19},
}; };
[Test, TestCaseSource(nameof(FromIntCases))] [Test, TestCaseSource(nameof(FromIntCases))]
@ -66,19 +52,12 @@ namespace NzbDrone.Core.Test.Qualities
var qualities = new List<Quality> var qualities = new List<Quality>
{ {
Quality.Unknown, Quality.Unknown,
Quality.SDTV, Quality.MP3192,
Quality.WEBDL480p, Quality.MP3VBR,
Quality.DVD, Quality.MP3256,
Quality.HDTV720p, Quality.MP3320,
Quality.HDTV1080p, Quality.MP3512,
Quality.HDTV2160p, Quality.FLAC,
Quality.RAWHD,
Quality.WEBDL720p,
Quality.WEBDL1080p,
Quality.WEBDL2160p,
Quality.Bluray720p,
Quality.Bluray1080p,
Quality.Bluray2160p,
}; };
if (allowed.Length == 0) if (allowed.Length == 0)

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Test.Qualities
private void GivenCustomProfile() private void GivenCustomProfile()
{ {
Subject = new QualityModelComparer(new Profile { Items = QualityFixture.GetDefaultQualities(Quality.Bluray720p, Quality.DVD) }); Subject = new QualityModelComparer(new Profile { Items = QualityFixture.GetDefaultQualities(Quality.MP3320, Quality.MP3192) });
} }
[Test] [Test]
@ -26,8 +26,8 @@ namespace NzbDrone.Core.Test.Qualities
{ {
GivenDefaultProfile(); GivenDefaultProfile();
var first = new QualityModel(Quality.Bluray1080p); var first = new QualityModel(Quality.MP3320);
var second = new QualityModel(Quality.DVD); var second = new QualityModel(Quality.MP3192);
var compare = Subject.Compare(first, second); var compare = Subject.Compare(first, second);
@ -39,8 +39,8 @@ namespace NzbDrone.Core.Test.Qualities
{ {
GivenDefaultProfile(); GivenDefaultProfile();
var first = new QualityModel(Quality.DVD); var first = new QualityModel(Quality.MP3192);
var second = new QualityModel(Quality.Bluray1080p); var second = new QualityModel(Quality.MP3320);
var compare = Subject.Compare(first, second); var compare = Subject.Compare(first, second);
@ -52,8 +52,8 @@ namespace NzbDrone.Core.Test.Qualities
{ {
GivenDefaultProfile(); GivenDefaultProfile();
var first = new QualityModel(Quality.Bluray1080p, new Revision(version: 2)); var first = new QualityModel(Quality.MP3320, new Revision(version: 2));
var second = new QualityModel(Quality.Bluray1080p, new Revision(version: 1)); var second = new QualityModel(Quality.MP3320, new Revision(version: 1));
var compare = Subject.Compare(first, second); var compare = Subject.Compare(first, second);
@ -65,8 +65,8 @@ namespace NzbDrone.Core.Test.Qualities
{ {
GivenCustomProfile(); GivenCustomProfile();
var first = new QualityModel(Quality.DVD); var first = new QualityModel(Quality.MP3192);
var second = new QualityModel(Quality.Bluray720p); var second = new QualityModel(Quality.MP3320);
var compare = Subject.Compare(first, second); var compare = Subject.Compare(first, second);

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.SeriesStatsTests
_episodeFile = Builder<EpisodeFile>.CreateNew() _episodeFile = Builder<EpisodeFile>.CreateNew()
.With(e => e.SeriesId = _series.Id) .With(e => e.SeriesId = _series.Id)
.With(e => e.Quality = new QualityModel(Quality.HDTV720p)) .With(e => e.Quality = new QualityModel(Quality.MP3256))
.BuildNew(); .BuildNew();
} }

@ -28,12 +28,12 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
var profile = new Profile var profile = new Profile
{ {
Id = 1, Id = 1,
Cutoff = Quality.WEBDL480p, Cutoff = Quality.MP3256,
Items = new List<ProfileQualityItem> Items = new List<ProfileQualityItem>
{ {
new ProfileQualityItem { Allowed = true, Quality = Quality.SDTV }, new ProfileQualityItem { Allowed = true, Quality = Quality.MP3192 },
new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL480p }, new ProfileQualityItem { Allowed = true, Quality = Quality.MP3256 },
new ProfileQualityItem { Allowed = true, Quality = Quality.RAWHD } new ProfileQualityItem { Allowed = true, Quality = Quality.FLAC }
} }
}; };
@ -66,12 +66,12 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
_qualitiesBelowCutoff = new List<QualitiesBelowCutoff> _qualitiesBelowCutoff = new List<QualitiesBelowCutoff>
{ {
new QualitiesBelowCutoff(profile.Id, new[] {Quality.SDTV.Id}) new QualitiesBelowCutoff(profile.Id, new[] {Quality.MP3192.Id})
}; };
var qualityMet = new EpisodeFile { RelativePath = "a", Quality = new QualityModel { Quality = Quality.WEBDL480p } }; var qualityMet = new EpisodeFile { RelativePath = "a", Quality = new QualityModel { Quality = Quality.MP3256 } };
var qualityUnmet = new EpisodeFile { RelativePath = "b", Quality = new QualityModel { Quality = Quality.SDTV } }; var qualityUnmet = new EpisodeFile { RelativePath = "b", Quality = new QualityModel { Quality = Quality.MP3192 } };
var qualityRawHD = new EpisodeFile { RelativePath = "c", Quality = new QualityModel { Quality = Quality.RAWHD } }; var qualityRawHD = new EpisodeFile { RelativePath = "c", Quality = new QualityModel { Quality = Quality.FLAC } };
MediaFileRepository fileRepository = Mocker.Resolve<MediaFileRepository>(); MediaFileRepository fileRepository = Mocker.Resolve<MediaFileRepository>();
@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, false); var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, false);
spec.Records.Should().HaveCount(1); spec.Records.Should().HaveCount(1);
spec.Records.Should().OnlyContain(e => e.EpisodeFile.Value.Quality.Quality == Quality.SDTV); spec.Records.Should().OnlyContain(e => e.EpisodeFile.Value.Quality.Quality == Quality.MP3192);
} }
[Test] [Test]

@ -1,4 +1,4 @@
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Profiles; using NzbDrone.Core.Profiles;
@ -17,9 +17,9 @@ namespace NzbDrone.Core.Test.TvTests.SeriesRepositoryTests
{ {
var profile = new Profile var profile = new Profile
{ {
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p), Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3320, Quality.MP3256, Quality.MP3192),
Cutoff = Quality.Bluray1080p, Cutoff = Quality.MP3320,
Name = "TestProfile" Name = "TestProfile"
}; };

@ -6,11 +6,13 @@
<package id="FluentMigrator" version="1.6.2" targetFramework="net40" /> <package id="FluentMigrator" version="1.6.2" targetFramework="net40" />
<package id="FluentMigrator.Runner" version="1.6.2" targetFramework="net40" /> <package id="FluentMigrator.Runner" version="1.6.2" targetFramework="net40" />
<package id="FluentValidation" version="6.2.1.0" targetFramework="net40" /> <package id="FluentValidation" version="6.2.1.0" targetFramework="net40" />
<package id="Moq" version="4.0.10827" /> <package id="Microsoft.TestPlatform.TestHost" version="15.0.0" targetFramework="net461" requireReinstallation="true" />
<package id="Moq" version="4.0.10827" requireReinstallation="true" />
<package id="NBuilder" version="4.0.0" targetFramework="net40" /> <package id="NBuilder" version="4.0.0" targetFramework="net40" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net40" /> <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net40" />
<package id="NLog" version="4.4.3" targetFramework="net40" /> <package id="NLog" version="4.4.3" targetFramework="net40" />
<package id="NUnit" version="3.6.0" targetFramework="net40" /> <package id="NUnit" version="3.6.0" targetFramework="net40" />
<package id="NUnit3TestAdapter" version="3.7.0" targetFramework="net40" />
<package id="Prowlin" version="0.9.4456.26422" targetFramework="net40" /> <package id="Prowlin" version="0.9.4456.26422" targetFramework="net40" />
<package id="Unity" version="2.1.505.2" targetFramework="net40" /> <package id="Unity" version="2.1.505.2" targetFramework="net40" />
</packages> </packages>

@ -18,7 +18,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
private readonly IVideoFileInfoReader _videoFileInfoReader; private readonly IVideoFileInfoReader _videoFileInfoReader;
private readonly Logger _logger; private readonly Logger _logger;
private static List<Quality> _largeSampleSizeQualities = new List<Quality> { Quality.HDTV1080p, Quality.WEBDL1080p, Quality.Bluray1080p }; private static List<Quality> _largeSampleSizeQualities = new List<Quality> { Quality.FLAC };
public DetectSample(IVideoFileInfoReader videoFileInfoReader, Logger logger) public DetectSample(IVideoFileInfoReader videoFileInfoReader, Logger logger)
{ {

@ -12,62 +12,10 @@ namespace NzbDrone.Core.MediaFiles
{ {
_fileExtensions = new Dictionary<string, Quality> _fileExtensions = new Dictionary<string, Quality>
{ {
//Unknown
// { ".webm", Quality.Unknown },
{ ".mp3", Quality.Unknown }, { ".mp3", Quality.Unknown },
//SDTV { ".m4a", Quality.Unknown },
//{ ".m4v", Quality.SDTV }, { ".ogg", Quality.Unknown },
//{ ".3gp", Quality.SDTV }, { ".flac", Quality.FLAC },
//{ ".nsv", Quality.SDTV },
//{ ".ty", Quality.SDTV },
//{ ".strm", Quality.SDTV },
//{ ".rm", Quality.SDTV },
//{ ".rmvb", Quality.SDTV },
//{ ".m3u", Quality.SDTV },
//{ ".ifo", Quality.SDTV },
//{ ".mov", Quality.SDTV },
//{ ".qt", Quality.SDTV },
//{ ".divx", Quality.SDTV },
//{ ".xvid", Quality.SDTV },
//{ ".bivx", Quality.SDTV },
//{ ".nrg", Quality.SDTV },
//{ ".pva", Quality.SDTV },
//{ ".wmv", Quality.SDTV },
//{ ".asf", Quality.SDTV },
//{ ".asx", Quality.SDTV },
//{ ".ogm", Quality.SDTV },
//{ ".ogv", Quality.SDTV },
//{ ".m2v", Quality.SDTV },
//{ ".avi", Quality.SDTV },
//{ ".bin", Quality.SDTV },
//{ ".dat", Quality.SDTV },
//{ ".dvr-ms", Quality.SDTV },
//{ ".mpg", Quality.SDTV },
//{ ".mpeg", Quality.SDTV },
//{ ".mp4", Quality.SDTV },
//{ ".avc", Quality.SDTV },
//{ ".vp3", Quality.SDTV },
//{ ".svq3", Quality.SDTV },
//{ ".nuv", Quality.SDTV },
//{ ".viv", Quality.SDTV },
//{ ".dv", Quality.SDTV },
//{ ".fli", Quality.SDTV },
//{ ".flv", Quality.SDTV },
//{ ".wpl", Quality.SDTV },
{ ".m4a", Quality.DVD },
//DVD
//{ ".img", Quality.DVD },
//{ ".iso", Quality.DVD },
//{ ".vob", Quality.DVD },
//HD
//{ ".mkv", Quality.HDTV720p },
//{ ".ts", Quality.HDTV720p },
//{ ".wtv", Quality.HDTV720p },
//Bluray
//{ ".m2ts", Quality.Bluray720p }
{ ".flac", Quality.RAWHD },
}; };
} }

@ -108,7 +108,7 @@ namespace NzbDrone.Core.Organizer
_singleEpisodeFile = new EpisodeFile _singleEpisodeFile = new EpisodeFile
{ {
Quality = new QualityModel(Quality.HDTV720p, new Revision(2)), Quality = new QualityModel(Quality.MP3256, new Revision(2)),
RelativePath = "Series.Title.S01E01.720p.HDTV.x264-EVOLVE.mkv", RelativePath = "Series.Title.S01E01.720p.HDTV.x264-EVOLVE.mkv",
SceneName = "Series.Title.S01E01.720p.HDTV.x264-EVOLVE", SceneName = "Series.Title.S01E01.720p.HDTV.x264-EVOLVE",
ReleaseGroup = "RlsGrp", ReleaseGroup = "RlsGrp",
@ -117,7 +117,7 @@ namespace NzbDrone.Core.Organizer
_multiEpisodeFile = new EpisodeFile _multiEpisodeFile = new EpisodeFile
{ {
Quality = new QualityModel(Quality.HDTV720p, new Revision(2)), Quality = new QualityModel(Quality.MP3256, new Revision(2)),
RelativePath = "Series.Title.S01E01-E03.720p.HDTV.x264-EVOLVE.mkv", RelativePath = "Series.Title.S01E01-E03.720p.HDTV.x264-EVOLVE.mkv",
SceneName = "Series.Title.S01E01-E03.720p.HDTV.x264-EVOLVE", SceneName = "Series.Title.S01E01-E03.720p.HDTV.x264-EVOLVE",
ReleaseGroup = "RlsGrp", ReleaseGroup = "RlsGrp",
@ -126,7 +126,7 @@ namespace NzbDrone.Core.Organizer
_dailyEpisodeFile = new EpisodeFile _dailyEpisodeFile = new EpisodeFile
{ {
Quality = new QualityModel(Quality.HDTV720p, new Revision(2)), Quality = new QualityModel(Quality.MP3256, new Revision(2)),
RelativePath = "Series.Title.2013.10.30.HDTV.x264-EVOLVE.mkv", RelativePath = "Series.Title.2013.10.30.HDTV.x264-EVOLVE.mkv",
SceneName = "Series.Title.2013.10.30.HDTV.x264-EVOLVE", SceneName = "Series.Title.2013.10.30.HDTV.x264-EVOLVE",
ReleaseGroup = "RlsGrp", ReleaseGroup = "RlsGrp",
@ -135,7 +135,7 @@ namespace NzbDrone.Core.Organizer
_animeEpisodeFile = new EpisodeFile _animeEpisodeFile = new EpisodeFile
{ {
Quality = new QualityModel(Quality.HDTV720p, new Revision(2)), Quality = new QualityModel(Quality.MP3256, new Revision(2)),
RelativePath = "[RlsGroup] Series Title - 001 [720p].mkv", RelativePath = "[RlsGroup] Series Title - 001 [720p].mkv",
SceneName = "[RlsGroup] Series Title - 001 [720p]", SceneName = "[RlsGroup] Series Title - 001 [720p]",
ReleaseGroup = "RlsGrp", ReleaseGroup = "RlsGrp",
@ -144,7 +144,7 @@ namespace NzbDrone.Core.Organizer
_animeMultiEpisodeFile = new EpisodeFile _animeMultiEpisodeFile = new EpisodeFile
{ {
Quality = new QualityModel(Quality.HDTV720p, new Revision(2)), Quality = new QualityModel(Quality.MP3256, new Revision(2)),
RelativePath = "[RlsGroup] Series Title - 001 - 103 [720p].mkv", RelativePath = "[RlsGroup] Series Title - 001 - 103 [720p].mkv",
SceneName = "[RlsGroup] Series Title - 001 - 103 [720p]", SceneName = "[RlsGroup] Series Title - 001 - 103 [720p]",
ReleaseGroup = "RlsGrp", ReleaseGroup = "RlsGrp",

@ -1,9 +1,10 @@
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Parser.Model namespace NzbDrone.Core.Parser.Model
{ {
// TODO: This model needs to module music, not TV series
public class ParsedEpisodeInfo public class ParsedEpisodeInfo
{ {
public string SeriesTitle { get; set; } public string SeriesTitle { get; set; }

@ -1,6 +1,5 @@
using System; using System;
using System.IO; using System.IO;
using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using NLog; using NLog;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
@ -40,262 +39,47 @@ namespace NzbDrone.Core.Parser
private static readonly Regex RealRegex = new Regex(@"\b(?<real>REAL)\b", private static readonly Regex RealRegex = new Regex(@"\b(?<real>REAL)\b",
RegexOptions.Compiled); RegexOptions.Compiled);
private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?<R480p>480p|640x480|848x480)|(?<R576p>576p)|(?<R720p>720p|1280x720)|(?<R1080p>1080p|1920x1080)|(?<R2160p>2160p))\b", private static readonly Regex BitRateRegex = new Regex(@"(?:
RegexOptions.Compiled | RegexOptions.IgnoreCase); (?<B192>192[ ]?kbps)|(?<B192>192$)|(?<B192>[\[\(].*192.*[\]\)])|
(?<B256>256[ ]?kbps)|(?<B256>256$)|(?<B256>[\[\(].*256.*[\]\)])|
(?<B320>320[ ]?kbps)|(?<B320>320$)|(?<B320>[\[\(].*320.*[\]\)])|
(?<B512>512[ ]?kbps)|(?<B512>512$)|(?<B512>[\[\(].*512.*[\]\)])|
(?<Flac>flac[-_.\]\b)} ])|(?<Flac>flac$)|
(?<VBR>VBR[ ]?kbps)|(?<VBR>VBR$)|(?<VBR>[\[\(].*VBR.*[\]\)])
)",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
private static readonly Regex CodecRegex = new Regex(@"\b(?:(?<x264>x264)|(?<h264>h264)|(?<xvidhd>XvidHD)|(?<xvid>Xvid)|(?<divx>divx))\b", private static readonly Regex CodecRegex = new Regex(@"\b(?:(?<x264>x264)|(?<h264>h264)|(?<xvidhd>XvidHD)|(?<xvid>Xvid)|(?<divx>divx))\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex OtherSourceRegex = new Regex(@"(?<hdtv>HD[-_. ]TV)|(?<sdtv>SD[-_. ]TV)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex AnimeBlurayRegex = new Regex(@"bd(?:720|1080)|(?<=[-_. (\[])bd(?=[-_. )\]])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex HighDefPdtvRegex = new Regex(@"hr[-_. ]ws", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public static QualityModel ParseQuality(string name) public static QualityModel ParseQuality(string name)
{ {
Logger.Debug("Trying to parse quality for {0}", name); Logger.Debug("Trying to parse quality for {0}", name);
name = name.Trim();
var normalizedName = name.Replace('_', ' ').Trim().ToLower(); var normalizedName = name.Replace('_', ' ').Trim().ToLower();
var result = ParseQualityModifiers(name, normalizedName); var result = ParseQualityModifiers(name, normalizedName);
var bitrate = ParseBitRate(normalizedName);
if (RawHDRegex.IsMatch(normalizedName))
{ switch(bitrate)
result.Quality = Quality.RAWHD; {
return result; case BitRate.B192:
} result.Quality = Quality.MP3192;
break;
var sourceMatch = SourceRegex.Matches(normalizedName).OfType<Match>().LastOrDefault(); case BitRate.B256:
var resolution = ParseResolution(normalizedName); result.Quality = Quality.MP3256;
var codecRegex = CodecRegex.Match(normalizedName); break;
case BitRate.B320:
if (sourceMatch != null && sourceMatch.Success) result.Quality = Quality.MP3320;
{ break;
if (sourceMatch.Groups["bluray"].Success) case BitRate.B512:
{ result.Quality = Quality.MP3512;
if (codecRegex.Groups["xvid"].Success || codecRegex.Groups["divx"].Success) break;
{ case BitRate.Flac:
result.Quality = Quality.DVD; result.Quality = Quality.FLAC;
return result; break;
} case BitRate.VBR:
result.Quality = Quality.MP3VBR;
if (resolution == Resolution.R2160p) break;
{
result.Quality = Quality.Bluray2160p;
return result;
}
if (resolution == Resolution.R1080p)
{
result.Quality = Quality.Bluray1080p;
return result;
}
if (resolution == Resolution.R480P || resolution == Resolution.R576p)
{
result.Quality = Quality.DVD;
return result;
}
result.Quality = Quality.Bluray720p;
return result;
}
if (sourceMatch.Groups["webdl"].Success)
{
if (resolution == Resolution.R2160p)
{
result.Quality = Quality.WEBDL2160p;
return result;
}
if (resolution == Resolution.R1080p)
{
result.Quality = Quality.WEBDL1080p;
return result;
}
if (resolution == Resolution.R720p)
{
result.Quality = Quality.WEBDL720p;
return result;
}
if (name.Contains("[WEBDL]"))
{
result.Quality = Quality.WEBDL720p;
return result;
}
result.Quality = Quality.WEBDL480p;
return result;
}
if (sourceMatch.Groups["hdtv"].Success)
{
if (resolution == Resolution.R2160p)
{
result.Quality = Quality.HDTV2160p;
return result;
}
if (resolution == Resolution.R1080p)
{
result.Quality = Quality.HDTV1080p;
return result;
}
if (resolution == Resolution.R720p)
{
result.Quality = Quality.HDTV720p;
return result;
}
if (name.Contains("[HDTV]"))
{
result.Quality = Quality.HDTV720p;
return result;
}
result.Quality = Quality.SDTV;
return result;
}
if (sourceMatch.Groups["bdrip"].Success ||
sourceMatch.Groups["brrip"].Success)
{
switch (resolution)
{
case Resolution.R720p:
result.Quality = Quality.Bluray720p;
return result;
case Resolution.R1080p:
result.Quality = Quality.Bluray1080p;
return result;
default:
result.Quality = Quality.DVD;
return result;
}
}
if (sourceMatch.Groups["dvd"].Success)
{
result.Quality = Quality.DVD;
return result;
}
if (sourceMatch.Groups["pdtv"].Success ||
sourceMatch.Groups["sdtv"].Success ||
sourceMatch.Groups["dsr"].Success ||
sourceMatch.Groups["tvrip"].Success)
{
if (HighDefPdtvRegex.IsMatch(normalizedName))
{
result.Quality = Quality.HDTV720p;
return result;
}
result.Quality = Quality.SDTV;
return result;
}
}
//Anime Bluray matching
if (AnimeBlurayRegex.Match(normalizedName).Success)
{
if (resolution == Resolution.R480P || resolution == Resolution.R576p || normalizedName.Contains("480p"))
{
result.Quality = Quality.DVD;
return result;
}
if (resolution == Resolution.R1080p || normalizedName.Contains("1080p"))
{
result.Quality = Quality.Bluray1080p;
return result;
}
result.Quality = Quality.Bluray720p;
return result;
}
if (resolution == Resolution.R2160p)
{
result.Quality = Quality.HDTV2160p;
return result;
}
if (resolution == Resolution.R1080p)
{
result.Quality = Quality.HDTV1080p;
return result;
}
if (resolution == Resolution.R720p)
{
result.Quality = Quality.HDTV720p;
return result;
}
if (resolution == Resolution.R480P)
{
result.Quality = Quality.SDTV;
return result;
}
if (codecRegex.Groups["x264"].Success)
{
result.Quality = Quality.SDTV;
return result;
}
if (normalizedName.Contains("848x480"))
{
if (normalizedName.Contains("dvd"))
{
result.Quality = Quality.DVD;
}
result.Quality = Quality.SDTV;
}
if (normalizedName.Contains("1280x720"))
{
if (normalizedName.Contains("bluray"))
{
result.Quality = Quality.Bluray720p;
}
result.Quality = Quality.HDTV720p;
}
if (normalizedName.Contains("1920x1080"))
{
if (normalizedName.Contains("bluray"))
{
result.Quality = Quality.Bluray1080p;
}
result.Quality = Quality.HDTV1080p;
}
if (normalizedName.Contains("bluray720p"))
{
result.Quality = Quality.Bluray720p;
}
if (normalizedName.Contains("bluray1080p"))
{
result.Quality = Quality.Bluray1080p;
}
var otherSourceMatch = OtherSourceMatch(normalizedName);
if (otherSourceMatch != Quality.Unknown)
{
result.Quality = otherSourceMatch;
} }
//Based on extension //Based on extension
@ -316,29 +100,20 @@ namespace NzbDrone.Core.Parser
return result; return result;
} }
private static Resolution ParseResolution(string name) private static BitRate ParseBitRate(string name)
{
var match = ResolutionRegex.Match(name);
if (!match.Success) return Resolution.Unknown;
if (match.Groups["R480p"].Success) return Resolution.R480P;
if (match.Groups["R576p"].Success) return Resolution.R576p;
if (match.Groups["R720p"].Success) return Resolution.R720p;
if (match.Groups["R1080p"].Success) return Resolution.R1080p;
if (match.Groups["R2160p"].Success) return Resolution.R2160p;
return Resolution.Unknown;
}
private static Quality OtherSourceMatch(string name)
{ {
var match = OtherSourceRegex.Match(name); //var nameWithNoSpaces = Regex.Replace(name, @"\s+", "");
var match = BitRateRegex.Match(name);
if (!match.Success) return Quality.Unknown; if (!match.Success) return BitRate.Unknown;
if (match.Groups["sdtv"].Success) return Quality.SDTV; if (match.Groups["B192"].Success) return BitRate.B192;
if (match.Groups["hdtv"].Success) return Quality.HDTV720p; if (match.Groups["B256"].Success) return BitRate.B256;
if (match.Groups["B320"].Success) return BitRate.B320;
if (match.Groups["B512"].Success) return BitRate.B512;
if (match.Groups["Flac"].Success) return BitRate.Flac;
if (match.Groups["VBR"].Success) return BitRate.VBR;
return Quality.Unknown; return BitRate.Unknown;
} }
private static QualityModel ParseQualityModifiers(string name, string normalizedName) private static QualityModel ParseQualityModifiers(string name, string normalizedName)
@ -370,13 +145,14 @@ namespace NzbDrone.Core.Parser
} }
} }
public enum Resolution public enum BitRate
{ {
R480P, B192,
R576p, B256,
R720p, B320,
R1080p, B512,
R2160p, VBR,
Unknown Flac,
Unknown,
} }
} }

@ -85,44 +85,21 @@ namespace NzbDrone.Core.Profiles
_logger.Info("Setting up default quality profiles"); _logger.Info("Setting up default quality profiles");
AddDefaultProfile("Any", Quality.SDTV, AddDefaultProfile("Any",
Quality.SDTV, Quality.MP3192,
Quality.WEBDL480p, Quality.MP3256,
Quality.DVD, Quality.MP3320,
Quality.HDTV720p, Quality.MP3512,
Quality.HDTV1080p, Quality.MP3VBR,
Quality.WEBDL720p, Quality.FLAC);
Quality.WEBDL1080p,
Quality.Bluray720p, AddDefaultProfile("Lossless",
Quality.Bluray1080p); Quality.FLAC);
AddDefaultProfile("SD", Quality.SDTV, AddDefaultProfile("Standard",
Quality.SDTV, Quality.MP3192,
Quality.WEBDL480p, Quality.MP3256,
Quality.DVD); Quality.MP3320);
AddDefaultProfile("HD-720p", Quality.HDTV720p,
Quality.HDTV720p,
Quality.WEBDL720p,
Quality.Bluray720p);
AddDefaultProfile("HD-1080p", Quality.HDTV1080p,
Quality.HDTV1080p,
Quality.WEBDL1080p,
Quality.Bluray1080p);
AddDefaultProfile("Ultra-HD", Quality.HDTV2160p,
Quality.HDTV2160p,
Quality.WEBDL2160p,
Quality.Bluray2160p);
AddDefaultProfile("HD - 720p/1080p", Quality.HDTV720p,
Quality.HDTV720p,
Quality.HDTV1080p,
Quality.WEBDL720p,
Quality.WEBDL1080p,
Quality.Bluray720p,
Quality.Bluray1080p);
} }
} }
} }

@ -56,44 +56,24 @@ namespace NzbDrone.Core.Qualities
} }
public static Quality Unknown => new Quality(0, "Unknown"); public static Quality Unknown => new Quality(0, "Unknown");
public static Quality SDTV => new Quality(1, "SDTV"); public static Quality MP3192 => new Quality(1, "MP3-192");
public static Quality DVD => new Quality(2, "DVD"); public static Quality MP3VBR => new Quality(2, "MP3-VBR");
public static Quality WEBDL1080p => new Quality(3, "WEBDL-1080p"); public static Quality MP3256 => new Quality(3, "MP3-256");
public static Quality HDTV720p => new Quality(4, "HDTV-720p"); public static Quality MP3320 => new Quality(4, "MP3-320");
public static Quality WEBDL720p => new Quality(5, "WEBDL-720p"); public static Quality MP3512 => new Quality(5, "MP3-512");
public static Quality Bluray720p => new Quality(6, "Bluray-720p"); public static Quality FLAC => new Quality(6, "FLAC");
public static Quality Bluray1080p => new Quality(7, "Bluray-1080p");
public static Quality WEBDL480p => new Quality(8, "WEBDL-480p");
public static Quality HDTV1080p => new Quality(9, "HDTV-1080p");
public static Quality RAWHD => new Quality(10, "Raw-HD");
//public static Quality HDTV480p { get { return new Quality(11, "HDTV-480p"); } }
//public static Quality WEBRip480p { get { return new Quality(12, "WEBRip-480p"); } }
//public static Quality Bluray480p { get { return new Quality(13, "Bluray-480p"); } }
//public static Quality WEBRip720p { get { return new Quality(14, "WEBRip-720p"); } }
//public static Quality WEBRip1080p { get { return new Quality(15, "WEBRip-1080p"); } }
public static Quality HDTV2160p => new Quality(16, "HDTV-2160p");
//public static Quality WEBRip2160p { get { return new Quality(17, "WEBRip-2160p"); } }
public static Quality WEBDL2160p => new Quality(18, "WEBDL-2160p");
public static Quality Bluray2160p => new Quality(19, "Bluray-2160p");
static Quality() static Quality()
{ {
All = new List<Quality> All = new List<Quality>
{ {
Unknown, Unknown,
SDTV, MP3192,
DVD, MP3VBR,
WEBDL1080p, MP3256,
HDTV720p, MP3320,
WEBDL720p, MP3512,
Bluray720p, FLAC,
Bluray1080p,
WEBDL480p,
HDTV1080p,
RAWHD,
HDTV2160p,
WEBDL2160p,
Bluray2160p,
}; };
AllLookup = new Quality[All.Select(v => v.Id).Max() + 1]; AllLookup = new Quality[All.Select(v => v.Id).Max() + 1];
@ -105,19 +85,12 @@ namespace NzbDrone.Core.Qualities
DefaultQualityDefinitions = new HashSet<QualityDefinition> DefaultQualityDefinitions = new HashSet<QualityDefinition>
{ {
new QualityDefinition(Quality.Unknown) { Weight = 1, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.Unknown) { Weight = 1, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.SDTV) { Weight = 2, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.MP3192) { Weight = 2, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.WEBDL480p) { Weight = 3, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.MP3VBR) { Weight = 3, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.DVD) { Weight = 4, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.MP3256) { Weight = 4, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.HDTV720p) { Weight = 5, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.MP3320) { Weight = 5, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.HDTV1080p) { Weight = 6, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.MP3512) { Weight = 6, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.RAWHD) { Weight = 7, MinSize = 0, MaxSize = null }, new QualityDefinition(Quality.FLAC) { Weight = 7, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.WEBDL720p) { Weight = 8, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.Bluray720p) { Weight = 9, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.WEBDL1080p) { Weight = 10, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.Bluray1080p) { Weight = 11, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.HDTV2160p) { Weight = 12, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.WEBDL2160p) { Weight = 13, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.Bluray2160p) { Weight = 14, MinSize = 0, MaxSize = null },
}; };
} }
@ -134,7 +107,9 @@ namespace NzbDrone.Core.Qualities
var quality = AllLookup[id]; var quality = AllLookup[id];
if (quality == null) if (quality == null)
{
throw new ArgumentException("ID does not match a known quality", nameof(id)); throw new ArgumentException("ID does not match a known quality", nameof(id));
}
return quality; return quality;
} }
@ -150,3 +125,4 @@ namespace NzbDrone.Core.Qualities
} }
} }
} }

@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
@ -42,9 +42,9 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(1)] [Test, Order(1)]
public void cutoff_should_have_monitored_items() public void cutoff_should_have_monitored_items()
{ {
EnsureProfileCutoff(1, Quality.HDTV720p); EnsureProfileCutoff(1, Quality.MP3256);
var series = EnsureSeries(266189, "The Blacklist", true); var series = EnsureSeries(266189, "The Blacklist", true);
EnsureEpisodeFile(series, 1, 1, Quality.SDTV); EnsureEpisodeFile(series, 1, 1, Quality.MP3192);
var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc"); var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc");
@ -64,9 +64,9 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(1)] [Test, Order(1)]
public void cutoff_should_not_have_unmonitored_items() public void cutoff_should_not_have_unmonitored_items()
{ {
EnsureProfileCutoff(1, Quality.HDTV720p); EnsureProfileCutoff(1, Quality.MP3256);
var series = EnsureSeries(266189, "The Blacklist", false); var series = EnsureSeries(266189, "The Blacklist", false);
EnsureEpisodeFile(series, 1, 1, Quality.SDTV); EnsureEpisodeFile(series, 1, 1, Quality.MP3192);
var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc"); var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc");
@ -76,9 +76,9 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(1)] [Test, Order(1)]
public void cutoff_should_have_series() public void cutoff_should_have_series()
{ {
EnsureProfileCutoff(1, Quality.HDTV720p); EnsureProfileCutoff(1, Quality.MP3256);
var series = EnsureSeries(266189, "The Blacklist", true); var series = EnsureSeries(266189, "The Blacklist", true);
EnsureEpisodeFile(series, 1, 1, Quality.SDTV); EnsureEpisodeFile(series, 1, 1, Quality.MP3192);
var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc"); var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc");
@ -99,9 +99,9 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test, Order(2)] [Test, Order(2)]
public void cutoff_should_have_unmonitored_items() public void cutoff_should_have_unmonitored_items()
{ {
EnsureProfileCutoff(1, Quality.HDTV720p); EnsureProfileCutoff(1, Quality.MP3256);
var series = EnsureSeries(266189, "The Blacklist", false); var series = EnsureSeries(266189, "The Blacklist", false);
EnsureEpisodeFile(series, 1, 1, Quality.SDTV); EnsureEpisodeFile(series, 1, 1, Quality.MP3192);
var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc", "monitored", "false"); var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc", "monitored", "false");

@ -21,6 +21,10 @@
<assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.505.0" newVersion="2.1.505.0" /> <bindingRedirect oldVersion="0.0.0.0-2.1.505.0" newVersion="2.1.505.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.ServiceLocation" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>
Loading…
Cancel
Save