Rename Profiles to QualityProfiles

This commit is contained in:
Qstick 2023-08-14 21:20:03 -05:00
parent a946546793
commit 056c2b5233
90 changed files with 374 additions and 352 deletions

View File

@ -65,10 +65,10 @@ namespace NzbDrone.Core.Test.Datastore
[Test]
public void postgres_where_equal_joined_property()
{
_subject = Where(x => x.Profile.Id == 1);
_subject = Where(x => x.QualityProfile.Id == 1);
_subject.Parameters.ParameterNames.Should().HaveCount(1);
_subject.ToString().Should().Be($"(\"Profiles\".\"Id\" = @Clause1_P1)");
_subject.ToString().Should().Be($"(\"QualityProfiles\".\"Id\" = @Clause1_P1)");
_subject.Parameters.Get<int>("Clause1_P1").Should().Be(1);
}

View File

@ -65,10 +65,10 @@ namespace NzbDrone.Core.Test.Datastore
[Test]
public void where_equal_joined_property()
{
_subject = Where(x => x.Profile.Id == 1);
_subject = Where(x => x.QualityProfile.Id == 1);
_subject.Parameters.ParameterNames.Should().HaveCount(1);
_subject.ToString().Should().Be($"(\"Profiles\".\"Id\" = @Clause1_P1)");
_subject.ToString().Should().Be($"(\"QualityProfiles\".\"Id\" = @Clause1_P1)");
_subject.Parameters.Get<int>("Clause1_P1").Should().Be(1);
}

View File

@ -7,7 +7,7 @@ using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.CustomFormats;
using NzbDrone.Core.Test.Framework;
@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_format2.Id = 2;
var fakeSeries = Builder<Movie>.CreateNew()
.With(c => c.Profile = new Profile
.With(c => c.QualityProfile = new QualityProfile
{
Cutoff = Quality.Bluray1080p.Id,
MinFormatScore = 1
@ -53,8 +53,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_allow_if_format_score_greater_than_min()
{
_remoteMovie.CustomFormats = new List<CustomFormat> { _format1 };
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
}
@ -63,11 +63,11 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_deny_if_format_score_not_greater_than_min()
{
_remoteMovie.CustomFormats = new List<CustomFormat> { _format2 };
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
Console.WriteLine(_remoteMovie.CustomFormatScore);
Console.WriteLine(_remoteMovie.Movie.Profile.MinFormatScore);
Console.WriteLine(_remoteMovie.Movie.QualityProfile.MinFormatScore);
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
}
@ -76,8 +76,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_deny_if_format_score_not_greater_than_min_2()
{
_remoteMovie.CustomFormats = new List<CustomFormat> { _format2, _format1 };
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
}
@ -86,8 +86,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_allow_if_all_format_is_defined_in_profile()
{
_remoteMovie.CustomFormats = new List<CustomFormat> { _format2, _format1 };
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
}
@ -96,8 +96,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_deny_if_no_format_was_parsed_and_min_score_positive()
{
_remoteMovie.CustomFormats = new List<CustomFormat> { };
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
}
@ -106,9 +106,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_allow_if_no_format_was_parsed_min_score_is_zero()
{
_remoteMovie.CustomFormats = new List<CustomFormat> { };
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
_remoteMovie.Movie.Profile.MinFormatScore = 0;
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
_remoteMovie.Movie.QualityProfile.MinFormatScore = 0;
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
}

View File

@ -11,7 +11,7 @@ using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.CustomFormats;
using NzbDrone.Core.Test.Framework;
@ -38,12 +38,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
GivenOldCustomFormats(new List<CustomFormat>());
}
private void GivenProfile(Profile profile)
private void GivenProfile(QualityProfile profile)
{
CustomFormatsTestHelpers.GivenCustomFormats();
profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems();
profile.MinFormatScore = 0;
_remoteMovie.Movie.Profile = profile;
_remoteMovie.Movie.QualityProfile = profile;
Console.WriteLine(profile.ToJson());
}
@ -80,7 +80,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_true_if_current_episode_is_less_than_cutoff()
{
GivenProfile(new Profile
GivenProfile(new QualityProfile
{
Cutoff = Quality.Bluray1080p.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),
@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_if_current_episode_is_equal_to_cutoff()
{
GivenProfile(new Profile
GivenProfile(new QualityProfile
{
Cutoff = Quality.HDTV720p.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),
@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_if_current_episode_is_greater_than_cutoff()
{
GivenProfile(new Profile
GivenProfile(new QualityProfile
{
Cutoff = Quality.HDTV720p.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),
@ -122,7 +122,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_true_when_new_episode_is_proper_but_existing_is_not()
{
GivenProfile(new Profile
GivenProfile(new QualityProfile
{
Cutoff = Quality.HDTV720p.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),
@ -137,7 +137,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_if_cutoff_is_met_and_quality_is_higher()
{
GivenProfile(new Profile
GivenProfile(new QualityProfile
{
Cutoff = Quality.HDTV720p.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),
@ -152,7 +152,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_if_custom_formats_is_met_and_quality_and_format_higher()
{
GivenProfile(new Profile
GivenProfile(new QualityProfile
{
Cutoff = Quality.HDTV720p.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),
@ -175,7 +175,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_true_if_cutoffs_are_met_but_is_a_revision_upgrade()
{
GivenProfile(new Profile
GivenProfile(new QualityProfile
{
Cutoff = Quality.HDTV1080p.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),
@ -191,7 +191,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_if_quality_profile_does_not_allow_upgrades_but_cutoff_is_set_to_highest_quality()
{
GivenProfile(new Profile
GivenProfile(new QualityProfile
{
Cutoff = Quality.RAWHD.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),

View File

@ -12,7 +12,7 @@ using NzbDrone.Core.History;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.CustomFormats;
using NzbDrone.Core.Test.Framework;
@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
CustomFormatsTestHelpers.GivenCustomFormats();
_fakeMovie = Builder<Movie>.CreateNew()
.With(c => c.Profile = new Profile
.With(c => c.QualityProfile = new QualityProfile
{
Items = Qualities.QualityFixture.GetDefaultQualities(),
Cutoff = Quality.Bluray1080p.Id,
@ -159,7 +159,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing()
{
_fakeMovie.Profile = new Profile
_fakeMovie.QualityProfile = new QualityProfile
{
Items = Qualities.QualityFixture.GetDefaultQualities(),
Cutoff = Quality.Bluray1080p.Id,
@ -182,7 +182,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_not_be_upgradable_if_cutoff_already_met()
{
_fakeMovie.Profile = new Profile
_fakeMovie.QualityProfile = new QualityProfile
{
Items = Qualities.QualityFixture.GetDefaultQualities(),
Cutoff = Quality.WEBDL1080p.Id,
@ -217,7 +217,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_return_false_if_cutoff_already_met_and_cdh_is_disabled()
{
GivenCdhDisabled();
_fakeMovie.Profile = new Profile
_fakeMovie.QualityProfile = new QualityProfile
{
Items = Qualities.QualityFixture.GetDefaultQualities(),
Cutoff = Quality.WEBDL1080p.Id,

View File

@ -5,7 +5,7 @@ using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.DecisionEngineTests
@ -27,7 +27,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
},
Movie = new Movie
{
Profile = new Profile
QualityProfile = new QualityProfile
{
Language = Language.English
},
@ -73,7 +73,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_if_release_is_german_and_profile_original()
{
_remoteMovie.Movie.Profile.Language = Language.Original;
_remoteMovie.Movie.QualityProfile.Language = Language.Original;
WithGermanRelease();
@ -83,7 +83,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_true_if_release_is_french_and_profile_original()
{
_remoteMovie.Movie.Profile.Language = Language.Original;
_remoteMovie.Movie.QualityProfile.Language = Language.Original;
WithFrenchRelease();
@ -93,7 +93,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_true_if_allowed_language_any()
{
_remoteMovie.Movie.Profile = new Profile
_remoteMovie.Movie.QualityProfile = new QualityProfile
{
Language = Language.Any
};

View File

@ -13,8 +13,8 @@ using NzbDrone.Core.Indexers;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Delay;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.CustomFormats;
using NzbDrone.Core.Test.Framework;
@ -59,7 +59,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
remoteMovie.ParsedMovieInfo.Year = 1998;
remoteMovie.ParsedMovieInfo.Quality = quality;
remoteMovie.Movie = Builder<Movie>.CreateNew().With(m => m.Profile = new Profile
remoteMovie.Movie = Builder<Movie>.CreateNew().With(m => m.QualityProfile = new QualityProfile
{
Items = Qualities.QualityFixture.GetDefaultQualities(),
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_customFormat1.Name, _customFormat2.Name),
@ -416,7 +416,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
var quality2 = new QualityModel(Quality.Bluray720p);
var remoteMovie2 = GivenRemoteMovie(quality2);
remoteMovie2.CustomFormats.Add(_customFormat1);
remoteMovie2.CustomFormatScore = remoteMovie2.Movie.Profile.CalculateCustomFormatScore(remoteMovie2.CustomFormats);
remoteMovie2.CustomFormatScore = remoteMovie2.Movie.QualityProfile.CalculateCustomFormatScore(remoteMovie2.CustomFormats);
var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteMovie1));
@ -432,12 +432,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
var quality1 = new QualityModel(Quality.Bluray720p);
var remoteMovie1 = GivenRemoteMovie(quality1);
remoteMovie1.CustomFormats.Add(_customFormat1);
remoteMovie1.CustomFormatScore = remoteMovie1.Movie.Profile.CalculateCustomFormatScore(remoteMovie1.CustomFormats);
remoteMovie1.CustomFormatScore = remoteMovie1.Movie.QualityProfile.CalculateCustomFormatScore(remoteMovie1.CustomFormats);
var quality2 = new QualityModel(Quality.Bluray720p);
var remoteMovie2 = GivenRemoteMovie(quality2);
remoteMovie2.CustomFormats.Add(_customFormat2);
remoteMovie2.CustomFormatScore = remoteMovie2.Movie.Profile.CalculateCustomFormatScore(remoteMovie2.CustomFormats);
remoteMovie2.CustomFormatScore = remoteMovie2.Movie.QualityProfile.CalculateCustomFormatScore(remoteMovie2.CustomFormats);
var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteMovie1));
@ -452,11 +452,11 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
var remoteMovie1 = GivenRemoteMovie(new QualityModel(Quality.Bluray720p));
remoteMovie1.CustomFormats.Add(_customFormat1);
remoteMovie1.CustomFormatScore = remoteMovie1.Movie.Profile.CalculateCustomFormatScore(remoteMovie1.CustomFormats);
remoteMovie1.CustomFormatScore = remoteMovie1.Movie.QualityProfile.CalculateCustomFormatScore(remoteMovie1.CustomFormats);
var remoteMovie2 = GivenRemoteMovie(new QualityModel(Quality.Bluray720p));
remoteMovie2.CustomFormats.AddRange(new List<CustomFormat> { _customFormat1, _customFormat2 });
remoteMovie2.CustomFormatScore = remoteMovie2.Movie.Profile.CalculateCustomFormatScore(remoteMovie2.CustomFormats);
remoteMovie2.CustomFormatScore = remoteMovie2.Movie.QualityProfile.CalculateCustomFormatScore(remoteMovie2.CustomFormats);
var decisions = new List<DownloadDecision>();
decisions.Add(new DownloadDecision(remoteMovie1));

View File

@ -4,7 +4,7 @@ using NUnit.Framework;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void Setup()
{
var fakeSeries = Builder<Movie>.CreateNew()
.With(c => c.Profile = new Profile { Cutoff = Quality.Bluray1080p.Id })
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p.Id })
.Build();
_remoteMovie = new RemoteMovie
@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
{
_remoteMovie.ParsedMovieInfo.Quality.Quality = qualityType;
_remoteMovie.Movie.Profile.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p);
_remoteMovie.Movie.QualityProfile.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p);
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
}
@ -59,7 +59,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType)
{
_remoteMovie.ParsedMovieInfo.Quality.Quality = qualityType;
_remoteMovie.Movie.Profile.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p);
_remoteMovie.Movie.QualityProfile.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p);
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
}

View File

@ -5,7 +5,7 @@ using NzbDrone.Core.Configuration;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.CustomFormats;
using NzbDrone.Core.Test.Framework;
@ -70,7 +70,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
GivenAutoDownloadPropers(ProperDownloadTypes.PreferAndUpgrade);
var profile = new Profile
var profile = new QualityProfile
{
Items = Qualities.QualityFixture.GetDefaultQualities(),
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_customFormat1.Name, _customFormat2.Name),
@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
GivenAutoDownloadPropers(ProperDownloadTypes.DoNotUpgrade);
var profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() };
var profile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() };
Subject.IsUpgradable(profile,
new QualityModel(Quality.DVD, new Revision(version: 2)),
@ -103,7 +103,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_if_release_and_existing_file_are_the_same()
{
var profile = new Profile
var profile = new QualityProfile
{
Items = Qualities.QualityFixture.GetDefaultQualities(),
};

View File

@ -11,7 +11,7 @@ using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Queue;
using NzbDrone.Core.Test.CustomFormats;
@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
CustomFormatsTestHelpers.GivenCustomFormats();
_movie = Builder<Movie>.CreateNew()
.With(e => e.Profile = new Profile
.With(e => e.QualityProfile = new QualityProfile
{
Items = Qualities.QualityFixture.GetDefaultQualities(),
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(),
@ -105,7 +105,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_true_when_quality_in_queue_is_lower()
{
_movie.Profile.Cutoff = Quality.Bluray1080p.Id;
_movie.QualityProfile.Cutoff = Quality.Bluray1080p.Id;
var remoteMovie = Builder<RemoteMovie>.CreateNew()
.With(r => r.Movie = _movie)
@ -138,7 +138,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_when_quality_in_queue_is_better()
{
_movie.Profile.Cutoff = Quality.Bluray1080p.Id;
_movie.QualityProfile.Cutoff = Quality.Bluray1080p.Id;
var remoteMovie = Builder<RemoteMovie>.CreateNew()
.With(r => r.Movie = _movie)
@ -155,7 +155,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_if_quality_in_queue_meets_cutoff()
{
_movie.Profile.Cutoff = _remoteMovie.ParsedMovieInfo.Quality.Quality.Id;
_movie.QualityProfile.Cutoff = _remoteMovie.ParsedMovieInfo.Quality.Quality.Id;
var remoteMovie = Builder<RemoteMovie>.CreateNew()
.With(r => r.Movie = _movie)
@ -173,8 +173,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_when_quality_is_better_and_upgrade_allowed_is_false_for_quality_profile()
{
_movie.Profile.Cutoff = Quality.Bluray1080p.Id;
_movie.Profile.UpgradeAllowed = false;
_movie.QualityProfile.Cutoff = Quality.Bluray1080p.Id;
_movie.QualityProfile.UpgradeAllowed = false;
var remoteMovie = Builder<RemoteMovie>.CreateNew()
.With(r => r.Movie = _movie)
@ -191,7 +191,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_true_if_everything_is_the_same_for_failed_pending()
{
_movie.Profile.Cutoff = Quality.Bluray1080p.Id;
_movie.QualityProfile.Cutoff = Quality.Bluray1080p.Id;
var remoteMovie = Builder<RemoteMovie>.CreateNew()
.With(r => r.Movie = _movie)
@ -211,7 +211,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public void should_return_false_if_same_quality_non_proper_in_queue_and_download_propers_is_do_not_upgrade()
{
_remoteMovie.ParsedMovieInfo.Quality = new QualityModel(Quality.HDTV720p, new Revision(2));
_movie.Profile.Cutoff = _remoteMovie.ParsedMovieInfo.Quality.Quality.Id;
_movie.QualityProfile.Cutoff = _remoteMovie.ParsedMovieInfo.Quality.Quality.Id;
Mocker.GetMock<IConfigService>()
.Setup(s => s.DownloadPropersAndRepacks)

View File

@ -13,8 +13,8 @@ using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Delay;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
@ -23,14 +23,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[TestFixture]
public class DelaySpecificationFixture : CoreTest<DelaySpecification>
{
private Profile _profile;
private QualityProfile _profile;
private DelayProfile _delayProfile;
private RemoteMovie _remoteMovie;
[SetUp]
public void Setup()
{
_profile = Builder<Profile>.CreateNew()
_profile = Builder<QualityProfile>.CreateNew()
.Build();
_delayProfile = Builder<DelayProfile>.CreateNew()
@ -38,17 +38,17 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
.Build();
var series = Builder<Movie>.CreateNew()
.With(s => s.Profile = _profile)
.With(s => s.QualityProfile = _profile)
.Build();
_remoteMovie = Builder<RemoteMovie>.CreateNew()
.With(r => r.Movie = series)
.Build();
_profile.Items = new List<ProfileQualityItem>();
_profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p });
_profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p });
_profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p });
_profile.Items = new List<QualityProfileQualityItem>();
_profile.Items.Add(new QualityProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p });
_profile.Items.Add(new QualityProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p });
_profile.Items.Add(new QualityProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p });
_profile.Cutoff = Quality.WEBDL720p.Id;
@ -74,7 +74,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
private void GivenUpgradeForExistingFile()
{
Mocker.GetMock<IUpgradableSpecification>()
.Setup(s => s.IsUpgradable(It.IsAny<Profile>(), It.IsAny<QualityModel>(), It.IsAny<List<CustomFormat>>(), It.IsAny<QualityModel>(), It.IsAny<List<CustomFormat>>()))
.Setup(s => s.IsUpgradable(It.IsAny<QualityProfile>(), It.IsAny<QualityModel>(), It.IsAny<List<CustomFormat>>(), It.IsAny<QualityModel>(), It.IsAny<List<CustomFormat>>()))
.Returns(true);
}

View File

@ -9,7 +9,7 @@ using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
_secondFile = new MovieFile { Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 1)), DateAdded = DateTime.Now };
var fakeSeries = Builder<Movie>.CreateNew()
.With(c => c.Profile = new Profile { Cutoff = Quality.Bluray1080p.Id })
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p.Id })
.With(c => c.MovieFile = _firstFile)
.Build();

View File

@ -4,6 +4,7 @@ using NUnit.Framework;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
@ -14,7 +15,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
private CustomFormat _customFormatOne;
private CustomFormat _customFormatTwo;
private Profile _qualityProfile;
private QualityProfile _qualityProfile;
[SetUp]
public void Setup()
@ -30,7 +31,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
Name = "Two"
};
_qualityProfile = new Profile
_qualityProfile = new QualityProfile
{
Cutoff = Quality.Bluray1080p.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),

View File

@ -9,7 +9,7 @@ using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.CustomFormats;
using NzbDrone.Core.Test.Framework;
@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_firstFile = new MovieFile { Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 2)), DateAdded = DateTime.Now };
var fakeSeries = Builder<Movie>.CreateNew()
.With(c => c.Profile = new Profile
.With(c => c.QualityProfile = new QualityProfile
{
Cutoff = Quality.Bluray1080p.Id, Items = Qualities.QualityFixture.GetDefaultQualities(),
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(),

View File

@ -13,7 +13,7 @@ using NzbDrone.Core.Exceptions;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
movie = GetMovie(1);
}
movie.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() };
movie.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() };
var remoteMovie = new RemoteMovie()
{

View File

@ -9,7 +9,7 @@ using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download.Pending;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
{
private DownloadDecision _temporarilyRejected;
private Movie _movie;
private Profile _profile;
private QualityProfile _profile;
private ReleaseInfo _release;
private ParsedMovieInfo _parsedMovieInfo;
private RemoteMovie _remoteMovie;
@ -32,19 +32,19 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
_movie = Builder<Movie>.CreateNew()
.Build();
_profile = new Profile
_profile = new QualityProfile
{
Name = "Test",
Cutoff = Quality.HDTV720p.Id,
Items = new List<ProfileQualityItem>
Items = new List<QualityProfileQualityItem>
{
new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
new QualityProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
new QualityProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
new QualityProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
},
};
_movie.Profile = _profile;
_movie.QualityProfile = _profile;
_release = Builder<ReleaseInfo>.CreateNew().Build();

View File

@ -9,7 +9,7 @@ using NzbDrone.Core.Download;
using NzbDrone.Core.Download.Pending;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
{
private DownloadDecision _temporarilyRejected;
private Movie _movie;
private Profile _profile;
private QualityProfile _profile;
private ReleaseInfo _release;
private ParsedMovieInfo _parsedMovieInfo;
private RemoteMovie _remoteMovie;
@ -32,19 +32,19 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
_movie = Builder<Movie>.CreateNew()
.Build();
_profile = new Profile
_profile = new QualityProfile
{
Name = "Test",
Cutoff = Quality.HDTV720p.Id,
Items = new List<ProfileQualityItem>
Items = new List<QualityProfileQualityItem>
{
new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
new QualityProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
new QualityProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
new QualityProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
},
};
_movie.Profile = _profile;
_movie.QualityProfile = _profile;
_release = Builder<ReleaseInfo>.CreateNew().Build();

View File

@ -11,7 +11,7 @@ using NzbDrone.Core.Indexers;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
@ -22,7 +22,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
{
private DownloadDecision _temporarilyRejected;
private Movie _movie;
private Profile _profile;
private QualityProfile _profile;
private ReleaseInfo _release;
private ParsedMovieInfo _parsedMovieInfo;
private RemoteMovie _remoteMovie;
@ -33,19 +33,19 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
_movie = Builder<Movie>.CreateNew()
.Build();
_profile = new Profile
_profile = new QualityProfile
{
Name = "Test",
Cutoff = Quality.HDTV720p.Id,
Items = new List<ProfileQualityItem>
Items = new List<QualityProfileQualityItem>
{
new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
new QualityProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
new QualityProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
new QualityProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
},
};
_movie.Profile = _profile;
_movie.QualityProfile = _profile;
_release = Builder<ReleaseInfo>.CreateNew().Build();

View File

@ -11,7 +11,7 @@ using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Test.Qualities;
@ -20,14 +20,14 @@ namespace NzbDrone.Core.Test.HistoryTests
{
public class HistoryServiceFixture : CoreTest<HistoryService>
{
private Profile _profile;
private Profile _profileCustom;
private QualityProfile _profile;
private QualityProfile _profileCustom;
[SetUp]
public void Setup()
{
_profile = new Profile { Cutoff = Quality.WEBDL720p.Id, Items = QualityFixture.GetDefaultQualities() };
_profileCustom = new Profile { Cutoff = Quality.WEBDL720p.Id, Items = QualityFixture.GetDefaultQualities(Quality.DVD) };
_profile = new QualityProfile { Cutoff = Quality.WEBDL720p.Id, Items = QualityFixture.GetDefaultQualities() };
_profileCustom = new QualityProfile { Cutoff = Quality.WEBDL720p.Id, Items = QualityFixture.GetDefaultQualities(Quality.DVD) };
}
[Test]

View File

@ -8,12 +8,13 @@ using NzbDrone.Core.Datastore;
using NzbDrone.Core.Housekeeping.Housekeepers;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
{
[TestFixture]
public class CleanupQualityProfileFormatItemsFixture : DbTest<CleanupQualityProfileFormatItems, Profile>
public class CleanupQualityProfileFormatItemsFixture : DbTest<CleanupQualityProfileFormatItems, QualityProfile>
{
[SetUp]
public void Setup()
@ -28,7 +29,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
[Test]
public void should_remove_orphaned_custom_formats()
{
var qualityProfile = Builder<Profile>.CreateNew()
var qualityProfile = Builder<QualityProfile>.CreateNew()
.With(h => h.Items = Qualities.QualityFixture.GetDefaultQualities())
.With(h => h.MinFormatScore = 50)
.With(h => h.CutoffFormatScore = 100)
@ -63,7 +64,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
Db.Insert(customFormat);
var qualityProfile = Builder<Profile>.CreateNew()
var qualityProfile = Builder<QualityProfile>.CreateNew()
.With(h => h.Items = Qualities.QualityFixture.GetDefaultQualities())
.With(h => h.MinFormatScore = minFormatScore)
.With(h => h.CutoffFormatScore = cutoffFormatScore)
@ -107,7 +108,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
Db.Insert(customFormat1);
Db.Insert(customFormat2);
var qualityProfile = Builder<Profile>.CreateNew()
var qualityProfile = Builder<QualityProfile>.CreateNew()
.With(h => h.Items = Qualities.QualityFixture.GetDefaultQualities())
.With(h => h.MinFormatScore = minFormatScore)
.With(h => h.CutoffFormatScore = cutoffFormatScore)

View File

@ -8,7 +8,7 @@ using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.MovieImport;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport
public void Setup()
{
var movie = Builder<Movie>.CreateNew()
.With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() })
.With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() })
.With(s => s.Path = @"C:\Test\Movies\Movie Title".AsOsAgnostic())
.Build();

View File

@ -15,7 +15,7 @@ using NzbDrone.Core.MediaFiles.MovieImport;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport
var outputPath = @"C:\Test\Unsorted\TV\30.Rock.S01E01".AsOsAgnostic();
var movie = Builder<Movie>.CreateNew()
.With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() })
.With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() })
.With(s => s.Path = @"C:\Test\TV\30 Rock".AsOsAgnostic())
.Build();

View File

@ -12,7 +12,7 @@ using NzbDrone.Core.MediaFiles.MovieImport.Aggregation;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
@ -59,7 +59,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport
_movie = Builder<Movie>.CreateNew()
.With(e => e.Path = @"C:\Test\Movie".AsOsAgnostic())
.With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() })
.With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() })
.Build();
_quality = new QualityModel(Quality.DVD);

View File

@ -9,6 +9,7 @@ using NzbDrone.Core.MediaFiles.MovieImport.Specifications;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
@ -24,7 +25,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications
public void Setup()
{
_movie = Builder<Movie>.CreateNew()
.With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() })
.With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() })
.Build();
_localMovie = new LocalMovie()
@ -142,7 +143,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications
Quality = new QualityModel(Quality.Bluray1080p)
};
_movie.Profile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
_movie.QualityProfile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
{
Format = c,
Score = 10
@ -177,7 +178,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications
Quality = new QualityModel(Quality.Bluray720p)
};
_movie.Profile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
_movie.QualityProfile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
{
Format = c,
Score = 50
@ -212,7 +213,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Specifications
Quality = new QualityModel(Quality.Bluray1080p)
};
_movie.Profile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
_movie.QualityProfile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
{
Format = c,
Score = 50

View File

@ -5,7 +5,7 @@ using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.CustomFormats;
using NzbDrone.Core.Test.Framework;
@ -16,13 +16,13 @@ namespace NzbDrone.Core.Test.MovieTests.MovieRepositoryTests
public class MovieRepositoryFixture : DbTest<MovieRepository, Movie>
{
private IProfileRepository _profileRepository;
private IQualityProfileRepository _profileRepository;
[SetUp]
public void Setup()
{
_profileRepository = Mocker.Resolve<ProfileRepository>();
Mocker.SetConstant<IProfileRepository>(_profileRepository);
_profileRepository = Mocker.Resolve<QualityProfileRepository>();
Mocker.SetConstant<IQualityProfileRepository>(_profileRepository);
Mocker.GetMock<ICustomFormatService>()
.Setup(x => x.All())
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.MovieTests.MovieRepositoryTests
[Test]
public void should_load_quality_profile()
{
var profile = new Profile
var profile = new QualityProfile
{
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p),
FormatItems = CustomFormatsTestHelpers.GetDefaultFormatItems(),
@ -44,11 +44,11 @@ namespace NzbDrone.Core.Test.MovieTests.MovieRepositoryTests
_profileRepository.Insert(profile);
var movie = Builder<Movie>.CreateNew().BuildNew();
movie.ProfileId = profile.Id;
movie.QualityProfileId = profile.Id;
Subject.Insert(movie);
Subject.All().Single().Profile.Should().NotBeNull();
Subject.All().Single().QualityProfile.Should().NotBeNull();
}
}
}

View File

@ -22,7 +22,7 @@ namespace NzbDrone.Core.Test.MovieTests.MovieServiceTests
{
_movies = Builder<Movie>.CreateListOfSize(5)
.All()
.With(s => s.ProfileId = 1)
.With(s => s.QualityProfileId = 1)
.With(s => s.Monitored)
.With(s => s.Path = @"C:\Test\name".AsOsAgnostic())
.With(s => s.RootFolderPath = "")

View File

@ -1,6 +1,6 @@
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.CustomFormats;
using NzbDrone.Core.Test.Framework;
@ -8,7 +8,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Profiles
{
[TestFixture]
public class ProfileRepositoryFixture : DbTest<ProfileRepository, Profile>
public class ProfileRepositoryFixture : DbTest<QualityProfileRepository, QualityProfile>
{
[SetUp]
public void Setup()
@ -18,7 +18,7 @@ namespace NzbDrone.Core.Test.Profiles
[Test]
public void should_be_able_to_read_and_write()
{
var profile = new Profile
var profile = new QualityProfile
{
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p),
MinFormatScore = 0,

View File

@ -10,7 +10,7 @@ using NzbDrone.Core.Languages;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.Collections;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Test.CustomFormats;
using NzbDrone.Core.Test.Framework;
@ -18,7 +18,7 @@ namespace NzbDrone.Core.Test.Profiles
{
[TestFixture]
public class ProfileServiceFixture : CoreTest<ProfileService>
public class ProfileServiceFixture : CoreTest<QualityProfileService>
{
[Test]
public void init_should_add_default_profiles()
@ -29,8 +29,8 @@ namespace NzbDrone.Core.Test.Profiles
Subject.Handle(new ApplicationStartedEvent());
Mocker.GetMock<IProfileRepository>()
.Verify(v => v.Insert(It.IsAny<Profile>()), Times.Exactly(6));
Mocker.GetMock<IQualityProfileRepository>()
.Verify(v => v.Insert(It.IsAny<QualityProfile>()), Times.Exactly(6));
}
[Test]
@ -39,14 +39,14 @@ namespace NzbDrone.Core.Test.Profiles
// We don't want to keep adding them back if a user deleted them on purpose.
public void Init_should_skip_if_any_profiles_already_exist()
{
Mocker.GetMock<IProfileRepository>()
Mocker.GetMock<IQualityProfileRepository>()
.Setup(s => s.All())
.Returns(Builder<Profile>.CreateListOfSize(2).Build().ToList());
.Returns(Builder<QualityProfile>.CreateListOfSize(2).Build().ToList());
Subject.Handle(new ApplicationStartedEvent());
Mocker.GetMock<IProfileRepository>()
.Verify(v => v.Insert(It.IsAny<Profile>()), Times.Never());
Mocker.GetMock<IQualityProfileRepository>()
.Verify(v => v.Insert(It.IsAny<QualityProfile>()), Times.Never());
}
[Test]
@ -54,20 +54,20 @@ namespace NzbDrone.Core.Test.Profiles
{
var movieList = Builder<Movie>.CreateListOfSize(3)
.Random(1)
.With(c => c.ProfileId = 2)
.With(c => c.QualityProfileId = 2)
.Build().ToList();
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
.All()
.With(c => c.ProfileId = 1)
.With(c => c.QualityProfileId = 1)
.Build().ToList();
Mocker.GetMock<IMovieService>().Setup(c => c.GetAllMovies()).Returns(movieList);
Mocker.GetMock<IImportListFactory>().Setup(c => c.All()).Returns(importList);
Assert.Throws<ProfileInUseException>(() => Subject.Delete(2));
Assert.Throws<QualityProfileInUseException>(() => Subject.Delete(2));
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
Mocker.GetMock<IQualityProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
}
[Test]
@ -75,20 +75,20 @@ namespace NzbDrone.Core.Test.Profiles
{
var movieList = Builder<Movie>.CreateListOfSize(3)
.All()
.With(c => c.ProfileId = 1)
.With(c => c.QualityProfileId = 1)
.Build().ToList();
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
.Random(1)
.With(c => c.ProfileId = 2)
.With(c => c.QualityProfileId = 2)
.Build().ToList();
Mocker.GetMock<IMovieService>().Setup(c => c.GetAllMovies()).Returns(movieList);
Mocker.GetMock<IImportListFactory>().Setup(c => c.All()).Returns(importList);
Assert.Throws<ProfileInUseException>(() => Subject.Delete(2));
Assert.Throws<QualityProfileInUseException>(() => Subject.Delete(2));
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
Mocker.GetMock<IQualityProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
}
[Test]
@ -96,12 +96,12 @@ namespace NzbDrone.Core.Test.Profiles
{
var movieList = Builder<Movie>.CreateListOfSize(3)
.All()
.With(c => c.ProfileId = 1)
.With(c => c.QualityProfileId = 1)
.Build().ToList();
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
.Random(1)
.With(c => c.ProfileId = 1)
.With(c => c.QualityProfileId = 1)
.Build().ToList();
var collectionList = Builder<MovieCollection>.CreateListOfSize(3)
@ -113,9 +113,9 @@ namespace NzbDrone.Core.Test.Profiles
Mocker.GetMock<IImportListFactory>().Setup(c => c.All()).Returns(importList);
Mocker.GetMock<IMovieCollectionService>().Setup(c => c.GetAllCollections()).Returns(collectionList);
Assert.Throws<ProfileInUseException>(() => Subject.Delete(2));
Assert.Throws<QualityProfileInUseException>(() => Subject.Delete(2));
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
Mocker.GetMock<IQualityProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
}
[Test]
@ -123,12 +123,12 @@ namespace NzbDrone.Core.Test.Profiles
{
var movieList = Builder<Movie>.CreateListOfSize(3)
.All()
.With(c => c.ProfileId = 2)
.With(c => c.QualityProfileId = 2)
.Build().ToList();
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
.All()
.With(c => c.ProfileId = 2)
.With(c => c.QualityProfileId = 2)
.Build().ToList();
var collectionList = Builder<MovieCollection>.CreateListOfSize(3)
@ -142,15 +142,15 @@ namespace NzbDrone.Core.Test.Profiles
Subject.Delete(1);
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(1), Times.Once());
Mocker.GetMock<IQualityProfileRepository>().Verify(c => c.Delete(1), Times.Once());
}
[Test]
public void get_acceptable_languages_should_return_profile_language()
{
var profile = Builder<Profile>.CreateNew().With(c => c.Language = Language.German).Build();
var profile = Builder<QualityProfile>.CreateNew().With(c => c.Language = Language.German).Build();
Mocker.GetMock<IProfileRepository>()
Mocker.GetMock<IQualityProfileRepository>()
.Setup(s => s.Get(It.IsAny<int>()))
.Returns(profile);
@ -163,7 +163,7 @@ namespace NzbDrone.Core.Test.Profiles
[Test]
public void get_acceptable_languages_should_return_custom_format_positive_languages()
{
var profile = Builder<Profile>.CreateNew()
var profile = Builder<QualityProfile>.CreateNew()
.With(c => c.Language = Language.German)
.Build();
@ -174,7 +174,7 @@ namespace NzbDrone.Core.Test.Profiles
profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(customFormat2.Name);
Mocker.GetMock<IProfileRepository>()
Mocker.GetMock<IQualityProfileRepository>()
.Setup(s => s.Get(It.IsAny<int>()))
.Returns(profile);

View File

@ -1,6 +1,6 @@
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Qualities

View File

@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
@ -65,7 +65,7 @@ namespace NzbDrone.Core.Test.Qualities
i.Should().Be(expected);
}
public static List<ProfileQualityItem> GetDefaultQualities(params Quality[] allowed)
public static List<QualityProfileQualityItem> GetDefaultQualities(params Quality[] allowed)
{
var qualities = new List<Quality>
{
@ -100,7 +100,7 @@ namespace NzbDrone.Core.Test.Qualities
var items = qualities
.Except(allowed)
.Concat(allowed)
.Select(v => new ProfileQualityItem
.Select(v => new QualityProfileQualityItem
{
Quality = v,
Allowed = allowed.Contains(v)

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
@ -19,48 +19,48 @@ namespace NzbDrone.Core.Test.Qualities
private void GivenDefaultProfile()
{
Subject = new QualityModelComparer(new Profile { Items = QualityFixture.GetDefaultQualities() });
Subject = new QualityModelComparer(new QualityProfile { Items = QualityFixture.GetDefaultQualities() });
}
private void GivenCustomProfile()
{
Subject = new QualityModelComparer(new Profile { Items = QualityFixture.GetDefaultQualities(Quality.Bluray720p, Quality.DVD) });
Subject = new QualityModelComparer(new QualityProfile { Items = QualityFixture.GetDefaultQualities(Quality.Bluray720p, Quality.DVD) });
}
private void GivenGroupedProfile()
{
var profile = new Profile
var profile = new QualityProfile
{
Items = new List<ProfileQualityItem>
Items = new List<QualityProfileQualityItem>
{
new ProfileQualityItem
new QualityProfileQualityItem
{
Allowed = false,
Quality = Quality.SDTV
},
new ProfileQualityItem
new QualityProfileQualityItem
{
Allowed = false,
Quality = Quality.DVD
},
new ProfileQualityItem
new QualityProfileQualityItem
{
Allowed = true,
Items = new List<ProfileQualityItem>
Items = new List<QualityProfileQualityItem>
{
new ProfileQualityItem
new QualityProfileQualityItem
{
Allowed = true,
Quality = Quality.HDTV720p
},
new ProfileQualityItem
new QualityProfileQualityItem
{
Allowed = true,
Quality = Quality.WEBDL720p
}
}
},
new ProfileQualityItem
new QualityProfileQualityItem
{
Allowed = true,
Quality = Quality.Bluray720p

View File

@ -0,0 +1,16 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(230)]
public class rename_quality_profiles : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Rename.Table("Profiles").To("QualityProfiles");
Rename.Column("ProfileId").OnTable("Movies").To("QualityProfileId");
Rename.Column("ProfileId").OnTable("ImportLists").To("QualityProfileId");
}
}
}

View File

@ -37,6 +37,7 @@ using NzbDrone.Core.Organizer;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Delay;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Profiles.Releases;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.RemotePathMappings;
@ -141,7 +142,7 @@ namespace NzbDrone.Core.Datastore
Mapper.Entity<CustomFormat>("CustomFormats").RegisterModel();
Mapper.Entity<Profile>("Profiles").RegisterModel();
Mapper.Entity<QualityProfile>("QualityProfiles").RegisterModel();
Mapper.Entity<Log>("Logs").RegisterModel();
Mapper.Entity<NamingConfig>("NamingConfig").RegisterModel();
Mapper.Entity<Blocklist>("Blocklist").RegisterModel();
@ -188,7 +189,7 @@ namespace NzbDrone.Core.Datastore
SqlMapper.AddTypeHandler(new DapperUtcConverter());
SqlMapper.AddTypeHandler(new DapperTimeSpanConverter());
SqlMapper.AddTypeHandler(new DapperQualityIntConverter());
SqlMapper.AddTypeHandler(new EmbeddedDocumentConverter<List<ProfileQualityItem>>(new QualityIntConverter()));
SqlMapper.AddTypeHandler(new EmbeddedDocumentConverter<List<QualityProfileQualityItem>>(new QualityIntConverter()));
SqlMapper.AddTypeHandler(new EmbeddedDocumentConverter<List<ProfileFormatItem>>(new CustomFormatIntConverter()));
SqlMapper.AddTypeHandler(new EmbeddedDocumentConverter<List<ICustomFormatSpecification>>(new CustomFormatSpecificationListConverter()));
SqlMapper.AddTypeHandler(new EmbeddedDocumentConverter<List<IAutoTaggingSpecification>>(new AutoTaggingSpecificationConverter()));

View File

@ -71,10 +71,10 @@ namespace NzbDrone.Core.DecisionEngine
{
if (_configService.DownloadPropersAndRepacks == ProperDownloadTypes.DoNotPrefer)
{
return CompareBy(x.RemoteMovie, y.RemoteMovie, remoteMovie => remoteMovie.Movie.Profile.GetIndex(remoteMovie.ParsedMovieInfo.Quality.Quality));
return CompareBy(x.RemoteMovie, y.RemoteMovie, remoteMovie => remoteMovie.Movie.QualityProfile.GetIndex(remoteMovie.ParsedMovieInfo.Quality.Quality));
}
return CompareAll(CompareBy(x.RemoteMovie, y.RemoteMovie, remoteMovie => remoteMovie.Movie.Profile.GetIndex(remoteMovie.ParsedMovieInfo.Quality.Quality)),
return CompareAll(CompareBy(x.RemoteMovie, y.RemoteMovie, remoteMovie => remoteMovie.Movie.QualityProfile.GetIndex(remoteMovie.ParsedMovieInfo.Quality.Quality)),
CompareBy(x.RemoteMovie, y.RemoteMovie, remoteMovie => remoteMovie.ParsedMovieInfo.Quality.Revision));
}

View File

@ -94,7 +94,7 @@ namespace NzbDrone.Core.DecisionEngine
_aggregationService.Augment(remoteMovie);
remoteMovie.CustomFormats = _formatCalculator.ParseCustomFormat(remoteMovie, remoteMovie.Release.Size);
remoteMovie.CustomFormatScore = remoteMovie?.Movie?.Profile?.CalculateCustomFormatScore(remoteMovie.CustomFormats) ?? 0;
remoteMovie.CustomFormatScore = remoteMovie?.Movie?.QualityProfile?.CalculateCustomFormatScore(remoteMovie.CustomFormats) ?? 0;
remoteMovie.DownloadAllowed = remoteMovie.Movie != null;
decision = GetDecisionForReport(remoteMovie, searchCriteria);

View File

@ -11,7 +11,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
{
var minScore = subject.Movie.Profile.MinFormatScore;
var minScore = subject.Movie.QualityProfile.MinFormatScore;
var score = subject.CustomFormatScore;
if (score < minScore)

View File

@ -26,7 +26,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
{
var profile = subject.Movie.Profile;
var profile = subject.Movie.QualityProfile;
var file = subject.Movie.MovieFile;
if (file != null)

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
{
var wantedLanguage = subject.Movie.Profile.Language;
var wantedLanguage = subject.Movie.QualityProfile.Language;
if (wantedLanguage == Language.Any)
{

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
_logger.Debug("Checking if report meets quality requirements. {0}", subject.ParsedMovieInfo.Quality);
var profile = subject.Movie.Profile;
var profile = subject.Movie.QualityProfile;
var qualityIndex = profile.GetIndex(subject.ParsedMovieInfo.Quality.Quality);
var qualityOrGroup = profile.Items[qualityIndex.Index];

View File

@ -45,7 +45,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
foreach (var queueItem in matchingMovies)
{
var remoteMovie = queueItem.RemoteMovie;
var qualityProfile = subject.Movie.Profile;
var qualityProfile = subject.Movie.QualityProfile;
// To avoid a race make sure it's not FailedPending (failed awaiting removal/search).
// Failed items (already searching for a replacement) won't be part of the queue since
@ -82,7 +82,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
_logger.Debug("Checking if profiles allow upgrading. Queued: {0}", remoteMovie.ParsedMovieInfo.Quality);
if (!_upgradableSpecification.IsUpgradeAllowed(subject.Movie.Profile,
if (!_upgradableSpecification.IsUpgradeAllowed(subject.Movie.QualityProfile,
remoteMovie.ParsedMovieInfo.Quality,
remoteMovie.CustomFormats,
subject.ParsedMovieInfo.Quality,

View File

@ -40,7 +40,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
return Decision.Accept();
}
var profile = subject.Movie.Profile;
var profile = subject.Movie.QualityProfile;
var delayProfile = _delayProfileService.BestForTags(subject.Movie.Tags);
var delay = delayProfile.GetProtocolDelay(subject.Release.DownloadProtocol);
var isPreferredProtocol = subject.Release.DownloadProtocol == delayProfile.PreferredProtocol;

View File

@ -51,12 +51,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
{
var customFormats = _formatService.ParseCustomFormat(mostRecent, subject.Movie);
var cutoffUnmet = _upgradableSpecification.CutoffNotMet(subject.Movie.Profile,
var cutoffUnmet = _upgradableSpecification.CutoffNotMet(subject.Movie.QualityProfile,
mostRecent.Quality,
customFormats,
subject.ParsedMovieInfo.Quality);
var upgradeable = _upgradableSpecification.IsUpgradable(subject.Movie.Profile,
var upgradeable = _upgradableSpecification.IsUpgradable(subject.Movie.QualityProfile,
mostRecent.Quality,
customFormats,
subject.ParsedMovieInfo.Quality,

View File

@ -3,18 +3,18 @@ using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.DecisionEngine.Specifications
{
public interface IUpgradableSpecification
{
bool IsUpgradable(Profile profile, QualityModel currentQuality, List<CustomFormat> currentCustomFormats, QualityModel newQuality, List<CustomFormat> newCustomFormats);
bool CutoffNotMet(Profile profile, QualityModel currentQuality, List<CustomFormat> currentFormats, QualityModel newQuality = null);
bool QualityCutoffNotMet(Profile profile, QualityModel currentQuality, QualityModel newQuality = null);
bool IsUpgradable(QualityProfile profile, QualityModel currentQuality, List<CustomFormat> currentCustomFormats, QualityModel newQuality, List<CustomFormat> newCustomFormats);
bool CutoffNotMet(QualityProfile profile, QualityModel currentQuality, List<CustomFormat> currentFormats, QualityModel newQuality = null);
bool QualityCutoffNotMet(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null);
bool IsRevisionUpgrade(QualityModel currentQuality, QualityModel newQuality);
bool IsUpgradeAllowed(Profile qualityProfile, QualityModel currentQuality, List<CustomFormat> currentCustomFormats, QualityModel newQuality, List<CustomFormat> newCustomFormats);
bool IsUpgradeAllowed(QualityProfile qualityProfile, QualityModel currentQuality, List<CustomFormat> currentCustomFormats, QualityModel newQuality, List<CustomFormat> newCustomFormats);
}
public class UpgradableSpecification : IUpgradableSpecification
@ -28,7 +28,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
_logger = logger;
}
public bool IsUpgradable(Profile profile, QualityModel currentQuality, List<CustomFormat> currentCustomFormats, QualityModel newQuality, List<CustomFormat> newCustomFormats)
public bool IsUpgradable(QualityProfile profile, QualityModel currentQuality, List<CustomFormat> currentCustomFormats, QualityModel newQuality, List<CustomFormat> newCustomFormats)
{
var qualityComparer = new QualityModelComparer(profile);
var qualityCompare = qualityComparer.Compare(newQuality?.Quality, currentQuality.Quality);
@ -82,7 +82,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
return true;
}
public bool QualityCutoffNotMet(Profile profile, QualityModel currentQuality, QualityModel newQuality = null)
public bool QualityCutoffNotMet(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null)
{
var cutoff = profile.UpgradeAllowed ? profile.Cutoff : profile.FirststAllowedQuality().Id;
var cutoffCompare = new QualityModelComparer(profile).Compare(currentQuality.Quality.Id, cutoff);
@ -100,13 +100,13 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
return false;
}
private bool CustomFormatCutoffNotMet(Profile profile, List<CustomFormat> currentFormats)
private bool CustomFormatCutoffNotMet(QualityProfile profile, List<CustomFormat> currentFormats)
{
var score = profile.CalculateCustomFormatScore(currentFormats);
return score < profile.CutoffFormatScore;
}
public bool CutoffNotMet(Profile profile, QualityModel currentQuality, List<CustomFormat> currentFormats, QualityModel newQuality = null)
public bool CutoffNotMet(QualityProfile profile, QualityModel currentQuality, List<CustomFormat> currentFormats, QualityModel newQuality = null)
{
if (QualityCutoffNotMet(profile, currentQuality, newQuality))
{
@ -137,7 +137,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
return false;
}
public bool IsUpgradeAllowed(Profile qualityProfile, QualityModel currentQuality, List<CustomFormat> currentCustomFormats, QualityModel newQuality, List<CustomFormat> newCustomFormats)
public bool IsUpgradeAllowed(QualityProfile qualityProfile, QualityModel currentQuality, List<CustomFormat> currentCustomFormats, QualityModel newQuality, List<CustomFormat> newCustomFormats)
{
var isQualityUpgrade = new QualityModelComparer(qualityProfile).Compare(newQuality, currentQuality) > 0;
var isCustomFormatUpgrade = qualityProfile.CalculateCustomFormatScore(newCustomFormats) > qualityProfile.CalculateCustomFormatScore(currentCustomFormats);

View File

@ -26,7 +26,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
{
var qualityProfile = subject.Movie.Profile;
var qualityProfile = subject.Movie.QualityProfile;
if (subject.Movie.MovieFileId != 0)
{

View File

@ -31,7 +31,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
return Decision.Accept();
}
var profile = subject.Movie.Profile;
var profile = subject.Movie.QualityProfile;
var file = subject.Movie.MovieFile;
file.Movie = subject.Movie;
var customFormats = _formatService.ParseCustomFormat(file);

View File

@ -217,7 +217,7 @@ namespace NzbDrone.Core.Download.Pending
{
var movies = g.First().Movie;
return g.OrderByDescending(e => e.Quality, new QualityModelComparer(movies.Profile))
return g.OrderByDescending(e => e.Quality, new QualityModelComparer(movies.QualityProfile))
.ThenBy(q => PrioritizeDownloadProtocol(q.Movie, q.Protocol))
.First();
});
@ -374,7 +374,7 @@ namespace NzbDrone.Core.Download.Pending
return;
}
var profile = remoteMovie.Movie.Profile;
var profile = remoteMovie.Movie.QualityProfile;
foreach (var existingReport in existingReports)
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.History
@ -58,7 +58,7 @@ namespace NzbDrone.Core.History
{
var builder = new SqlBuilder(_database.DatabaseType)
.Join<MovieHistory, Movie>((h, m) => h.MovieId == m.Id)
.Join<Movie, Profile>((m, p) => m.ProfileId == p.Id)
.Join<Movie, QualityProfile>((m, p) => m.QualityProfileId == p.Id)
.Where<MovieHistory>(h => h.MovieId == movieId);
if (eventType.HasValue)
@ -76,14 +76,14 @@ namespace NzbDrone.Core.History
protected override SqlBuilder PagedBuilder() => new SqlBuilder(_database.DatabaseType)
.Join<MovieHistory, Movie>((h, m) => h.MovieId == m.Id)
.Join<Movie, Profile>((m, p) => m.ProfileId == p.Id)
.Join<Movie, QualityProfile>((m, p) => m.QualityProfileId == p.Id)
.LeftJoin<Movie, MovieMetadata>((m, mm) => m.MovieMetadataId == mm.Id);
protected override IEnumerable<MovieHistory> PagedQuery(SqlBuilder sql) =>
_database.QueryJoined<MovieHistory, Movie, Profile>(sql, (hist, movie, profile) =>
_database.QueryJoined<MovieHistory, Movie, QualityProfile>(sql, (hist, movie, profile) =>
{
hist.Movie = movie;
hist.Movie.Profile = profile;
hist.Movie.QualityProfile = profile;
return hist;
});
@ -96,7 +96,7 @@ namespace NzbDrone.Core.History
{
var builder = new SqlBuilder(_database.DatabaseType)
.Join<MovieHistory, Movie>((h, m) => h.MovieId == m.Id)
.Join<Movie, Profile>((m, p) => m.ProfileId == p.Id)
.Join<Movie, QualityProfile>((m, p) => m.QualityProfileId == p.Id)
.Where<MovieHistory>(x => x.Date >= date);
if (eventType.HasValue)

View File

@ -11,14 +11,14 @@ using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies.Events;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.History
{
public interface IHistoryService
{
QualityModel GetBestQualityInHistory(Profile profile, int movieId);
QualityModel GetBestQualityInHistory(QualityProfile profile, int movieId);
PagingSpec<MovieHistory> Paged(PagingSpec<MovieHistory> pagingSpec);
MovieHistory MostRecentForMovie(int movieId);
MovieHistory MostRecentForDownloadId(string downloadId);
@ -84,7 +84,7 @@ namespace NzbDrone.Core.History
return _historyRepository.GetByMovieId(movieId, eventType);
}
public QualityModel GetBestQualityInHistory(Profile profile, int movieId)
public QualityModel GetBestQualityInHistory(QualityProfile profile, int movieId)
{
var comparer = new QualityModelComparer(profile);
return _historyRepository.GetBestQualityInHistory(movieId)

View File

@ -5,6 +5,7 @@ using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
namespace NzbDrone.Core.Housekeeping.Housekeepers
{
@ -24,7 +25,7 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{
var customFormats = _customFormatRepository.All().ToDictionary(c => c.Id);
var profiles = _repository.All();
var updatedProfiles = new List<Profile>();
var updatedProfiles = new List<QualityProfile>();
foreach (var profile in profiles)
{
@ -77,11 +78,11 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
}
}
public interface IQualityProfileFormatItemsCleanupRepository : IBasicRepository<Profile>
public interface IQualityProfileFormatItemsCleanupRepository : IBasicRepository<QualityProfile>
{
}
public class QualityProfileFormatItemsCleanupRepository : BasicRepository<Profile>, IQualityProfileFormatItemsCleanupRepository
public class QualityProfileFormatItemsCleanupRepository : BasicRepository<QualityProfile>, IQualityProfileFormatItemsCleanupRepository
{
public QualityProfileFormatItemsCleanupRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator)

View File

@ -16,7 +16,7 @@ namespace NzbDrone.Core.ImportLists
public bool EnableAuto { get; set; }
public MonitorTypes Monitor { get; set; }
public MovieStatusType MinimumAvailability { get; set; }
public int ProfileId { get; set; }
public int QualityProfileId { get; set; }
public string RootFolderPath { get; set; }
public bool SearchOnAdd { get; set; }
public override bool Enable => Enabled;

View File

@ -100,7 +100,7 @@ namespace NzbDrone.Core.ImportLists
{
Monitored = monitorType != MonitorTypes.None,
RootFolderPath = importList.RootFolderPath,
ProfileId = importList.ProfileId,
QualityProfileId = importList.QualityProfileId,
MinimumAvailability = importList.MinimumAvailability,
Tags = importList.Tags,
TmdbId = report.TmdbId,

View File

@ -36,7 +36,7 @@ namespace NzbDrone.Core.ImportLists.RSSImport
Name = "IMDb List",
Enabled = Enabled,
EnableAuto = true,
ProfileId = 1,
QualityProfileId = 1,
Implementation = GetType().Name,
Settings = new RSSImportSettings { Link = "https://rss.imdb.com/list/YOURLISTID" },
};
@ -45,7 +45,7 @@ namespace NzbDrone.Core.ImportLists.RSSImport
Name = "IMDb Watchlist",
Enabled = Enabled,
EnableAuto = true,
ProfileId = 1,
QualityProfileId = 1,
Implementation = GetType().Name,
Settings = new RSSImportSettings { Link = "https://rss.imdb.com/user/IMDBUSERID/watchlist" },
};

View File

@ -45,7 +45,7 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
Name = "IMDb Top 250",
Enabled = Enabled,
EnableAuto = true,
ProfileId = 1,
QualityProfileId = 1,
Implementation = GetType().Name,
Settings = new IMDbListSettings { ListId = "top250" },
};
@ -54,7 +54,7 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
Name = "IMDb Popular Movies",
Enabled = Enabled,
EnableAuto = true,
ProfileId = 1,
QualityProfileId = 1,
Implementation = GetType().Name,
Settings = new IMDbListSettings { ListId = "popular" },
};

View File

@ -11,7 +11,7 @@ using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.Translations;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
namespace NzbDrone.Core.IndexerSearch
{
@ -27,14 +27,14 @@ namespace NzbDrone.Core.IndexerSearch
private readonly IMakeDownloadDecision _makeDownloadDecision;
private readonly IMovieService _movieService;
private readonly IMovieTranslationService _movieTranslationService;
private readonly IProfileService _profileService;
private readonly IQualityProfileService _profileService;
private readonly Logger _logger;
public ReleaseSearchService(IIndexerFactory indexerFactory,
IMakeDownloadDecision makeDownloadDecision,
IMovieService movieService,
IMovieTranslationService movieTranslationService,
IProfileService profileService,
IQualityProfileService profileService,
Logger logger)
{
_indexerFactory = indexerFactory;
@ -75,7 +75,7 @@ namespace NzbDrone.Core.IndexerSearch
InteractiveSearch = interactiveSearch
};
var wantedLanguages = _profileService.GetAcceptableLanguages(movie.ProfileId);
var wantedLanguages = _profileService.GetAcceptableLanguages(movie.QualityProfileId);
var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId);
var queryTranlations = new List<string>

View File

@ -61,7 +61,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport
.Where(decision => decision.Approved)
.GroupBy(decision => decision.LocalMovie.Movie.Id)
.SelectMany(group => group
.OrderByDescending(decision => decision.LocalMovie.Quality ?? new QualityModel { Quality = Quality.Unknown }, new QualityModelComparer(group.First().LocalMovie.Movie.Profile))
.OrderByDescending(decision => decision.LocalMovie.Quality ?? new QualityModel { Quality = Quality.Unknown }, new QualityModelComparer(group.First().LocalMovie.Movie.QualityProfile))
.ThenByDescending(decision => decision.LocalMovie.Size))
.ToList();

View File

@ -133,7 +133,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport
else
{
localMovie.CustomFormats = _formatCalculator.ParseCustomFormat(localMovie);
localMovie.CustomFormatScore = localMovie.Movie.Profile?.CalculateCustomFormatScore(localMovie.CustomFormats) ?? 0;
localMovie.CustomFormatScore = localMovie.Movie.QualityProfile?.CalculateCustomFormatScore(localMovie.CustomFormats) ?? 0;
decision = GetDecision(localMovie, downloadClientItem);
}

View File

@ -312,7 +312,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
item.Movie = decision.LocalMovie.Movie;
item.CustomFormats = _formatCalculator.ParseCustomFormat(decision.LocalMovie);
item.CustomFormatScore = item.Movie.Profile?.CalculateCustomFormatScore(item.CustomFormats) ?? 0;
item.CustomFormatScore = item.Movie.QualityProfile?.CalculateCustomFormatScore(item.CustomFormats) ?? 0;
}
item.Quality = decision.LocalMovie.Quality;
@ -369,7 +369,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
// Augment movie file so imported files have all additional information an automatic import would
localMovie = _aggregationService.Augment(localMovie, trackedDownload?.DownloadItem);
localMovie.CustomFormats = _formatCalculator.ParseCustomFormat(localMovie);
localMovie.CustomFormatScore = localMovie.Movie.Profile?.CalculateCustomFormatScore(localMovie.CustomFormats) ?? 0;
localMovie.CustomFormatScore = localMovie.Movie.QualityProfile?.CalculateCustomFormatScore(localMovie.CustomFormats) ?? 0;
// Apply the user-chosen values.
localMovie.Movie = movie;

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Specifications
public Decision IsSatisfiedBy(LocalMovie localMovie, DownloadClientItem downloadClientItem)
{
var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;
var qualityProfile = localMovie.Movie.Profile;
var qualityProfile = localMovie.Movie.QualityProfile;
var qualityComparer = new QualityModelComparer(qualityProfile);
if (localMovie.Movie.MovieFileId > 0)

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
namespace NzbDrone.Core.Movies
{
@ -19,7 +19,7 @@ namespace NzbDrone.Core.Movies
public bool Monitored { get; set; }
public MovieStatusType MinimumAvailability { get; set; }
public int ProfileId { get; set; }
public int QualityProfileId { get; set; }
public string Path { get; set; }
@ -27,7 +27,7 @@ namespace NzbDrone.Core.Movies
public string RootFolderPath { get; set; }
public DateTime Added { get; set; }
public Profile Profile { get; set; }
public QualityProfile QualityProfile { get; set; }
public HashSet<int> Tags { get; set; }
public AddMovieOptions AddOptions { get; set; }
public MovieFile MovieFile { get; set; }
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Movies
public void ApplyChanges(Movie otherMovie)
{
Path = otherMovie.Path;
ProfileId = otherMovie.ProfileId;
QualityProfileId = otherMovie.QualityProfileId;
Monitored = otherMovie.Monitored;
MinimumAvailability = otherMovie.MinimumAvailability;

View File

@ -3,7 +3,7 @@ using System.Linq;
using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Movies
@ -16,9 +16,9 @@ namespace NzbDrone.Core.Movies
public class MovieCutoffService : IMovieCutoffService
{
private readonly IMovieRepository _movieRepository;
private readonly IProfileService _profileService;
private readonly IQualityProfileService _profileService;
public MovieCutoffService(IMovieRepository movieRepository, IProfileService profileService, Logger logger)
public MovieCutoffService(IMovieRepository movieRepository, IQualityProfileService profileService, Logger logger)
{
_movieRepository = movieRepository;
_profileService = profileService;

View File

@ -7,7 +7,7 @@ using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies.AlternativeTitles;
using NzbDrone.Core.Movies.Translations;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Movies
@ -35,11 +35,11 @@ namespace NzbDrone.Core.Movies
public class MovieRepository : BasicRepository<Movie>, IMovieRepository
{
private readonly IProfileRepository _profileRepository;
private readonly IQualityProfileRepository _profileRepository;
private readonly IAlternativeTitleRepository _alternativeTitleRepository;
public MovieRepository(IMainDatabase database,
IProfileRepository profileRepository,
IQualityProfileRepository profileRepository,
IAlternativeTitleRepository alternativeTitleRepository,
IEventAggregator eventAggregator)
: base(database, eventAggregator)
@ -49,17 +49,17 @@ namespace NzbDrone.Core.Movies
}
protected override SqlBuilder Builder() => new SqlBuilder(_database.DatabaseType)
.Join<Movie, Profile>((m, p) => m.ProfileId == p.Id)
.Join<Movie, QualityProfile>((m, p) => m.QualityProfileId == p.Id)
.Join<Movie, MovieMetadata>((m, p) => m.MovieMetadataId == p.Id)
.LeftJoin<Movie, MovieFile>((m, f) => m.Id == f.MovieId)
.LeftJoin<MovieMetadata, AlternativeTitle>((mm, t) => mm.Id == t.MovieMetadataId);
private Movie Map(Dictionary<int, Movie> dict, Movie movie, Profile profile, MovieFile movieFile, AlternativeTitle altTitle = null, MovieTranslation translation = null)
private Movie Map(Dictionary<int, Movie> dict, Movie movie, QualityProfile profile, MovieFile movieFile, AlternativeTitle altTitle = null, MovieTranslation translation = null)
{
if (!dict.TryGetValue(movie.Id, out var movieEntry))
{
movieEntry = movie;
movieEntry.Profile = profile;
movieEntry.QualityProfile = profile;
movieEntry.MovieFile = movieFile;
dict.Add(movieEntry.Id, movieEntry);
}
@ -81,7 +81,7 @@ namespace NzbDrone.Core.Movies
{
var movieDictionary = new Dictionary<int, Movie>();
_ = _database.QueryJoined<Movie, Profile, MovieFile, AlternativeTitle>(
_ = _database.QueryJoined<Movie, QualityProfile, MovieFile, AlternativeTitle>(
builder,
(movie, profile, file, altTitle) => Map(movieDictionary, movie, profile, file, altTitle));
@ -107,7 +107,7 @@ namespace NzbDrone.Core.Movies
{
movie.MovieFile = file;
movie.MovieMetadata = metadata;
movie.Profile = profiles[movie.ProfileId];
movie.QualityProfile = profiles[movie.QualityProfileId];
if (titles.TryGetValue(movie.MovieMetadataId, out var altTitles))
{
@ -143,12 +143,12 @@ namespace NzbDrone.Core.Movies
var movieDictionary = new Dictionary<int, Movie>();
var builder = new SqlBuilder(_database.DatabaseType)
.Join<Movie, Profile>((m, p) => m.ProfileId == p.Id)
.Join<Movie, QualityProfile>((m, p) => m.QualityProfileId == p.Id)
.Join<Movie, MovieMetadata>((m, p) => m.MovieMetadataId == p.Id)
.LeftJoin<Movie, MovieFile>((m, f) => m.Id == f.MovieId)
.Where<MovieMetadata>(x => titles.Contains(x.CleanTitle) || titles.Contains(x.CleanOriginalTitle));
_ = _database.QueryJoined<Movie, Profile, MovieFile>(
_ = _database.QueryJoined<Movie, QualityProfile, MovieFile>(
builder,
(movie, profile, file) => Map(movieDictionary, movie, profile, file));
@ -162,11 +162,11 @@ namespace NzbDrone.Core.Movies
var builder = new SqlBuilder(_database.DatabaseType)
.Join<AlternativeTitle, MovieMetadata>((t, mm) => t.MovieMetadataId == mm.Id)
.Join<MovieMetadata, Movie>((mm, m) => mm.Id == m.MovieMetadataId)
.Join<Movie, Profile>((m, p) => m.ProfileId == p.Id)
.Join<Movie, QualityProfile>((m, p) => m.QualityProfileId == p.Id)
.LeftJoin<Movie, MovieFile>((m, f) => m.Id == f.MovieId)
.Where<AlternativeTitle>(x => titles.Contains(x.CleanTitle));
_ = _database.QueryJoined<AlternativeTitle, Profile, Movie, MovieFile>(
_ = _database.QueryJoined<AlternativeTitle, QualityProfile, Movie, MovieFile>(
builder,
(altTitle, profile, movie, file) =>
{
@ -184,11 +184,11 @@ namespace NzbDrone.Core.Movies
var builder = new SqlBuilder(_database.DatabaseType)
.Join<MovieTranslation, MovieMetadata>((t, mm) => t.MovieMetadataId == mm.Id)
.Join<MovieMetadata, Movie>((mm, m) => mm.Id == m.MovieMetadataId)
.Join<Movie, Profile>((m, p) => m.ProfileId == p.Id)
.Join<Movie, QualityProfile>((m, p) => m.QualityProfileId == p.Id)
.LeftJoin<Movie, MovieFile>((m, f) => m.Id == f.MovieId)
.Where<MovieTranslation>(x => titles.Contains(x.CleanTitle));
_ = _database.QueryJoined<MovieTranslation, Profile, Movie, MovieFile>(
_ = _database.QueryJoined<MovieTranslation, QualityProfile, Movie, MovieFile>(
builder,
(trans, profile, movie, file) =>
{
@ -272,7 +272,7 @@ namespace NzbDrone.Core.Movies
{
foreach (var belowCutoff in profile.QualityIds)
{
clauses.Add(string.Format($"(\"{_table}\".\"ProfileId\" = {profile.ProfileId} AND \"MovieFiles\".\"Quality\" LIKE '%_quality_: {belowCutoff},%')"));
clauses.Add(string.Format($"(\"{_table}\".\"QualityProfileId\" = {profile.ProfileId} AND \"MovieFiles\".\"Quality\" LIKE '%_quality_: {belowCutoff},%')"));
}
}

View File

@ -131,7 +131,7 @@ namespace NzbDrone.Core.Movies
{
TmdbId = m.TmdbId,
Title = m.Title,
ProfileId = collection.QualityProfileId,
QualityProfileId = collection.QualityProfileId,
RootFolderPath = collection.RootFolderPath,
MinimumAvailability = collection.MinimumAvailability,
AddOptions = new AddMovieOptions

View File

@ -142,7 +142,7 @@ namespace NzbDrone.Core.Movies
Title = movieInfo.CollectionTitle,
Monitored = movie.AddOptions?.Monitor == MonitorTypes.MovieAndCollection,
SearchOnAdd = movie.AddOptions?.SearchForMovie ?? false,
QualityProfileId = movie.ProfileId,
QualityProfileId = movie.QualityProfileId,
MinimumAvailability = movie.MinimumAvailability,
RootFolderPath = _folderService.GetBestRootFolderPath(movie.Path).TrimEnd('/', '\\', ' '),
Tags = movie.Tags

View File

@ -1,12 +0,0 @@
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Profiles
{
public class ProfileInUseException : NzbDroneException
{
public ProfileInUseException(int profileId)
: base("Profile [{0}] is in use.", profileId)
{
}
}
}

View File

@ -1,6 +1,6 @@
using System;
namespace NzbDrone.Core.Profiles
namespace NzbDrone.Core.Profiles.Qualities
{
public class QualityIndex : IComparable, IComparable<QualityIndex>
{

View File

@ -5,18 +5,18 @@ using NzbDrone.Core.Datastore;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Profiles
namespace NzbDrone.Core.Profiles.Qualities
{
public class Profile : ModelBase
public class QualityProfile : ModelBase
{
public Profile()
public QualityProfile()
{
FormatItems = new List<ProfileFormatItem>();
}
public string Name { get; set; }
public int Cutoff { get; set; }
public List<ProfileQualityItem> Items { get; set; }
public List<QualityProfileQualityItem> Items { get; set; }
public int MinFormatScore { get; set; }
public int CutoffFormatScore { get; set; }
public List<ProfileFormatItem> FormatItems { get; set; }

View File

@ -0,0 +1,12 @@
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Profiles.Qualities
{
public class QualityProfileInUseException : NzbDroneException
{
public QualityProfileInUseException(int profileId)
: base("QualityProfile [{0}] is in use.", profileId)
{
}
}
}

View File

@ -5,21 +5,21 @@ using NzbDrone.Common.Extensions;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Profiles
namespace NzbDrone.Core.Profiles.Qualities
{
public class ProfileQualityItem : IEmbeddedDocument
public class QualityProfileQualityItem : IEmbeddedDocument
{
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int Id { get; set; }
public string Name { get; set; }
public Quality Quality { get; set; }
public List<ProfileQualityItem> Items { get; set; }
public List<QualityProfileQualityItem> Items { get; set; }
public bool Allowed { get; set; }
public ProfileQualityItem()
public QualityProfileQualityItem()
{
Items = new List<ProfileQualityItem>();
Items = new List<QualityProfileQualityItem>();
}
public List<Quality> GetQualities()

View File

@ -4,18 +4,18 @@ using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Profiles
namespace NzbDrone.Core.Profiles.Qualities
{
public interface IProfileRepository : IBasicRepository<Profile>
public interface IQualityProfileRepository : IBasicRepository<QualityProfile>
{
bool Exists(int id);
}
public class ProfileRepository : BasicRepository<Profile>, IProfileRepository
public class QualityProfileRepository : BasicRepository<QualityProfile>, IQualityProfileRepository
{
private readonly ICustomFormatService _customFormatService;
public ProfileRepository(IMainDatabase database,
public QualityProfileRepository(IMainDatabase database,
IEventAggregator eventAggregator,
ICustomFormatService customFormatService)
: base(database, eventAggregator)
@ -23,7 +23,7 @@ namespace NzbDrone.Core.Profiles
_customFormatService = customFormatService;
}
protected override List<Profile> Query(SqlBuilder builder)
protected override List<QualityProfile> Query(SqlBuilder builder)
{
var cfs = _customFormatService.All().ToDictionary(c => c.Id);
@ -55,7 +55,7 @@ namespace NzbDrone.Core.Profiles
public bool Exists(int id)
{
return Query(x => x.Id == id).Count == 1;
return Query(p => p.Id == id).Count == 1;
}
}
}

View File

@ -11,33 +11,33 @@ using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.Collections;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Profiles
namespace NzbDrone.Core.Profiles.Qualities
{
public interface IProfileService
public interface IQualityProfileService
{
Profile Add(Profile profile);
void Update(Profile profile);
QualityProfile Add(QualityProfile profile);
void Update(QualityProfile profile);
void Delete(int id);
List<Profile> All();
Profile Get(int id);
List<QualityProfile> All();
QualityProfile Get(int id);
bool Exists(int id);
Profile GetDefaultProfile(string name, Quality cutoff = null, params Quality[] allowed);
QualityProfile GetDefaultProfile(string name, Quality cutoff = null, params Quality[] allowed);
List<Language> GetAcceptableLanguages(int profileId);
}
public class ProfileService : IProfileService,
public class QualityProfileService : IQualityProfileService,
IHandle<ApplicationStartedEvent>,
IHandle<CustomFormatAddedEvent>,
IHandle<CustomFormatDeletedEvent>
{
private readonly IProfileRepository _profileRepository;
private readonly IQualityProfileRepository _profileRepository;
private readonly ICustomFormatService _formatService;
private readonly IMovieService _movieService;
private readonly IImportListFactory _importListFactory;
private readonly IMovieCollectionService _collectionService;
private readonly Logger _logger;
public ProfileService(IProfileRepository profileRepository,
public QualityProfileService(IQualityProfileRepository profileRepository,
ICustomFormatService formatService,
IMovieService movieService,
IImportListFactory importListFactory,
@ -52,32 +52,32 @@ namespace NzbDrone.Core.Profiles
_logger = logger;
}
public Profile Add(Profile profile)
public QualityProfile Add(QualityProfile profile)
{
return _profileRepository.Insert(profile);
}
public void Update(Profile profile)
public void Update(QualityProfile profile)
{
_profileRepository.Update(profile);
}
public void Delete(int id)
{
if (_movieService.GetAllMovies().Any(c => c.ProfileId == id) || _importListFactory.All().Any(c => c.ProfileId == id) || _collectionService.GetAllCollections().Any(c => c.QualityProfileId == id))
if (_movieService.GetAllMovies().Any(c => c.QualityProfileId == id) || _importListFactory.All().Any(c => c.QualityProfileId == id) || _collectionService.GetAllCollections().Any(c => c.QualityProfileId == id))
{
throw new ProfileInUseException(id);
throw new QualityProfileInUseException(id);
}
_profileRepository.Delete(id);
}
public List<Profile> All()
public List<QualityProfile> All()
{
return _profileRepository.All().ToList();
}
public Profile Get(int id)
public QualityProfile Get(int id)
{
return _profileRepository.Get(id);
}
@ -209,10 +209,10 @@ namespace NzbDrone.Core.Profiles
Quality.Remux1080p);
}
public Profile GetDefaultProfile(string name, Quality cutoff = null, params Quality[] allowed)
public QualityProfile GetDefaultProfile(string name, Quality cutoff = null, params Quality[] allowed)
{
var groupedQualites = Quality.DefaultQualityDefinitions.GroupBy(q => q.Weight);
var items = new List<ProfileQualityItem>();
var items = new List<QualityProfileQualityItem>();
var groupId = 1000;
var profileCutoff = cutoff == null ? Quality.Unknown.Id : cutoff.Id;
@ -222,17 +222,17 @@ namespace NzbDrone.Core.Profiles
{
var quality = group.First().Quality;
items.Add(new ProfileQualityItem { Quality = group.First().Quality, Allowed = allowed.Contains(quality) });
items.Add(new QualityProfileQualityItem { Quality = group.First().Quality, Allowed = allowed.Contains(quality) });
continue;
}
var groupAllowed = group.Any(g => allowed.Contains(g.Quality));
items.Add(new ProfileQualityItem
items.Add(new QualityProfileQualityItem
{
Id = groupId,
Name = group.First().GroupName,
Items = group.Select(g => new ProfileQualityItem
Items = group.Select(g => new QualityProfileQualityItem
{
Quality = g.Quality,
Allowed = groupAllowed
@ -254,7 +254,7 @@ namespace NzbDrone.Core.Profiles
Format = format
}).ToList();
var qualityProfile = new Profile
var qualityProfile = new QualityProfile
{
Name = name,
Cutoff = profileCutoff,
@ -286,7 +286,7 @@ namespace NzbDrone.Core.Profiles
return wantedTitleLanguages;
}
private Profile AddDefaultProfile(string name, Quality cutoff, params Quality[] allowed)
private QualityProfile AddDefaultProfile(string name, Quality cutoff, params Quality[] allowed)
{
var profile = GetDefaultProfile(name, cutoff, allowed);

View File

@ -1,14 +1,14 @@
using System.Collections.Generic;
using NzbDrone.Common.EnsureThat;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
namespace NzbDrone.Core.Qualities
{
public class QualityModelComparer : IComparer<Quality>, IComparer<QualityModel>
{
private readonly Profile _profile;
private readonly QualityProfile _profile;
public QualityModelComparer(Profile profile)
public QualityModelComparer(QualityProfile profile)
{
Ensure.That(profile, () => profile).IsNotNull();
Ensure.That(profile.Items, () => profile.Items).HasItems();

View File

@ -1,13 +1,13 @@
using FluentValidation.Validators;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
namespace NzbDrone.Core.Validation
{
public class ProfileExistsValidator : PropertyValidator
{
private readonly IProfileService _profileService;
private readonly IQualityProfileService _profileService;
public ProfileExistsValidator(IProfileService profileService)
public ProfileExistsValidator(IQualityProfileService profileService)
{
_profileService = profileService;
}

View File

@ -52,7 +52,7 @@ namespace Radarr.Api.V3.History
if (model.Movie != null)
{
resource.QualityCutoffNotMet = _upgradableSpecification.QualityCutoffNotMet(model.Movie.Profile, model.Quality);
resource.QualityCutoffNotMet = _upgradableSpecification.QualityCutoffNotMet(model.Movie.QualityProfile, model.Quality);
}
return resource;

View File

@ -39,7 +39,7 @@ namespace Radarr.Api.V3.History
}
var customFormats = formatCalculator.ParseCustomFormat(model, model.Movie);
var customFormatScore = model.Movie.Profile.CalculateCustomFormatScore(customFormats);
var customFormatScore = model.Movie.QualityProfile.CalculateCustomFormatScore(customFormats);
return new HistoryResource
{

View File

@ -7,7 +7,7 @@ namespace Radarr.Api.V3.ImportLists
{
public bool? EnableAuto { get; set; }
public string RootFolderPath { get; set; }
public int? ProfileId { get; set; }
public int? QualityProfileId { get; set; }
}
public class ImportListBulkResourceMapper : ProviderBulkResourceMapper<ImportListBulkResource, ImportListDefinition>
@ -23,7 +23,7 @@ namespace Radarr.Api.V3.ImportLists
{
existing.EnableAuto = resource.EnableAuto ?? existing.EnableAuto;
existing.RootFolderPath = resource.RootFolderPath ?? existing.RootFolderPath;
existing.ProfileId = resource.ProfileId ?? existing.ProfileId;
existing.QualityProfileId = resource.QualityProfileId ?? existing.QualityProfileId;
});
return existingDefinitions;

View File

@ -34,7 +34,7 @@ namespace Radarr.Api.V3.ImportLists
resource.Monitor = definition.Monitor;
resource.SearchOnAdd = definition.SearchOnAdd;
resource.RootFolderPath = definition.RootFolderPath;
resource.QualityProfileId = definition.ProfileId;
resource.QualityProfileId = definition.QualityProfileId;
resource.MinimumAvailability = definition.MinimumAvailability;
resource.ListType = definition.ListType;
resource.ListOrder = (int)definition.ListType;
@ -57,7 +57,7 @@ namespace Radarr.Api.V3.ImportLists
definition.Monitor = resource.Monitor;
definition.SearchOnAdd = resource.SearchOnAdd;
definition.RootFolderPath = resource.RootFolderPath;
definition.ProfileId = resource.QualityProfileId;
definition.QualityProfileId = resource.QualityProfileId;
definition.MinimumAvailability = resource.MinimumAvailability;
definition.ListType = resource.ListType;
definition.MinRefreshInterval = resource.MinRefreshInterval;

View File

@ -12,7 +12,7 @@ using NzbDrone.Core.Indexers;
using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Validation;
using Radarr.Http;
using HttpStatusCode = System.Net.HttpStatusCode;
@ -39,7 +39,7 @@ namespace Radarr.Api.V3.Indexers
IDownloadService downloadService,
IMovieService movieService,
ICacheManager cacheManager,
IProfileService qualityProfileService,
IQualityProfileService qualityProfileService,
Logger logger)
: base(qualityProfileService)
{

View File

@ -2,16 +2,16 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using Radarr.Http.REST;
namespace Radarr.Api.V3.Indexers
{
public abstract class ReleaseControllerBase : RestController<ReleaseResource>
{
private readonly Profile _qualityProfile;
private readonly QualityProfile _qualityProfile;
public ReleaseControllerBase(IProfileService qualityProfileService)
public ReleaseControllerBase(IQualityProfileService qualityProfileService)
{
_qualityProfile = qualityProfileService.GetDefaultProfile(string.Empty);
}

View File

@ -10,7 +10,7 @@ using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using Radarr.Http;
namespace Radarr.Api.V3.Indexers
@ -28,7 +28,7 @@ namespace Radarr.Api.V3.Indexers
public ReleasePushController(IMakeDownloadDecision downloadDecisionMaker,
IProcessDownloadDecisions downloadDecisionProcessor,
IIndexerFactory indexerFactory,
IProfileService qualityProfileService,
IQualityProfileService qualityProfileService,
Logger logger)
: base(qualityProfileService)
{

View File

@ -39,7 +39,7 @@ namespace Radarr.Api.V3.ManualImport
}
var customFormats = model.CustomFormats;
var customFormatScore = model.Movie?.Profile?.CalculateCustomFormatScore(customFormats) ?? 0;
var customFormatScore = model.Movie?.QualityProfile?.CalculateCustomFormatScore(customFormats) ?? 0;
return new ManualImportResource
{

View File

@ -56,7 +56,7 @@ namespace Radarr.Api.V3.MovieFiles
var resource = movieFile.ToResource(movie, _qualityUpgradableSpecification);
var customFormats = _formatCalculator.ParseCustomFormat(movieFile);
var customFormatScore = movie?.Profile?.CalculateCustomFormatScore(customFormats) ?? 0;
var customFormatScore = movie?.QualityProfile?.CalculateCustomFormatScore(customFormats) ?? 0;
resource.CustomFormats = customFormats.ToResource(false);
resource.CustomFormatScore = customFormatScore;
@ -85,7 +85,7 @@ namespace Radarr.Api.V3.MovieFiles
file.Movie = movie;
var customFormats = _formatCalculator.ParseCustomFormat(file);
var customFormatScore = movie?.Profile?.CalculateCustomFormatScore(customFormats) ?? 0;
var customFormatScore = movie?.QualityProfile?.CalculateCustomFormatScore(customFormats) ?? 0;
resource.CustomFormats = customFormats.ToResource(false);
resource.CustomFormatScore = customFormatScore;

View File

@ -83,7 +83,7 @@ namespace Radarr.Api.V3.MovieFiles
Edition = model.Edition,
ReleaseGroup = model.ReleaseGroup,
MediaInfo = model.MediaInfo.ToResource(model.SceneName),
QualityCutoffNotMet = upgradableSpecification?.QualityCutoffNotMet(movie.Profile, model.Quality) ?? false,
QualityCutoffNotMet = upgradableSpecification?.QualityCutoffNotMet(movie.QualityProfile, model.Quality) ?? false,
OriginalFilePath = model.OriginalFilePath
};
}

View File

@ -39,7 +39,7 @@ namespace Radarr.Api.V3.Movies
if (resource.QualityProfileId.HasValue)
{
movie.ProfileId = resource.QualityProfileId.Value;
movie.QualityProfileId = resource.QualityProfileId.Value;
}
if (resource.MinimumAvailability.HasValue)

View File

@ -119,7 +119,7 @@ namespace Radarr.Api.V3.Movies
SecondaryYear = model.MovieMetadata.Value.SecondaryYear,
Path = model.Path,
QualityProfileId = model.ProfileId,
QualityProfileId = model.QualityProfileId,
Monitored = model.Monitored,
MinimumAvailability = model.MinimumAvailability,
@ -183,7 +183,7 @@ namespace Radarr.Api.V3.Movies
},
Path = resource.Path,
ProfileId = resource.QualityProfileId,
QualityProfileId = resource.QualityProfileId,
Monitored = resource.Monitored,
MinimumAvailability = resource.MinimumAvailability,

View File

@ -54,7 +54,7 @@ namespace Radarr.Api.V3.Parse
_aggregationService.Augment(remoteMovie);
remoteMovie.CustomFormats = _formatCalculator.ParseCustomFormat(remoteMovie, 0);
remoteMovie.CustomFormatScore = remoteMovie.Movie?.Profile?.CalculateCustomFormatScore(remoteMovie.CustomFormats) ?? 0;
remoteMovie.CustomFormatScore = remoteMovie.Movie?.QualityProfile?.CalculateCustomFormatScore(remoteMovie.CustomFormats) ?? 0;
return new ParseResource
{

View File

@ -4,7 +4,7 @@ using FluentValidation;
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using Radarr.Http;
using Radarr.Http.REST;
using Radarr.Http.REST.Attributes;
@ -14,10 +14,10 @@ namespace Radarr.Api.V3.Profiles.Quality
[V3ApiController]
public class QualityProfileController : RestController<QualityProfileResource>
{
private readonly IProfileService _profileService;
private readonly IQualityProfileService _profileService;
private readonly ICustomFormatService _formatService;
public QualityProfileController(IProfileService profileService, ICustomFormatService formatService)
public QualityProfileController(IQualityProfileService profileService, ICustomFormatService formatService)
{
_profileService = profileService;
_formatService = formatService;

View File

@ -3,6 +3,7 @@ using System.Linq;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using Radarr.Http.REST;
namespace Radarr.Api.V3.Profiles.Quality
@ -41,7 +42,7 @@ namespace Radarr.Api.V3.Profiles.Quality
public static class ProfileResourceMapper
{
public static QualityProfileResource ToResource(this Profile model)
public static QualityProfileResource ToResource(this QualityProfile model)
{
if (model == null)
{
@ -62,7 +63,7 @@ namespace Radarr.Api.V3.Profiles.Quality
};
}
public static QualityProfileQualityItemResource ToResource(this ProfileQualityItem model)
public static QualityProfileQualityItemResource ToResource(this QualityProfileQualityItem model)
{
if (model == null)
{
@ -89,14 +90,14 @@ namespace Radarr.Api.V3.Profiles.Quality
};
}
public static Profile ToModel(this QualityProfileResource resource)
public static QualityProfile ToModel(this QualityProfileResource resource)
{
if (resource == null)
{
return null;
}
return new Profile
return new QualityProfile
{
Id = resource.Id,
Name = resource.Name,
@ -110,14 +111,14 @@ namespace Radarr.Api.V3.Profiles.Quality
};
}
public static ProfileQualityItem ToModel(this QualityProfileQualityItemResource resource)
public static QualityProfileQualityItem ToModel(this QualityProfileQualityItemResource resource)
{
if (resource == null)
{
return null;
}
return new ProfileQualityItem
return new QualityProfileQualityItem
{
Id = resource.Id,
Name = resource.Name,
@ -136,7 +137,7 @@ namespace Radarr.Api.V3.Profiles.Quality
};
}
public static List<QualityProfileResource> ToResource(this IEnumerable<Profile> models)
public static List<QualityProfileResource> ToResource(this IEnumerable<QualityProfile> models)
{
return models.Select(ToResource).ToList();
}

View File

@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using Radarr.Http;
namespace Radarr.Api.V3.Profiles.Quality
@ -7,9 +7,9 @@ namespace Radarr.Api.V3.Profiles.Quality
[V3ApiController("qualityprofile/schema")]
public class QualityProfileSchemaController : Controller
{
private readonly IProfileService _profileService;
private readonly IQualityProfileService _profileService;
public QualityProfileSchemaController(IProfileService profileService)
public QualityProfileSchemaController(IQualityProfileService profileService)
{
_profileService = profileService;
}

View File

@ -11,7 +11,7 @@ using NzbDrone.Core.Download.Pending;
using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Queue;
using NzbDrone.SignalR;
@ -39,7 +39,7 @@ namespace Radarr.Api.V3.Queue
public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
IQueueService queueService,
IPendingReleaseService pendingReleaseService,
ProfileService qualityProfileService,
QualityProfileService qualityProfileService,
ITrackedDownloadService trackedDownloadService,
IFailedDownloadService failedDownloadService,
IIgnoredDownloadService ignoredDownloadService,

View File

@ -47,7 +47,7 @@ namespace Radarr.Api.V3.Queue
}
var customFormats = model.RemoteMovie?.CustomFormats;
var customFormatScore = model.Movie?.Profile?.CalculateCustomFormatScore(customFormats) ?? 0;
var customFormatScore = model.Movie?.QualityProfile?.CalculateCustomFormatScore(customFormats) ?? 0;
return new QueueResource
{