mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Rename Profiles to QualityProfiles
This commit is contained in:
parent
a946546793
commit
056c2b5233
@ -65,10 +65,10 @@ public void postgres_where_equal_property()
|
|||||||
[Test]
|
[Test]
|
||||||
public void postgres_where_equal_joined_property()
|
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.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);
|
_subject.Parameters.Get<int>("Clause1_P1").Should().Be(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,10 +65,10 @@ public void where_equal_property()
|
|||||||
[Test]
|
[Test]
|
||||||
public void where_equal_joined_property()
|
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.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);
|
_subject.Parameters.Get<int>("Clause1_P1").Should().Be(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormats;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
@ -33,7 +33,7 @@ public void Setup()
|
|||||||
_format2.Id = 2;
|
_format2.Id = 2;
|
||||||
|
|
||||||
var fakeSeries = Builder<Movie>.CreateNew()
|
var fakeSeries = Builder<Movie>.CreateNew()
|
||||||
.With(c => c.Profile = new Profile
|
.With(c => c.QualityProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Cutoff = Quality.Bluray1080p.Id,
|
Cutoff = Quality.Bluray1080p.Id,
|
||||||
MinFormatScore = 1
|
MinFormatScore = 1
|
||||||
@ -53,8 +53,8 @@ public void Setup()
|
|||||||
public void should_allow_if_format_score_greater_than_min()
|
public void should_allow_if_format_score_greater_than_min()
|
||||||
{
|
{
|
||||||
_remoteMovie.CustomFormats = new List<CustomFormat> { _format1 };
|
_remoteMovie.CustomFormats = new List<CustomFormat> { _format1 };
|
||||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
|
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
|
||||||
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
@ -63,11 +63,11 @@ public void should_allow_if_format_score_greater_than_min()
|
|||||||
public void should_deny_if_format_score_not_greater_than_min()
|
public void should_deny_if_format_score_not_greater_than_min()
|
||||||
{
|
{
|
||||||
_remoteMovie.CustomFormats = new List<CustomFormat> { _format2 };
|
_remoteMovie.CustomFormats = new List<CustomFormat> { _format2 };
|
||||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
|
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
|
||||||
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
||||||
|
|
||||||
Console.WriteLine(_remoteMovie.CustomFormatScore);
|
Console.WriteLine(_remoteMovie.CustomFormatScore);
|
||||||
Console.WriteLine(_remoteMovie.Movie.Profile.MinFormatScore);
|
Console.WriteLine(_remoteMovie.Movie.QualityProfile.MinFormatScore);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
@ -76,8 +76,8 @@ public void should_deny_if_format_score_not_greater_than_min()
|
|||||||
public void should_deny_if_format_score_not_greater_than_min_2()
|
public void should_deny_if_format_score_not_greater_than_min_2()
|
||||||
{
|
{
|
||||||
_remoteMovie.CustomFormats = new List<CustomFormat> { _format2, _format1 };
|
_remoteMovie.CustomFormats = new List<CustomFormat> { _format2, _format1 };
|
||||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
|
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name);
|
||||||
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
@ -86,8 +86,8 @@ public void should_deny_if_format_score_not_greater_than_min_2()
|
|||||||
public void should_allow_if_all_format_is_defined_in_profile()
|
public void should_allow_if_all_format_is_defined_in_profile()
|
||||||
{
|
{
|
||||||
_remoteMovie.CustomFormats = new List<CustomFormat> { _format2, _format1 };
|
_remoteMovie.CustomFormats = new List<CustomFormat> { _format2, _format1 };
|
||||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
|
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
|
||||||
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
@ -96,8 +96,8 @@ public void should_allow_if_all_format_is_defined_in_profile()
|
|||||||
public void should_deny_if_no_format_was_parsed_and_min_score_positive()
|
public void should_deny_if_no_format_was_parsed_and_min_score_positive()
|
||||||
{
|
{
|
||||||
_remoteMovie.CustomFormats = new List<CustomFormat> { };
|
_remoteMovie.CustomFormats = new List<CustomFormat> { };
|
||||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
|
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
|
||||||
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
@ -106,9 +106,9 @@ public void should_deny_if_no_format_was_parsed_and_min_score_positive()
|
|||||||
public void should_allow_if_no_format_was_parsed_min_score_is_zero()
|
public void should_allow_if_no_format_was_parsed_min_score_is_zero()
|
||||||
{
|
{
|
||||||
_remoteMovie.CustomFormats = new List<CustomFormat> { };
|
_remoteMovie.CustomFormats = new List<CustomFormat> { };
|
||||||
_remoteMovie.Movie.Profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
|
_remoteMovie.Movie.QualityProfile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_format1.Name, _format2.Name);
|
||||||
_remoteMovie.Movie.Profile.MinFormatScore = 0;
|
_remoteMovie.Movie.QualityProfile.MinFormatScore = 0;
|
||||||
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.Profile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
_remoteMovie.CustomFormatScore = _remoteMovie.Movie.QualityProfile.CalculateCustomFormatScore(_remoteMovie.CustomFormats);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormats;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
@ -38,12 +38,12 @@ public void Setup()
|
|||||||
GivenOldCustomFormats(new List<CustomFormat>());
|
GivenOldCustomFormats(new List<CustomFormat>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenProfile(Profile profile)
|
private void GivenProfile(QualityProfile profile)
|
||||||
{
|
{
|
||||||
CustomFormatsTestHelpers.GivenCustomFormats();
|
CustomFormatsTestHelpers.GivenCustomFormats();
|
||||||
profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems();
|
profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems();
|
||||||
profile.MinFormatScore = 0;
|
profile.MinFormatScore = 0;
|
||||||
_remoteMovie.Movie.Profile = profile;
|
_remoteMovie.Movie.QualityProfile = profile;
|
||||||
|
|
||||||
Console.WriteLine(profile.ToJson());
|
Console.WriteLine(profile.ToJson());
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ private void GivenCustomFormatHigher()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_if_current_episode_is_less_than_cutoff()
|
public void should_return_true_if_current_episode_is_less_than_cutoff()
|
||||||
{
|
{
|
||||||
GivenProfile(new Profile
|
GivenProfile(new QualityProfile
|
||||||
{
|
{
|
||||||
Cutoff = Quality.Bluray1080p.Id,
|
Cutoff = Quality.Bluray1080p.Id,
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
@ -94,7 +94,7 @@ public void should_return_true_if_current_episode_is_less_than_cutoff()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_if_current_episode_is_equal_to_cutoff()
|
public void should_return_false_if_current_episode_is_equal_to_cutoff()
|
||||||
{
|
{
|
||||||
GivenProfile(new Profile
|
GivenProfile(new QualityProfile
|
||||||
{
|
{
|
||||||
Cutoff = Quality.HDTV720p.Id,
|
Cutoff = Quality.HDTV720p.Id,
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
@ -108,7 +108,7 @@ public void should_return_false_if_current_episode_is_equal_to_cutoff()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_if_current_episode_is_greater_than_cutoff()
|
public void should_return_false_if_current_episode_is_greater_than_cutoff()
|
||||||
{
|
{
|
||||||
GivenProfile(new Profile
|
GivenProfile(new QualityProfile
|
||||||
{
|
{
|
||||||
Cutoff = Quality.HDTV720p.Id,
|
Cutoff = Quality.HDTV720p.Id,
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
@ -122,7 +122,7 @@ public void should_return_false_if_current_episode_is_greater_than_cutoff()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_when_new_episode_is_proper_but_existing_is_not()
|
public void should_return_true_when_new_episode_is_proper_but_existing_is_not()
|
||||||
{
|
{
|
||||||
GivenProfile(new Profile
|
GivenProfile(new QualityProfile
|
||||||
{
|
{
|
||||||
Cutoff = Quality.HDTV720p.Id,
|
Cutoff = Quality.HDTV720p.Id,
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
@ -137,7 +137,7 @@ public void should_return_true_when_new_episode_is_proper_but_existing_is_not()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_if_cutoff_is_met_and_quality_is_higher()
|
public void should_return_false_if_cutoff_is_met_and_quality_is_higher()
|
||||||
{
|
{
|
||||||
GivenProfile(new Profile
|
GivenProfile(new QualityProfile
|
||||||
{
|
{
|
||||||
Cutoff = Quality.HDTV720p.Id,
|
Cutoff = Quality.HDTV720p.Id,
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
@ -152,7 +152,7 @@ public void should_return_false_if_cutoff_is_met_and_quality_is_higher()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_if_custom_formats_is_met_and_quality_and_format_higher()
|
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,
|
Cutoff = Quality.HDTV720p.Id,
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
@ -175,7 +175,7 @@ public void should_return_false_if_custom_formats_is_met_and_quality_and_format_
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_if_cutoffs_are_met_but_is_a_revision_upgrade()
|
public void should_return_true_if_cutoffs_are_met_but_is_a_revision_upgrade()
|
||||||
{
|
{
|
||||||
GivenProfile(new Profile
|
GivenProfile(new QualityProfile
|
||||||
{
|
{
|
||||||
Cutoff = Quality.HDTV1080p.Id,
|
Cutoff = Quality.HDTV1080p.Id,
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
@ -191,7 +191,7 @@ public void should_return_true_if_cutoffs_are_met_but_is_a_revision_upgrade()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_if_quality_profile_does_not_allow_upgrades_but_cutoff_is_set_to_highest_quality()
|
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,
|
Cutoff = Quality.RAWHD.Id,
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormats;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
@ -41,7 +41,7 @@ public void Setup()
|
|||||||
CustomFormatsTestHelpers.GivenCustomFormats();
|
CustomFormatsTestHelpers.GivenCustomFormats();
|
||||||
|
|
||||||
_fakeMovie = Builder<Movie>.CreateNew()
|
_fakeMovie = Builder<Movie>.CreateNew()
|
||||||
.With(c => c.Profile = new Profile
|
.With(c => c.QualityProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
Cutoff = Quality.Bluray1080p.Id,
|
Cutoff = Quality.Bluray1080p.Id,
|
||||||
@ -159,7 +159,7 @@ public void should_be_not_upgradable_if_only_second_episodes_is_upgradable()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing()
|
public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing()
|
||||||
{
|
{
|
||||||
_fakeMovie.Profile = new Profile
|
_fakeMovie.QualityProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
Cutoff = Quality.Bluray1080p.Id,
|
Cutoff = Quality.Bluray1080p.Id,
|
||||||
@ -182,7 +182,7 @@ public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_not_be_upgradable_if_cutoff_already_met()
|
public void should_not_be_upgradable_if_cutoff_already_met()
|
||||||
{
|
{
|
||||||
_fakeMovie.Profile = new Profile
|
_fakeMovie.QualityProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
Cutoff = Quality.WEBDL1080p.Id,
|
Cutoff = Quality.WEBDL1080p.Id,
|
||||||
@ -217,7 +217,7 @@ public void should_return_false_if_latest_history_has_a_download_id_and_cdh_is_d
|
|||||||
public void should_return_false_if_cutoff_already_met_and_cdh_is_disabled()
|
public void should_return_false_if_cutoff_already_met_and_cdh_is_disabled()
|
||||||
{
|
{
|
||||||
GivenCdhDisabled();
|
GivenCdhDisabled();
|
||||||
_fakeMovie.Profile = new Profile
|
_fakeMovie.QualityProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
Cutoff = Quality.WEBDL1080p.Id,
|
Cutoff = Quality.WEBDL1080p.Id,
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
@ -27,7 +27,7 @@ public void Setup()
|
|||||||
},
|
},
|
||||||
Movie = new Movie
|
Movie = new Movie
|
||||||
{
|
{
|
||||||
Profile = new Profile
|
QualityProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Language = Language.English
|
Language = Language.English
|
||||||
},
|
},
|
||||||
@ -73,7 +73,7 @@ public void should_return_false_if_language_is_german()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_if_release_is_german_and_profile_original()
|
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();
|
WithGermanRelease();
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ public void should_return_false_if_release_is_german_and_profile_original()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_if_release_is_french_and_profile_original()
|
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();
|
WithFrenchRelease();
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ public void should_return_true_if_release_is_french_and_profile_original()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_if_allowed_language_any()
|
public void should_return_true_if_allowed_language_any()
|
||||||
{
|
{
|
||||||
_remoteMovie.Movie.Profile = new Profile
|
_remoteMovie.Movie.QualityProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Language = Language.Any
|
Language = Language.Any
|
||||||
};
|
};
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
|
||||||
using NzbDrone.Core.Profiles.Delay;
|
using NzbDrone.Core.Profiles.Delay;
|
||||||
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormats;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
@ -59,7 +59,7 @@ private RemoteMovie GivenRemoteMovie(QualityModel quality, int age = 0, long siz
|
|||||||
remoteMovie.ParsedMovieInfo.Year = 1998;
|
remoteMovie.ParsedMovieInfo.Year = 1998;
|
||||||
remoteMovie.ParsedMovieInfo.Quality = quality;
|
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(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_customFormat1.Name, _customFormat2.Name),
|
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_customFormat1.Name, _customFormat2.Name),
|
||||||
@ -416,7 +416,7 @@ public void should_prefer_better_custom_format()
|
|||||||
var quality2 = new QualityModel(Quality.Bluray720p);
|
var quality2 = new QualityModel(Quality.Bluray720p);
|
||||||
var remoteMovie2 = GivenRemoteMovie(quality2);
|
var remoteMovie2 = GivenRemoteMovie(quality2);
|
||||||
remoteMovie2.CustomFormats.Add(_customFormat1);
|
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>();
|
var decisions = new List<DownloadDecision>();
|
||||||
decisions.Add(new DownloadDecision(remoteMovie1));
|
decisions.Add(new DownloadDecision(remoteMovie1));
|
||||||
@ -432,12 +432,12 @@ public void should_prefer_better_custom_format2()
|
|||||||
var quality1 = new QualityModel(Quality.Bluray720p);
|
var quality1 = new QualityModel(Quality.Bluray720p);
|
||||||
var remoteMovie1 = GivenRemoteMovie(quality1);
|
var remoteMovie1 = GivenRemoteMovie(quality1);
|
||||||
remoteMovie1.CustomFormats.Add(_customFormat1);
|
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 quality2 = new QualityModel(Quality.Bluray720p);
|
||||||
var remoteMovie2 = GivenRemoteMovie(quality2);
|
var remoteMovie2 = GivenRemoteMovie(quality2);
|
||||||
remoteMovie2.CustomFormats.Add(_customFormat2);
|
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>();
|
var decisions = new List<DownloadDecision>();
|
||||||
decisions.Add(new DownloadDecision(remoteMovie1));
|
decisions.Add(new DownloadDecision(remoteMovie1));
|
||||||
@ -452,11 +452,11 @@ public void should_prefer_2_custom_formats()
|
|||||||
{
|
{
|
||||||
var remoteMovie1 = GivenRemoteMovie(new QualityModel(Quality.Bluray720p));
|
var remoteMovie1 = GivenRemoteMovie(new QualityModel(Quality.Bluray720p));
|
||||||
remoteMovie1.CustomFormats.Add(_customFormat1);
|
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));
|
var remoteMovie2 = GivenRemoteMovie(new QualityModel(Quality.Bluray720p));
|
||||||
remoteMovie2.CustomFormats.AddRange(new List<CustomFormat> { _customFormat1, _customFormat2 });
|
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>();
|
var decisions = new List<DownloadDecision>();
|
||||||
decisions.Add(new DownloadDecision(remoteMovie1));
|
decisions.Add(new DownloadDecision(remoteMovie1));
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public class QualityAllowedByProfileSpecificationFixture : CoreTest<QualityAllow
|
|||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
var fakeSeries = Builder<Movie>.CreateNew()
|
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();
|
.Build();
|
||||||
|
|
||||||
_remoteMovie = new RemoteMovie
|
_remoteMovie = new RemoteMovie
|
||||||
@ -49,7 +49,7 @@ public void Setup()
|
|||||||
public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
|
public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
|
||||||
{
|
{
|
||||||
_remoteMovie.ParsedMovieInfo.Quality.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();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
|
|||||||
public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType)
|
public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType)
|
||||||
{
|
{
|
||||||
_remoteMovie.ParsedMovieInfo.Quality.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();
|
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
using NzbDrone.Core.CustomFormats;
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormats;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
@ -70,7 +70,7 @@ public void IsUpgradeTest(Quality current,
|
|||||||
{
|
{
|
||||||
GivenAutoDownloadPropers(ProperDownloadTypes.PreferAndUpgrade);
|
GivenAutoDownloadPropers(ProperDownloadTypes.PreferAndUpgrade);
|
||||||
|
|
||||||
var profile = new Profile
|
var profile = new QualityProfile
|
||||||
{
|
{
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_customFormat1.Name, _customFormat2.Name),
|
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(_customFormat1.Name, _customFormat2.Name),
|
||||||
@ -90,7 +90,7 @@ public void should_return_true_if_proper_and_download_propers_is_do_not_download
|
|||||||
{
|
{
|
||||||
GivenAutoDownloadPropers(ProperDownloadTypes.DoNotUpgrade);
|
GivenAutoDownloadPropers(ProperDownloadTypes.DoNotUpgrade);
|
||||||
|
|
||||||
var profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() };
|
var profile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||||
|
|
||||||
Subject.IsUpgradable(profile,
|
Subject.IsUpgradable(profile,
|
||||||
new QualityModel(Quality.DVD, new Revision(version: 2)),
|
new QualityModel(Quality.DVD, new Revision(version: 2)),
|
||||||
@ -103,7 +103,7 @@ public void should_return_true_if_proper_and_download_propers_is_do_not_download
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_if_release_and_existing_file_are_the_same()
|
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(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Queue;
|
using NzbDrone.Core.Queue;
|
||||||
using NzbDrone.Core.Test.CustomFormats;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
@ -37,7 +37,7 @@ public void Setup()
|
|||||||
CustomFormatsTestHelpers.GivenCustomFormats();
|
CustomFormatsTestHelpers.GivenCustomFormats();
|
||||||
|
|
||||||
_movie = Builder<Movie>.CreateNew()
|
_movie = Builder<Movie>.CreateNew()
|
||||||
.With(e => e.Profile = new Profile
|
.With(e => e.QualityProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(),
|
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(),
|
||||||
@ -105,7 +105,7 @@ public void should_return_true_when_movie_doesnt_match()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_when_quality_in_queue_is_lower()
|
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()
|
var remoteMovie = Builder<RemoteMovie>.CreateNew()
|
||||||
.With(r => r.Movie = _movie)
|
.With(r => r.Movie = _movie)
|
||||||
@ -138,7 +138,7 @@ public void should_return_false_when_qualities_are_the_same()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_when_quality_in_queue_is_better()
|
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()
|
var remoteMovie = Builder<RemoteMovie>.CreateNew()
|
||||||
.With(r => r.Movie = _movie)
|
.With(r => r.Movie = _movie)
|
||||||
@ -155,7 +155,7 @@ public void should_return_false_when_quality_in_queue_is_better()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_if_quality_in_queue_meets_cutoff()
|
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()
|
var remoteMovie = Builder<RemoteMovie>.CreateNew()
|
||||||
.With(r => r.Movie = _movie)
|
.With(r => r.Movie = _movie)
|
||||||
@ -173,8 +173,8 @@ public void should_return_false_if_quality_in_queue_meets_cutoff()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_when_quality_is_better_and_upgrade_allowed_is_false_for_quality_profile()
|
public void should_return_false_when_quality_is_better_and_upgrade_allowed_is_false_for_quality_profile()
|
||||||
{
|
{
|
||||||
_movie.Profile.Cutoff = Quality.Bluray1080p.Id;
|
_movie.QualityProfile.Cutoff = Quality.Bluray1080p.Id;
|
||||||
_movie.Profile.UpgradeAllowed = false;
|
_movie.QualityProfile.UpgradeAllowed = false;
|
||||||
|
|
||||||
var remoteMovie = Builder<RemoteMovie>.CreateNew()
|
var remoteMovie = Builder<RemoteMovie>.CreateNew()
|
||||||
.With(r => r.Movie = _movie)
|
.With(r => r.Movie = _movie)
|
||||||
@ -191,7 +191,7 @@ public void should_return_false_when_quality_is_better_and_upgrade_allowed_is_fa
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_if_everything_is_the_same_for_failed_pending()
|
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()
|
var remoteMovie = Builder<RemoteMovie>.CreateNew()
|
||||||
.With(r => r.Movie = _movie)
|
.With(r => r.Movie = _movie)
|
||||||
@ -211,7 +211,7 @@ public void should_return_true_if_everything_is_the_same_for_failed_pending()
|
|||||||
public void should_return_false_if_same_quality_non_proper_in_queue_and_download_propers_is_do_not_upgrade()
|
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));
|
_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>()
|
Mocker.GetMock<IConfigService>()
|
||||||
.Setup(s => s.DownloadPropersAndRepacks)
|
.Setup(s => s.DownloadPropersAndRepacks)
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
|
||||||
using NzbDrone.Core.Profiles.Delay;
|
using NzbDrone.Core.Profiles.Delay;
|
||||||
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -23,14 +23,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class DelaySpecificationFixture : CoreTest<DelaySpecification>
|
public class DelaySpecificationFixture : CoreTest<DelaySpecification>
|
||||||
{
|
{
|
||||||
private Profile _profile;
|
private QualityProfile _profile;
|
||||||
private DelayProfile _delayProfile;
|
private DelayProfile _delayProfile;
|
||||||
private RemoteMovie _remoteMovie;
|
private RemoteMovie _remoteMovie;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_profile = Builder<Profile>.CreateNew()
|
_profile = Builder<QualityProfile>.CreateNew()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_delayProfile = Builder<DelayProfile>.CreateNew()
|
_delayProfile = Builder<DelayProfile>.CreateNew()
|
||||||
@ -38,17 +38,17 @@ public void Setup()
|
|||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var series = Builder<Movie>.CreateNew()
|
var series = Builder<Movie>.CreateNew()
|
||||||
.With(s => s.Profile = _profile)
|
.With(s => s.QualityProfile = _profile)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_remoteMovie = Builder<RemoteMovie>.CreateNew()
|
_remoteMovie = Builder<RemoteMovie>.CreateNew()
|
||||||
.With(r => r.Movie = series)
|
.With(r => r.Movie = series)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_profile.Items = new List<ProfileQualityItem>();
|
_profile.Items = new List<QualityProfileQualityItem>();
|
||||||
_profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p });
|
_profile.Items.Add(new QualityProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p });
|
||||||
_profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p });
|
_profile.Items.Add(new QualityProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p });
|
||||||
_profile.Items.Add(new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p });
|
_profile.Items.Add(new QualityProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p });
|
||||||
|
|
||||||
_profile.Cutoff = Quality.WEBDL720p.Id;
|
_profile.Cutoff = Quality.WEBDL720p.Id;
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ private void GivenExistingFile(QualityModel quality)
|
|||||||
private void GivenUpgradeForExistingFile()
|
private void GivenUpgradeForExistingFile()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IUpgradableSpecification>()
|
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);
|
.Returns(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public void Setup()
|
|||||||
_secondFile = new MovieFile { Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 1)), DateAdded = DateTime.Now };
|
_secondFile = new MovieFile { Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 1)), DateAdded = DateTime.Now };
|
||||||
|
|
||||||
var fakeSeries = Builder<Movie>.CreateNew()
|
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)
|
.With(c => c.MovieFile = _firstFile)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using NzbDrone.Core.CustomFormats;
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ public class UpgradeAllowedSpecificationFixture : CoreTest<UpgradableSpecificati
|
|||||||
{
|
{
|
||||||
private CustomFormat _customFormatOne;
|
private CustomFormat _customFormatOne;
|
||||||
private CustomFormat _customFormatTwo;
|
private CustomFormat _customFormatTwo;
|
||||||
private Profile _qualityProfile;
|
private QualityProfile _qualityProfile;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
@ -30,7 +31,7 @@ public void Setup()
|
|||||||
Name = "Two"
|
Name = "Two"
|
||||||
};
|
};
|
||||||
|
|
||||||
_qualityProfile = new Profile
|
_qualityProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Cutoff = Quality.Bluray1080p.Id,
|
Cutoff = Quality.Bluray1080p.Id,
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormats;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
@ -36,7 +36,7 @@ public void Setup()
|
|||||||
_firstFile = new MovieFile { Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 2)), DateAdded = DateTime.Now };
|
_firstFile = new MovieFile { Quality = new QualityModel(Quality.Bluray1080p, new Revision(version: 2)), DateAdded = DateTime.Now };
|
||||||
|
|
||||||
var fakeSeries = Builder<Movie>.CreateNew()
|
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(),
|
Cutoff = Quality.Bluray1080p.Id, Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||||
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(),
|
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(),
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
@ -47,7 +47,7 @@ private RemoteMovie GetRemoteMovie(QualityModel quality, Movie movie = null, Dow
|
|||||||
movie = GetMovie(1);
|
movie = GetMovie(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
movie.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() };
|
movie.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||||
|
|
||||||
var remoteMovie = new RemoteMovie()
|
var remoteMovie = new RemoteMovie()
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
using NzbDrone.Core.Download.Pending;
|
using NzbDrone.Core.Download.Pending;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class AddFixture : CoreTest<PendingReleaseService>
|
|||||||
{
|
{
|
||||||
private DownloadDecision _temporarilyRejected;
|
private DownloadDecision _temporarilyRejected;
|
||||||
private Movie _movie;
|
private Movie _movie;
|
||||||
private Profile _profile;
|
private QualityProfile _profile;
|
||||||
private ReleaseInfo _release;
|
private ReleaseInfo _release;
|
||||||
private ParsedMovieInfo _parsedMovieInfo;
|
private ParsedMovieInfo _parsedMovieInfo;
|
||||||
private RemoteMovie _remoteMovie;
|
private RemoteMovie _remoteMovie;
|
||||||
@ -32,19 +32,19 @@ public void Setup()
|
|||||||
_movie = Builder<Movie>.CreateNew()
|
_movie = Builder<Movie>.CreateNew()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_profile = new Profile
|
_profile = new QualityProfile
|
||||||
{
|
{
|
||||||
Name = "Test",
|
Name = "Test",
|
||||||
Cutoff = Quality.HDTV720p.Id,
|
Cutoff = Quality.HDTV720p.Id,
|
||||||
Items = new List<ProfileQualityItem>
|
Items = new List<QualityProfileQualityItem>
|
||||||
{
|
{
|
||||||
new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
|
new QualityProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
|
||||||
new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
|
new QualityProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
|
||||||
new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
|
new QualityProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
_movie.Profile = _profile;
|
_movie.QualityProfile = _profile;
|
||||||
|
|
||||||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
using NzbDrone.Core.Download.Pending;
|
using NzbDrone.Core.Download.Pending;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class RemoveGrabbedFixture : CoreTest<PendingReleaseService>
|
|||||||
{
|
{
|
||||||
private DownloadDecision _temporarilyRejected;
|
private DownloadDecision _temporarilyRejected;
|
||||||
private Movie _movie;
|
private Movie _movie;
|
||||||
private Profile _profile;
|
private QualityProfile _profile;
|
||||||
private ReleaseInfo _release;
|
private ReleaseInfo _release;
|
||||||
private ParsedMovieInfo _parsedMovieInfo;
|
private ParsedMovieInfo _parsedMovieInfo;
|
||||||
private RemoteMovie _remoteMovie;
|
private RemoteMovie _remoteMovie;
|
||||||
@ -32,19 +32,19 @@ public void Setup()
|
|||||||
_movie = Builder<Movie>.CreateNew()
|
_movie = Builder<Movie>.CreateNew()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_profile = new Profile
|
_profile = new QualityProfile
|
||||||
{
|
{
|
||||||
Name = "Test",
|
Name = "Test",
|
||||||
Cutoff = Quality.HDTV720p.Id,
|
Cutoff = Quality.HDTV720p.Id,
|
||||||
Items = new List<ProfileQualityItem>
|
Items = new List<QualityProfileQualityItem>
|
||||||
{
|
{
|
||||||
new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
|
new QualityProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
|
||||||
new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
|
new QualityProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
|
||||||
new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
|
new QualityProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
_movie.Profile = _profile;
|
_movie.QualityProfile = _profile;
|
||||||
|
|
||||||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ public class RemoveRejectedFixture : CoreTest<PendingReleaseService>
|
|||||||
{
|
{
|
||||||
private DownloadDecision _temporarilyRejected;
|
private DownloadDecision _temporarilyRejected;
|
||||||
private Movie _movie;
|
private Movie _movie;
|
||||||
private Profile _profile;
|
private QualityProfile _profile;
|
||||||
private ReleaseInfo _release;
|
private ReleaseInfo _release;
|
||||||
private ParsedMovieInfo _parsedMovieInfo;
|
private ParsedMovieInfo _parsedMovieInfo;
|
||||||
private RemoteMovie _remoteMovie;
|
private RemoteMovie _remoteMovie;
|
||||||
@ -33,19 +33,19 @@ public void Setup()
|
|||||||
_movie = Builder<Movie>.CreateNew()
|
_movie = Builder<Movie>.CreateNew()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_profile = new Profile
|
_profile = new QualityProfile
|
||||||
{
|
{
|
||||||
Name = "Test",
|
Name = "Test",
|
||||||
Cutoff = Quality.HDTV720p.Id,
|
Cutoff = Quality.HDTV720p.Id,
|
||||||
Items = new List<ProfileQualityItem>
|
Items = new List<QualityProfileQualityItem>
|
||||||
{
|
{
|
||||||
new ProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
|
new QualityProfileQualityItem { Allowed = true, Quality = Quality.HDTV720p },
|
||||||
new ProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
|
new QualityProfileQualityItem { Allowed = true, Quality = Quality.WEBDL720p },
|
||||||
new ProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
|
new QualityProfileQualityItem { Allowed = true, Quality = Quality.Bluray720p }
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
_movie.Profile = _profile;
|
_movie.QualityProfile = _profile;
|
||||||
|
|
||||||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
using NzbDrone.Core.MediaFiles.Events;
|
using NzbDrone.Core.MediaFiles.Events;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Core.Test.Qualities;
|
using NzbDrone.Core.Test.Qualities;
|
||||||
@ -20,14 +20,14 @@ namespace NzbDrone.Core.Test.HistoryTests
|
|||||||
{
|
{
|
||||||
public class HistoryServiceFixture : CoreTest<HistoryService>
|
public class HistoryServiceFixture : CoreTest<HistoryService>
|
||||||
{
|
{
|
||||||
private Profile _profile;
|
private QualityProfile _profile;
|
||||||
private Profile _profileCustom;
|
private QualityProfile _profileCustom;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_profile = new Profile { Cutoff = Quality.WEBDL720p.Id, Items = QualityFixture.GetDefaultQualities() };
|
_profile = new QualityProfile { Cutoff = Quality.WEBDL720p.Id, Items = QualityFixture.GetDefaultQualities() };
|
||||||
_profileCustom = new Profile { Cutoff = Quality.WEBDL720p.Id, Items = QualityFixture.GetDefaultQualities(Quality.DVD) };
|
_profileCustom = new QualityProfile { Cutoff = Quality.WEBDL720p.Id, Items = QualityFixture.GetDefaultQualities(Quality.DVD) };
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -8,12 +8,13 @@
|
|||||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class CleanupQualityProfileFormatItemsFixture : DbTest<CleanupQualityProfileFormatItems, Profile>
|
public class CleanupQualityProfileFormatItemsFixture : DbTest<CleanupQualityProfileFormatItems, QualityProfile>
|
||||||
{
|
{
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
@ -28,7 +29,7 @@ public void Setup()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_remove_orphaned_custom_formats()
|
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.Items = Qualities.QualityFixture.GetDefaultQualities())
|
||||||
.With(h => h.MinFormatScore = 50)
|
.With(h => h.MinFormatScore = 50)
|
||||||
.With(h => h.CutoffFormatScore = 100)
|
.With(h => h.CutoffFormatScore = 100)
|
||||||
@ -63,7 +64,7 @@ public void should_not_remove_unorphaned_custom_formats()
|
|||||||
|
|
||||||
Db.Insert(customFormat);
|
Db.Insert(customFormat);
|
||||||
|
|
||||||
var qualityProfile = Builder<Profile>.CreateNew()
|
var qualityProfile = Builder<QualityProfile>.CreateNew()
|
||||||
.With(h => h.Items = Qualities.QualityFixture.GetDefaultQualities())
|
.With(h => h.Items = Qualities.QualityFixture.GetDefaultQualities())
|
||||||
.With(h => h.MinFormatScore = minFormatScore)
|
.With(h => h.MinFormatScore = minFormatScore)
|
||||||
.With(h => h.CutoffFormatScore = cutoffFormatScore)
|
.With(h => h.CutoffFormatScore = cutoffFormatScore)
|
||||||
@ -107,7 +108,7 @@ public void should_add_missing_custom_formats()
|
|||||||
Db.Insert(customFormat1);
|
Db.Insert(customFormat1);
|
||||||
Db.Insert(customFormat2);
|
Db.Insert(customFormat2);
|
||||||
|
|
||||||
var qualityProfile = Builder<Profile>.CreateNew()
|
var qualityProfile = Builder<QualityProfile>.CreateNew()
|
||||||
.With(h => h.Items = Qualities.QualityFixture.GetDefaultQualities())
|
.With(h => h.Items = Qualities.QualityFixture.GetDefaultQualities())
|
||||||
.With(h => h.MinFormatScore = minFormatScore)
|
.With(h => h.MinFormatScore = minFormatScore)
|
||||||
.With(h => h.CutoffFormatScore = cutoffFormatScore)
|
.With(h => h.CutoffFormatScore = cutoffFormatScore)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
using NzbDrone.Core.MediaFiles.MovieImport;
|
using NzbDrone.Core.MediaFiles.MovieImport;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
@ -25,7 +25,7 @@ public class GetSceneNameFixture : CoreTest
|
|||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
var movie = Builder<Movie>.CreateNew()
|
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())
|
.With(s => s.Path = @"C:\Test\Movies\Movie Title".AsOsAgnostic())
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
@ -41,7 +41,7 @@ public void Setup()
|
|||||||
var outputPath = @"C:\Test\Unsorted\TV\30.Rock.S01E01".AsOsAgnostic();
|
var outputPath = @"C:\Test\Unsorted\TV\30.Rock.S01E01".AsOsAgnostic();
|
||||||
|
|
||||||
var movie = Builder<Movie>.CreateNew()
|
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())
|
.With(s => s.Path = @"C:\Test\TV\30 Rock".AsOsAgnostic())
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
@ -59,7 +59,7 @@ public void Setup()
|
|||||||
|
|
||||||
_movie = Builder<Movie>.CreateNew()
|
_movie = Builder<Movie>.CreateNew()
|
||||||
.With(e => e.Path = @"C:\Test\Movie".AsOsAgnostic())
|
.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();
|
.Build();
|
||||||
|
|
||||||
_quality = new QualityModel(Quality.DVD);
|
_quality = new QualityModel(Quality.DVD);
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ public class UpgradeSpecificationFixture : CoreTest<UpgradeSpecification>
|
|||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_movie = Builder<Movie>.CreateNew()
|
_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();
|
.Build();
|
||||||
|
|
||||||
_localMovie = new LocalMovie()
|
_localMovie = new LocalMovie()
|
||||||
@ -142,7 +143,7 @@ public void should_return_true_if_upgrade_to_custom_format_score()
|
|||||||
Quality = new QualityModel(Quality.Bluray1080p)
|
Quality = new QualityModel(Quality.Bluray1080p)
|
||||||
};
|
};
|
||||||
|
|
||||||
_movie.Profile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
|
_movie.QualityProfile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
|
||||||
{
|
{
|
||||||
Format = c,
|
Format = c,
|
||||||
Score = 10
|
Score = 10
|
||||||
@ -177,7 +178,7 @@ public void should_return_true_if_not_upgrade_to_custom_format_score_but_is_upgr
|
|||||||
Quality = new QualityModel(Quality.Bluray720p)
|
Quality = new QualityModel(Quality.Bluray720p)
|
||||||
};
|
};
|
||||||
|
|
||||||
_movie.Profile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
|
_movie.QualityProfile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
|
||||||
{
|
{
|
||||||
Format = c,
|
Format = c,
|
||||||
Score = 50
|
Score = 50
|
||||||
@ -212,7 +213,7 @@ public void should_return_false_if_not_upgrade_to_custom_format_score()
|
|||||||
Quality = new QualityModel(Quality.Bluray1080p)
|
Quality = new QualityModel(Quality.Bluray1080p)
|
||||||
};
|
};
|
||||||
|
|
||||||
_movie.Profile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
|
_movie.QualityProfile.FormatItems = movieFileCustomFormats.Select(c => new ProfileFormatItem
|
||||||
{
|
{
|
||||||
Format = c,
|
Format = c,
|
||||||
Score = 50
|
Score = 50
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.CustomFormats;
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormats;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
@ -16,13 +16,13 @@ namespace NzbDrone.Core.Test.MovieTests.MovieRepositoryTests
|
|||||||
|
|
||||||
public class MovieRepositoryFixture : DbTest<MovieRepository, Movie>
|
public class MovieRepositoryFixture : DbTest<MovieRepository, Movie>
|
||||||
{
|
{
|
||||||
private IProfileRepository _profileRepository;
|
private IQualityProfileRepository _profileRepository;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_profileRepository = Mocker.Resolve<ProfileRepository>();
|
_profileRepository = Mocker.Resolve<QualityProfileRepository>();
|
||||||
Mocker.SetConstant<IProfileRepository>(_profileRepository);
|
Mocker.SetConstant<IQualityProfileRepository>(_profileRepository);
|
||||||
|
|
||||||
Mocker.GetMock<ICustomFormatService>()
|
Mocker.GetMock<ICustomFormatService>()
|
||||||
.Setup(x => x.All())
|
.Setup(x => x.All())
|
||||||
@ -32,7 +32,7 @@ public void Setup()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_load_quality_profile()
|
public void should_load_quality_profile()
|
||||||
{
|
{
|
||||||
var profile = new Profile
|
var profile = new QualityProfile
|
||||||
{
|
{
|
||||||
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p),
|
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p),
|
||||||
FormatItems = CustomFormatsTestHelpers.GetDefaultFormatItems(),
|
FormatItems = CustomFormatsTestHelpers.GetDefaultFormatItems(),
|
||||||
@ -44,11 +44,11 @@ public void should_load_quality_profile()
|
|||||||
_profileRepository.Insert(profile);
|
_profileRepository.Insert(profile);
|
||||||
|
|
||||||
var movie = Builder<Movie>.CreateNew().BuildNew();
|
var movie = Builder<Movie>.CreateNew().BuildNew();
|
||||||
movie.ProfileId = profile.Id;
|
movie.QualityProfileId = profile.Id;
|
||||||
|
|
||||||
Subject.Insert(movie);
|
Subject.Insert(movie);
|
||||||
|
|
||||||
Subject.All().Single().Profile.Should().NotBeNull();
|
Subject.All().Single().QualityProfile.Should().NotBeNull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public void Setup()
|
|||||||
{
|
{
|
||||||
_movies = Builder<Movie>.CreateListOfSize(5)
|
_movies = Builder<Movie>.CreateListOfSize(5)
|
||||||
.All()
|
.All()
|
||||||
.With(s => s.ProfileId = 1)
|
.With(s => s.QualityProfileId = 1)
|
||||||
.With(s => s.Monitored)
|
.With(s => s.Monitored)
|
||||||
.With(s => s.Path = @"C:\Test\name".AsOsAgnostic())
|
.With(s => s.Path = @"C:\Test\name".AsOsAgnostic())
|
||||||
.With(s => s.RootFolderPath = "")
|
.With(s => s.RootFolderPath = "")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormats;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
@ -8,7 +8,7 @@
|
|||||||
namespace NzbDrone.Core.Test.Profiles
|
namespace NzbDrone.Core.Test.Profiles
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class ProfileRepositoryFixture : DbTest<ProfileRepository, Profile>
|
public class ProfileRepositoryFixture : DbTest<QualityProfileRepository, QualityProfile>
|
||||||
{
|
{
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
@ -18,7 +18,7 @@ public void Setup()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_be_able_to_read_and_write()
|
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),
|
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.Bluray1080p, Quality.DVD, Quality.HDTV720p),
|
||||||
MinFormatScore = 0,
|
MinFormatScore = 0,
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Movies.Collections;
|
using NzbDrone.Core.Movies.Collections;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Test.CustomFormats;
|
using NzbDrone.Core.Test.CustomFormats;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ namespace NzbDrone.Core.Test.Profiles
|
|||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
|
||||||
public class ProfileServiceFixture : CoreTest<ProfileService>
|
public class ProfileServiceFixture : CoreTest<QualityProfileService>
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void init_should_add_default_profiles()
|
public void init_should_add_default_profiles()
|
||||||
@ -29,8 +29,8 @@ public void init_should_add_default_profiles()
|
|||||||
|
|
||||||
Subject.Handle(new ApplicationStartedEvent());
|
Subject.Handle(new ApplicationStartedEvent());
|
||||||
|
|
||||||
Mocker.GetMock<IProfileRepository>()
|
Mocker.GetMock<IQualityProfileRepository>()
|
||||||
.Verify(v => v.Insert(It.IsAny<Profile>()), Times.Exactly(6));
|
.Verify(v => v.Insert(It.IsAny<QualityProfile>()), Times.Exactly(6));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -39,14 +39,14 @@ public void init_should_add_default_profiles()
|
|||||||
// We don't want to keep adding them back if a user deleted them on purpose.
|
// 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()
|
public void Init_should_skip_if_any_profiles_already_exist()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IProfileRepository>()
|
Mocker.GetMock<IQualityProfileRepository>()
|
||||||
.Setup(s => s.All())
|
.Setup(s => s.All())
|
||||||
.Returns(Builder<Profile>.CreateListOfSize(2).Build().ToList());
|
.Returns(Builder<QualityProfile>.CreateListOfSize(2).Build().ToList());
|
||||||
|
|
||||||
Subject.Handle(new ApplicationStartedEvent());
|
Subject.Handle(new ApplicationStartedEvent());
|
||||||
|
|
||||||
Mocker.GetMock<IProfileRepository>()
|
Mocker.GetMock<IQualityProfileRepository>()
|
||||||
.Verify(v => v.Insert(It.IsAny<Profile>()), Times.Never());
|
.Verify(v => v.Insert(It.IsAny<QualityProfile>()), Times.Never());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -54,20 +54,20 @@ public void should_not_be_able_to_delete_profile_if_assigned_to_movie()
|
|||||||
{
|
{
|
||||||
var movieList = Builder<Movie>.CreateListOfSize(3)
|
var movieList = Builder<Movie>.CreateListOfSize(3)
|
||||||
.Random(1)
|
.Random(1)
|
||||||
.With(c => c.ProfileId = 2)
|
.With(c => c.QualityProfileId = 2)
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
|
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
|
||||||
.All()
|
.All()
|
||||||
.With(c => c.ProfileId = 1)
|
.With(c => c.QualityProfileId = 1)
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
Mocker.GetMock<IMovieService>().Setup(c => c.GetAllMovies()).Returns(movieList);
|
Mocker.GetMock<IMovieService>().Setup(c => c.GetAllMovies()).Returns(movieList);
|
||||||
Mocker.GetMock<IImportListFactory>().Setup(c => c.All()).Returns(importList);
|
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]
|
[Test]
|
||||||
@ -75,20 +75,20 @@ public void should_not_be_able_to_delete_profile_if_assigned_to_list()
|
|||||||
{
|
{
|
||||||
var movieList = Builder<Movie>.CreateListOfSize(3)
|
var movieList = Builder<Movie>.CreateListOfSize(3)
|
||||||
.All()
|
.All()
|
||||||
.With(c => c.ProfileId = 1)
|
.With(c => c.QualityProfileId = 1)
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
|
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
|
||||||
.Random(1)
|
.Random(1)
|
||||||
.With(c => c.ProfileId = 2)
|
.With(c => c.QualityProfileId = 2)
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
Mocker.GetMock<IMovieService>().Setup(c => c.GetAllMovies()).Returns(movieList);
|
Mocker.GetMock<IMovieService>().Setup(c => c.GetAllMovies()).Returns(movieList);
|
||||||
Mocker.GetMock<IImportListFactory>().Setup(c => c.All()).Returns(importList);
|
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]
|
[Test]
|
||||||
@ -96,12 +96,12 @@ public void should_not_be_able_to_delete_profile_if_assigned_to_collection()
|
|||||||
{
|
{
|
||||||
var movieList = Builder<Movie>.CreateListOfSize(3)
|
var movieList = Builder<Movie>.CreateListOfSize(3)
|
||||||
.All()
|
.All()
|
||||||
.With(c => c.ProfileId = 1)
|
.With(c => c.QualityProfileId = 1)
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
|
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
|
||||||
.Random(1)
|
.Random(1)
|
||||||
.With(c => c.ProfileId = 1)
|
.With(c => c.QualityProfileId = 1)
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
var collectionList = Builder<MovieCollection>.CreateListOfSize(3)
|
var collectionList = Builder<MovieCollection>.CreateListOfSize(3)
|
||||||
@ -113,9 +113,9 @@ public void should_not_be_able_to_delete_profile_if_assigned_to_collection()
|
|||||||
Mocker.GetMock<IImportListFactory>().Setup(c => c.All()).Returns(importList);
|
Mocker.GetMock<IImportListFactory>().Setup(c => c.All()).Returns(importList);
|
||||||
Mocker.GetMock<IMovieCollectionService>().Setup(c => c.GetAllCollections()).Returns(collectionList);
|
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]
|
[Test]
|
||||||
@ -123,12 +123,12 @@ public void should_delete_profile_if_not_assigned_to_movie_or_list()
|
|||||||
{
|
{
|
||||||
var movieList = Builder<Movie>.CreateListOfSize(3)
|
var movieList = Builder<Movie>.CreateListOfSize(3)
|
||||||
.All()
|
.All()
|
||||||
.With(c => c.ProfileId = 2)
|
.With(c => c.QualityProfileId = 2)
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
|
var importList = Builder<ImportListDefinition>.CreateListOfSize(3)
|
||||||
.All()
|
.All()
|
||||||
.With(c => c.ProfileId = 2)
|
.With(c => c.QualityProfileId = 2)
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
var collectionList = Builder<MovieCollection>.CreateListOfSize(3)
|
var collectionList = Builder<MovieCollection>.CreateListOfSize(3)
|
||||||
@ -142,15 +142,15 @@ public void should_delete_profile_if_not_assigned_to_movie_or_list()
|
|||||||
|
|
||||||
Subject.Delete(1);
|
Subject.Delete(1);
|
||||||
|
|
||||||
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(1), Times.Once());
|
Mocker.GetMock<IQualityProfileRepository>().Verify(c => c.Delete(1), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void get_acceptable_languages_should_return_profile_language()
|
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>()))
|
.Setup(s => s.Get(It.IsAny<int>()))
|
||||||
.Returns(profile);
|
.Returns(profile);
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ public void get_acceptable_languages_should_return_profile_language()
|
|||||||
[Test]
|
[Test]
|
||||||
public void get_acceptable_languages_should_return_custom_format_positive_languages()
|
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)
|
.With(c => c.Language = Language.German)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ public void get_acceptable_languages_should_return_custom_format_positive_langua
|
|||||||
|
|
||||||
profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(customFormat2.Name);
|
profile.FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems(customFormat2.Name);
|
||||||
|
|
||||||
Mocker.GetMock<IProfileRepository>()
|
Mocker.GetMock<IQualityProfileRepository>()
|
||||||
.Setup(s => s.Get(It.IsAny<int>()))
|
.Setup(s => s.Get(It.IsAny<int>()))
|
||||||
.Returns(profile);
|
.Returns(profile);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Qualities
|
namespace NzbDrone.Core.Test.Qualities
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public void should_be_able_to_convert_qualityTypes_to_int(Quality source, int ex
|
|||||||
i.Should().Be(expected);
|
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>
|
var qualities = new List<Quality>
|
||||||
{
|
{
|
||||||
@ -100,7 +100,7 @@ public static List<ProfileQualityItem> GetDefaultQualities(params Quality[] allo
|
|||||||
var items = qualities
|
var items = qualities
|
||||||
.Except(allowed)
|
.Except(allowed)
|
||||||
.Concat(allowed)
|
.Concat(allowed)
|
||||||
.Select(v => new ProfileQualityItem
|
.Select(v => new QualityProfileQualityItem
|
||||||
{
|
{
|
||||||
Quality = v,
|
Quality = v,
|
||||||
Allowed = allowed.Contains(v)
|
Allowed = allowed.Contains(v)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@ -19,48 +19,48 @@ public void Setup()
|
|||||||
|
|
||||||
private void GivenDefaultProfile()
|
private void GivenDefaultProfile()
|
||||||
{
|
{
|
||||||
Subject = new QualityModelComparer(new Profile { Items = QualityFixture.GetDefaultQualities() });
|
Subject = new QualityModelComparer(new QualityProfile { Items = QualityFixture.GetDefaultQualities() });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenCustomProfile()
|
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()
|
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,
|
Allowed = false,
|
||||||
Quality = Quality.SDTV
|
Quality = Quality.SDTV
|
||||||
},
|
},
|
||||||
new ProfileQualityItem
|
new QualityProfileQualityItem
|
||||||
{
|
{
|
||||||
Allowed = false,
|
Allowed = false,
|
||||||
Quality = Quality.DVD
|
Quality = Quality.DVD
|
||||||
},
|
},
|
||||||
new ProfileQualityItem
|
new QualityProfileQualityItem
|
||||||
{
|
{
|
||||||
Allowed = true,
|
Allowed = true,
|
||||||
Items = new List<ProfileQualityItem>
|
Items = new List<QualityProfileQualityItem>
|
||||||
{
|
{
|
||||||
new ProfileQualityItem
|
new QualityProfileQualityItem
|
||||||
{
|
{
|
||||||
Allowed = true,
|
Allowed = true,
|
||||||
Quality = Quality.HDTV720p
|
Quality = Quality.HDTV720p
|
||||||
},
|
},
|
||||||
new ProfileQualityItem
|
new QualityProfileQualityItem
|
||||||
{
|
{
|
||||||
Allowed = true,
|
Allowed = true,
|
||||||
Quality = Quality.WEBDL720p
|
Quality = Quality.WEBDL720p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new ProfileQualityItem
|
new QualityProfileQualityItem
|
||||||
{
|
{
|
||||||
Allowed = true,
|
Allowed = true,
|
||||||
Quality = Quality.Bluray720p
|
Quality = Quality.Bluray720p
|
||||||
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -37,6 +37,7 @@
|
|||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.Profiles.Delay;
|
using NzbDrone.Core.Profiles.Delay;
|
||||||
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Profiles.Releases;
|
using NzbDrone.Core.Profiles.Releases;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.RemotePathMappings;
|
using NzbDrone.Core.RemotePathMappings;
|
||||||
@ -141,7 +142,7 @@ public static void Map()
|
|||||||
|
|
||||||
Mapper.Entity<CustomFormat>("CustomFormats").RegisterModel();
|
Mapper.Entity<CustomFormat>("CustomFormats").RegisterModel();
|
||||||
|
|
||||||
Mapper.Entity<Profile>("Profiles").RegisterModel();
|
Mapper.Entity<QualityProfile>("QualityProfiles").RegisterModel();
|
||||||
Mapper.Entity<Log>("Logs").RegisterModel();
|
Mapper.Entity<Log>("Logs").RegisterModel();
|
||||||
Mapper.Entity<NamingConfig>("NamingConfig").RegisterModel();
|
Mapper.Entity<NamingConfig>("NamingConfig").RegisterModel();
|
||||||
Mapper.Entity<Blocklist>("Blocklist").RegisterModel();
|
Mapper.Entity<Blocklist>("Blocklist").RegisterModel();
|
||||||
@ -188,7 +189,7 @@ private static void RegisterMappers()
|
|||||||
SqlMapper.AddTypeHandler(new DapperUtcConverter());
|
SqlMapper.AddTypeHandler(new DapperUtcConverter());
|
||||||
SqlMapper.AddTypeHandler(new DapperTimeSpanConverter());
|
SqlMapper.AddTypeHandler(new DapperTimeSpanConverter());
|
||||||
SqlMapper.AddTypeHandler(new DapperQualityIntConverter());
|
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<ProfileFormatItem>>(new CustomFormatIntConverter()));
|
||||||
SqlMapper.AddTypeHandler(new EmbeddedDocumentConverter<List<ICustomFormatSpecification>>(new CustomFormatSpecificationListConverter()));
|
SqlMapper.AddTypeHandler(new EmbeddedDocumentConverter<List<ICustomFormatSpecification>>(new CustomFormatSpecificationListConverter()));
|
||||||
SqlMapper.AddTypeHandler(new EmbeddedDocumentConverter<List<IAutoTaggingSpecification>>(new AutoTaggingSpecificationConverter()));
|
SqlMapper.AddTypeHandler(new EmbeddedDocumentConverter<List<IAutoTaggingSpecification>>(new AutoTaggingSpecificationConverter()));
|
||||||
|
@ -71,10 +71,10 @@ private int CompareQuality(DownloadDecision x, DownloadDecision y)
|
|||||||
{
|
{
|
||||||
if (_configService.DownloadPropersAndRepacks == ProperDownloadTypes.DoNotPrefer)
|
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));
|
CompareBy(x.RemoteMovie, y.RemoteMovie, remoteMovie => remoteMovie.ParsedMovieInfo.Quality.Revision));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ private IEnumerable<DownloadDecision> GetDecisions(List<ReleaseInfo> reports, bo
|
|||||||
_aggregationService.Augment(remoteMovie);
|
_aggregationService.Augment(remoteMovie);
|
||||||
|
|
||||||
remoteMovie.CustomFormats = _formatCalculator.ParseCustomFormat(remoteMovie, remoteMovie.Release.Size);
|
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;
|
remoteMovie.DownloadAllowed = remoteMovie.Movie != null;
|
||||||
decision = GetDecisionForReport(remoteMovie, searchCriteria);
|
decision = GetDecisionForReport(remoteMovie, searchCriteria);
|
||||||
|
@ -11,7 +11,7 @@ public class CustomFormatAllowedbyProfileSpecification : IDecisionEngineSpecific
|
|||||||
|
|
||||||
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
||||||
{
|
{
|
||||||
var minScore = subject.Movie.Profile.MinFormatScore;
|
var minScore = subject.Movie.QualityProfile.MinFormatScore;
|
||||||
var score = subject.CustomFormatScore;
|
var score = subject.CustomFormatScore;
|
||||||
|
|
||||||
if (score < minScore)
|
if (score < minScore)
|
||||||
|
@ -26,7 +26,7 @@ public CutoffSpecification(IUpgradableSpecification upgradableSpecification,
|
|||||||
|
|
||||||
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
||||||
{
|
{
|
||||||
var profile = subject.Movie.Profile;
|
var profile = subject.Movie.QualityProfile;
|
||||||
var file = subject.Movie.MovieFile;
|
var file = subject.Movie.MovieFile;
|
||||||
|
|
||||||
if (file != null)
|
if (file != null)
|
||||||
|
@ -19,7 +19,7 @@ public LanguageSpecification(Logger logger)
|
|||||||
|
|
||||||
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
||||||
{
|
{
|
||||||
var wantedLanguage = subject.Movie.Profile.Language;
|
var wantedLanguage = subject.Movie.QualityProfile.Language;
|
||||||
|
|
||||||
if (wantedLanguage == Language.Any)
|
if (wantedLanguage == Language.Any)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase se
|
|||||||
{
|
{
|
||||||
_logger.Debug("Checking if report meets quality requirements. {0}", subject.ParsedMovieInfo.Quality);
|
_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 qualityIndex = profile.GetIndex(subject.ParsedMovieInfo.Quality.Quality);
|
||||||
var qualityOrGroup = profile.Items[qualityIndex.Index];
|
var qualityOrGroup = profile.Items[qualityIndex.Index];
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCrit
|
|||||||
foreach (var queueItem in matchingMovies)
|
foreach (var queueItem in matchingMovies)
|
||||||
{
|
{
|
||||||
var remoteMovie = queueItem.RemoteMovie;
|
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).
|
// 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
|
// Failed items (already searching for a replacement) won't be part of the queue since
|
||||||
@ -82,7 +82,7 @@ public Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCrit
|
|||||||
|
|
||||||
_logger.Debug("Checking if profiles allow upgrading. Queued: {0}", remoteMovie.ParsedMovieInfo.Quality);
|
_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.ParsedMovieInfo.Quality,
|
||||||
remoteMovie.CustomFormats,
|
remoteMovie.CustomFormats,
|
||||||
subject.ParsedMovieInfo.Quality,
|
subject.ParsedMovieInfo.Quality,
|
||||||
|
@ -40,7 +40,7 @@ public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase se
|
|||||||
return Decision.Accept();
|
return Decision.Accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
var profile = subject.Movie.Profile;
|
var profile = subject.Movie.QualityProfile;
|
||||||
var delayProfile = _delayProfileService.BestForTags(subject.Movie.Tags);
|
var delayProfile = _delayProfileService.BestForTags(subject.Movie.Tags);
|
||||||
var delay = delayProfile.GetProtocolDelay(subject.Release.DownloadProtocol);
|
var delay = delayProfile.GetProtocolDelay(subject.Release.DownloadProtocol);
|
||||||
var isPreferredProtocol = subject.Release.DownloadProtocol == delayProfile.PreferredProtocol;
|
var isPreferredProtocol = subject.Release.DownloadProtocol == delayProfile.PreferredProtocol;
|
||||||
|
@ -51,12 +51,12 @@ public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase se
|
|||||||
{
|
{
|
||||||
var customFormats = _formatService.ParseCustomFormat(mostRecent, subject.Movie);
|
var customFormats = _formatService.ParseCustomFormat(mostRecent, subject.Movie);
|
||||||
|
|
||||||
var cutoffUnmet = _upgradableSpecification.CutoffNotMet(subject.Movie.Profile,
|
var cutoffUnmet = _upgradableSpecification.CutoffNotMet(subject.Movie.QualityProfile,
|
||||||
mostRecent.Quality,
|
mostRecent.Quality,
|
||||||
customFormats,
|
customFormats,
|
||||||
subject.ParsedMovieInfo.Quality);
|
subject.ParsedMovieInfo.Quality);
|
||||||
|
|
||||||
var upgradeable = _upgradableSpecification.IsUpgradable(subject.Movie.Profile,
|
var upgradeable = _upgradableSpecification.IsUpgradable(subject.Movie.QualityProfile,
|
||||||
mostRecent.Quality,
|
mostRecent.Quality,
|
||||||
customFormats,
|
customFormats,
|
||||||
subject.ParsedMovieInfo.Quality,
|
subject.ParsedMovieInfo.Quality,
|
||||||
|
@ -3,18 +3,18 @@
|
|||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.CustomFormats;
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.DecisionEngine.Specifications
|
namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||||
{
|
{
|
||||||
public interface IUpgradableSpecification
|
public interface IUpgradableSpecification
|
||||||
{
|
{
|
||||||
bool IsUpgradable(Profile profile, QualityModel currentQuality, List<CustomFormat> currentCustomFormats, QualityModel newQuality, List<CustomFormat> newCustomFormats);
|
bool IsUpgradable(QualityProfile profile, QualityModel currentQuality, List<CustomFormat> currentCustomFormats, QualityModel newQuality, List<CustomFormat> newCustomFormats);
|
||||||
bool CutoffNotMet(Profile profile, QualityModel currentQuality, List<CustomFormat> currentFormats, QualityModel newQuality = null);
|
bool CutoffNotMet(QualityProfile profile, QualityModel currentQuality, List<CustomFormat> currentFormats, QualityModel newQuality = null);
|
||||||
bool QualityCutoffNotMet(Profile profile, QualityModel currentQuality, QualityModel newQuality = null);
|
bool QualityCutoffNotMet(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null);
|
||||||
bool IsRevisionUpgrade(QualityModel currentQuality, QualityModel newQuality);
|
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
|
public class UpgradableSpecification : IUpgradableSpecification
|
||||||
@ -28,7 +28,7 @@ public UpgradableSpecification(IConfigService configService, Logger logger)
|
|||||||
_logger = logger;
|
_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 qualityComparer = new QualityModelComparer(profile);
|
||||||
var qualityCompare = qualityComparer.Compare(newQuality?.Quality, currentQuality.Quality);
|
var qualityCompare = qualityComparer.Compare(newQuality?.Quality, currentQuality.Quality);
|
||||||
@ -82,7 +82,7 @@ public bool IsUpgradable(Profile profile, QualityModel currentQuality, List<Cust
|
|||||||
return true;
|
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 cutoff = profile.UpgradeAllowed ? profile.Cutoff : profile.FirststAllowedQuality().Id;
|
||||||
var cutoffCompare = new QualityModelComparer(profile).Compare(currentQuality.Quality.Id, cutoff);
|
var cutoffCompare = new QualityModelComparer(profile).Compare(currentQuality.Quality.Id, cutoff);
|
||||||
@ -100,13 +100,13 @@ public bool QualityCutoffNotMet(Profile profile, QualityModel currentQuality, Qu
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CustomFormatCutoffNotMet(Profile profile, List<CustomFormat> currentFormats)
|
private bool CustomFormatCutoffNotMet(QualityProfile profile, List<CustomFormat> currentFormats)
|
||||||
{
|
{
|
||||||
var score = profile.CalculateCustomFormatScore(currentFormats);
|
var score = profile.CalculateCustomFormatScore(currentFormats);
|
||||||
return score < profile.CutoffFormatScore;
|
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))
|
if (QualityCutoffNotMet(profile, currentQuality, newQuality))
|
||||||
{
|
{
|
||||||
@ -137,7 +137,7 @@ public bool IsRevisionUpgrade(QualityModel currentQuality, QualityModel newQuali
|
|||||||
return false;
|
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 isQualityUpgrade = new QualityModelComparer(qualityProfile).Compare(newQuality, currentQuality) > 0;
|
||||||
var isCustomFormatUpgrade = qualityProfile.CalculateCustomFormatScore(newCustomFormats) > qualityProfile.CalculateCustomFormatScore(currentCustomFormats);
|
var isCustomFormatUpgrade = qualityProfile.CalculateCustomFormatScore(newCustomFormats) > qualityProfile.CalculateCustomFormatScore(currentCustomFormats);
|
||||||
|
@ -26,7 +26,7 @@ public UpgradeAllowedSpecification(UpgradableSpecification upgradableSpecificati
|
|||||||
|
|
||||||
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
||||||
{
|
{
|
||||||
var qualityProfile = subject.Movie.Profile;
|
var qualityProfile = subject.Movie.QualityProfile;
|
||||||
|
|
||||||
if (subject.Movie.MovieFileId != 0)
|
if (subject.Movie.MovieFileId != 0)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ public virtual Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase se
|
|||||||
return Decision.Accept();
|
return Decision.Accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
var profile = subject.Movie.Profile;
|
var profile = subject.Movie.QualityProfile;
|
||||||
var file = subject.Movie.MovieFile;
|
var file = subject.Movie.MovieFile;
|
||||||
file.Movie = subject.Movie;
|
file.Movie = subject.Movie;
|
||||||
var customFormats = _formatService.ParseCustomFormat(file);
|
var customFormats = _formatService.ParseCustomFormat(file);
|
||||||
|
@ -217,7 +217,7 @@ public List<RemoteMovie> GetPendingRemoteMovies(int movieId)
|
|||||||
{
|
{
|
||||||
var movies = g.First().Movie;
|
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))
|
.ThenBy(q => PrioritizeDownloadProtocol(q.Movie, q.Protocol))
|
||||||
.First();
|
.First();
|
||||||
});
|
});
|
||||||
@ -374,7 +374,7 @@ private void RemoveGrabbed(RemoteMovie remoteMovie)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var profile = remoteMovie.Movie.Profile;
|
var profile = remoteMovie.Movie.QualityProfile;
|
||||||
|
|
||||||
foreach (var existingReport in existingReports)
|
foreach (var existingReport in existingReports)
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.History
|
namespace NzbDrone.Core.History
|
||||||
@ -58,7 +58,7 @@ public List<MovieHistory> GetByMovieId(int movieId, MovieHistoryEventType? event
|
|||||||
{
|
{
|
||||||
var builder = new SqlBuilder(_database.DatabaseType)
|
var builder = new SqlBuilder(_database.DatabaseType)
|
||||||
.Join<MovieHistory, Movie>((h, m) => h.MovieId == m.Id)
|
.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);
|
.Where<MovieHistory>(h => h.MovieId == movieId);
|
||||||
|
|
||||||
if (eventType.HasValue)
|
if (eventType.HasValue)
|
||||||
@ -76,14 +76,14 @@ public void DeleteForMovies(List<int> movieIds)
|
|||||||
|
|
||||||
protected override SqlBuilder PagedBuilder() => new SqlBuilder(_database.DatabaseType)
|
protected override SqlBuilder PagedBuilder() => new SqlBuilder(_database.DatabaseType)
|
||||||
.Join<MovieHistory, Movie>((h, m) => h.MovieId == m.Id)
|
.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);
|
.LeftJoin<Movie, MovieMetadata>((m, mm) => m.MovieMetadataId == mm.Id);
|
||||||
|
|
||||||
protected override IEnumerable<MovieHistory> PagedQuery(SqlBuilder sql) =>
|
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 = movie;
|
||||||
hist.Movie.Profile = profile;
|
hist.Movie.QualityProfile = profile;
|
||||||
return hist;
|
return hist;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ public List<MovieHistory> Since(DateTime date, MovieHistoryEventType? eventType)
|
|||||||
{
|
{
|
||||||
var builder = new SqlBuilder(_database.DatabaseType)
|
var builder = new SqlBuilder(_database.DatabaseType)
|
||||||
.Join<MovieHistory, Movie>((h, m) => h.MovieId == m.Id)
|
.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);
|
.Where<MovieHistory>(x => x.Date >= date);
|
||||||
|
|
||||||
if (eventType.HasValue)
|
if (eventType.HasValue)
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Movies.Events;
|
using NzbDrone.Core.Movies.Events;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.History
|
namespace NzbDrone.Core.History
|
||||||
{
|
{
|
||||||
public interface IHistoryService
|
public interface IHistoryService
|
||||||
{
|
{
|
||||||
QualityModel GetBestQualityInHistory(Profile profile, int movieId);
|
QualityModel GetBestQualityInHistory(QualityProfile profile, int movieId);
|
||||||
PagingSpec<MovieHistory> Paged(PagingSpec<MovieHistory> pagingSpec);
|
PagingSpec<MovieHistory> Paged(PagingSpec<MovieHistory> pagingSpec);
|
||||||
MovieHistory MostRecentForMovie(int movieId);
|
MovieHistory MostRecentForMovie(int movieId);
|
||||||
MovieHistory MostRecentForDownloadId(string downloadId);
|
MovieHistory MostRecentForDownloadId(string downloadId);
|
||||||
@ -84,7 +84,7 @@ public List<MovieHistory> GetByMovieId(int movieId, MovieHistoryEventType? event
|
|||||||
return _historyRepository.GetByMovieId(movieId, eventType);
|
return _historyRepository.GetByMovieId(movieId, eventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QualityModel GetBestQualityInHistory(Profile profile, int movieId)
|
public QualityModel GetBestQualityInHistory(QualityProfile profile, int movieId)
|
||||||
{
|
{
|
||||||
var comparer = new QualityModelComparer(profile);
|
var comparer = new QualityModelComparer(profile);
|
||||||
return _historyRepository.GetBestQualityInHistory(movieId)
|
return _historyRepository.GetBestQualityInHistory(movieId)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||||
{
|
{
|
||||||
@ -24,7 +25,7 @@ public void Clean()
|
|||||||
{
|
{
|
||||||
var customFormats = _customFormatRepository.All().ToDictionary(c => c.Id);
|
var customFormats = _customFormatRepository.All().ToDictionary(c => c.Id);
|
||||||
var profiles = _repository.All();
|
var profiles = _repository.All();
|
||||||
var updatedProfiles = new List<Profile>();
|
var updatedProfiles = new List<QualityProfile>();
|
||||||
|
|
||||||
foreach (var profile in profiles)
|
foreach (var profile in profiles)
|
||||||
{
|
{
|
||||||
@ -77,11 +78,11 @@ public void Clean()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
public QualityProfileFormatItemsCleanupRepository(IMainDatabase database, IEventAggregator eventAggregator)
|
||||||
: base(database, eventAggregator)
|
: base(database, eventAggregator)
|
||||||
|
@ -16,7 +16,7 @@ public ImportListDefinition()
|
|||||||
public bool EnableAuto { get; set; }
|
public bool EnableAuto { get; set; }
|
||||||
public MonitorTypes Monitor { get; set; }
|
public MonitorTypes Monitor { get; set; }
|
||||||
public MovieStatusType MinimumAvailability { get; set; }
|
public MovieStatusType MinimumAvailability { get; set; }
|
||||||
public int ProfileId { get; set; }
|
public int QualityProfileId { get; set; }
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
public bool SearchOnAdd { get; set; }
|
public bool SearchOnAdd { get; set; }
|
||||||
public override bool Enable => Enabled;
|
public override bool Enable => Enabled;
|
||||||
|
@ -100,7 +100,7 @@ private void ProcessMovieReport(ImportListDefinition importList, ImportListMovie
|
|||||||
{
|
{
|
||||||
Monitored = monitorType != MonitorTypes.None,
|
Monitored = monitorType != MonitorTypes.None,
|
||||||
RootFolderPath = importList.RootFolderPath,
|
RootFolderPath = importList.RootFolderPath,
|
||||||
ProfileId = importList.ProfileId,
|
QualityProfileId = importList.QualityProfileId,
|
||||||
MinimumAvailability = importList.MinimumAvailability,
|
MinimumAvailability = importList.MinimumAvailability,
|
||||||
Tags = importList.Tags,
|
Tags = importList.Tags,
|
||||||
TmdbId = report.TmdbId,
|
TmdbId = report.TmdbId,
|
||||||
|
@ -36,7 +36,7 @@ public override IEnumerable<ProviderDefinition> DefaultDefinitions
|
|||||||
Name = "IMDb List",
|
Name = "IMDb List",
|
||||||
Enabled = Enabled,
|
Enabled = Enabled,
|
||||||
EnableAuto = true,
|
EnableAuto = true,
|
||||||
ProfileId = 1,
|
QualityProfileId = 1,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = new RSSImportSettings { Link = "https://rss.imdb.com/list/YOURLISTID" },
|
Settings = new RSSImportSettings { Link = "https://rss.imdb.com/list/YOURLISTID" },
|
||||||
};
|
};
|
||||||
@ -45,7 +45,7 @@ public override IEnumerable<ProviderDefinition> DefaultDefinitions
|
|||||||
Name = "IMDb Watchlist",
|
Name = "IMDb Watchlist",
|
||||||
Enabled = Enabled,
|
Enabled = Enabled,
|
||||||
EnableAuto = true,
|
EnableAuto = true,
|
||||||
ProfileId = 1,
|
QualityProfileId = 1,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = new RSSImportSettings { Link = "https://rss.imdb.com/user/IMDBUSERID/watchlist" },
|
Settings = new RSSImportSettings { Link = "https://rss.imdb.com/user/IMDBUSERID/watchlist" },
|
||||||
};
|
};
|
||||||
|
@ -45,7 +45,7 @@ public override IEnumerable<ProviderDefinition> DefaultDefinitions
|
|||||||
Name = "IMDb Top 250",
|
Name = "IMDb Top 250",
|
||||||
Enabled = Enabled,
|
Enabled = Enabled,
|
||||||
EnableAuto = true,
|
EnableAuto = true,
|
||||||
ProfileId = 1,
|
QualityProfileId = 1,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = new IMDbListSettings { ListId = "top250" },
|
Settings = new IMDbListSettings { ListId = "top250" },
|
||||||
};
|
};
|
||||||
@ -54,7 +54,7 @@ public override IEnumerable<ProviderDefinition> DefaultDefinitions
|
|||||||
Name = "IMDb Popular Movies",
|
Name = "IMDb Popular Movies",
|
||||||
Enabled = Enabled,
|
Enabled = Enabled,
|
||||||
EnableAuto = true,
|
EnableAuto = true,
|
||||||
ProfileId = 1,
|
QualityProfileId = 1,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = new IMDbListSettings { ListId = "popular" },
|
Settings = new IMDbListSettings { ListId = "popular" },
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Movies.Translations;
|
using NzbDrone.Core.Movies.Translations;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.IndexerSearch
|
namespace NzbDrone.Core.IndexerSearch
|
||||||
{
|
{
|
||||||
@ -27,14 +27,14 @@ public class ReleaseSearchService : ISearchForReleases
|
|||||||
private readonly IMakeDownloadDecision _makeDownloadDecision;
|
private readonly IMakeDownloadDecision _makeDownloadDecision;
|
||||||
private readonly IMovieService _movieService;
|
private readonly IMovieService _movieService;
|
||||||
private readonly IMovieTranslationService _movieTranslationService;
|
private readonly IMovieTranslationService _movieTranslationService;
|
||||||
private readonly IProfileService _profileService;
|
private readonly IQualityProfileService _profileService;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public ReleaseSearchService(IIndexerFactory indexerFactory,
|
public ReleaseSearchService(IIndexerFactory indexerFactory,
|
||||||
IMakeDownloadDecision makeDownloadDecision,
|
IMakeDownloadDecision makeDownloadDecision,
|
||||||
IMovieService movieService,
|
IMovieService movieService,
|
||||||
IMovieTranslationService movieTranslationService,
|
IMovieTranslationService movieTranslationService,
|
||||||
IProfileService profileService,
|
IQualityProfileService profileService,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
{
|
{
|
||||||
_indexerFactory = indexerFactory;
|
_indexerFactory = indexerFactory;
|
||||||
@ -75,7 +75,7 @@ private TSpec Get<TSpec>(Movie movie, bool userInvokedSearch, bool interactiveSe
|
|||||||
InteractiveSearch = interactiveSearch
|
InteractiveSearch = interactiveSearch
|
||||||
};
|
};
|
||||||
|
|
||||||
var wantedLanguages = _profileService.GetAcceptableLanguages(movie.ProfileId);
|
var wantedLanguages = _profileService.GetAcceptableLanguages(movie.QualityProfileId);
|
||||||
var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId);
|
var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId);
|
||||||
|
|
||||||
var queryTranlations = new List<string>
|
var queryTranlations = new List<string>
|
||||||
|
@ -61,7 +61,7 @@ public List<ImportResult> Import(List<ImportDecision> decisions, bool newDownloa
|
|||||||
.Where(decision => decision.Approved)
|
.Where(decision => decision.Approved)
|
||||||
.GroupBy(decision => decision.LocalMovie.Movie.Id)
|
.GroupBy(decision => decision.LocalMovie.Movie.Id)
|
||||||
.SelectMany(group => group
|
.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))
|
.ThenByDescending(decision => decision.LocalMovie.Size))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ private ImportDecision GetDecision(LocalMovie localMovie, DownloadClientItem dow
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
localMovie.CustomFormats = _formatCalculator.ParseCustomFormat(localMovie);
|
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);
|
decision = GetDecision(localMovie, downloadClientItem);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ private ManualImportItem MapItem(ImportDecision decision, string rootFolder, str
|
|||||||
item.Movie = decision.LocalMovie.Movie;
|
item.Movie = decision.LocalMovie.Movie;
|
||||||
|
|
||||||
item.CustomFormats = _formatCalculator.ParseCustomFormat(decision.LocalMovie);
|
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;
|
item.Quality = decision.LocalMovie.Quality;
|
||||||
@ -369,7 +369,7 @@ public void Execute(ManualImportCommand message)
|
|||||||
// Augment movie file so imported files have all additional information an automatic import would
|
// Augment movie file so imported files have all additional information an automatic import would
|
||||||
localMovie = _aggregationService.Augment(localMovie, trackedDownload?.DownloadItem);
|
localMovie = _aggregationService.Augment(localMovie, trackedDownload?.DownloadItem);
|
||||||
localMovie.CustomFormats = _formatCalculator.ParseCustomFormat(localMovie);
|
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.
|
// Apply the user-chosen values.
|
||||||
localMovie.Movie = movie;
|
localMovie.Movie = movie;
|
||||||
|
@ -27,7 +27,7 @@ public UpgradeSpecification(IConfigService configService,
|
|||||||
public Decision IsSatisfiedBy(LocalMovie localMovie, DownloadClientItem downloadClientItem)
|
public Decision IsSatisfiedBy(LocalMovie localMovie, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;
|
var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;
|
||||||
var qualityProfile = localMovie.Movie.Profile;
|
var qualityProfile = localMovie.Movie.QualityProfile;
|
||||||
var qualityComparer = new QualityModelComparer(qualityProfile);
|
var qualityComparer = new QualityModelComparer(qualityProfile);
|
||||||
|
|
||||||
if (localMovie.Movie.MovieFileId > 0)
|
if (localMovie.Movie.MovieFileId > 0)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Movies
|
namespace NzbDrone.Core.Movies
|
||||||
{
|
{
|
||||||
@ -19,7 +19,7 @@ public Movie()
|
|||||||
|
|
||||||
public bool Monitored { get; set; }
|
public bool Monitored { get; set; }
|
||||||
public MovieStatusType MinimumAvailability { get; set; }
|
public MovieStatusType MinimumAvailability { get; set; }
|
||||||
public int ProfileId { get; set; }
|
public int QualityProfileId { get; set; }
|
||||||
|
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public Movie()
|
|||||||
|
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
public DateTime Added { get; set; }
|
public DateTime Added { get; set; }
|
||||||
public Profile Profile { get; set; }
|
public QualityProfile QualityProfile { get; set; }
|
||||||
public HashSet<int> Tags { get; set; }
|
public HashSet<int> Tags { get; set; }
|
||||||
public AddMovieOptions AddOptions { get; set; }
|
public AddMovieOptions AddOptions { get; set; }
|
||||||
public MovieFile MovieFile { get; set; }
|
public MovieFile MovieFile { get; set; }
|
||||||
@ -124,7 +124,7 @@ public override string ToString()
|
|||||||
public void ApplyChanges(Movie otherMovie)
|
public void ApplyChanges(Movie otherMovie)
|
||||||
{
|
{
|
||||||
Path = otherMovie.Path;
|
Path = otherMovie.Path;
|
||||||
ProfileId = otherMovie.ProfileId;
|
QualityProfileId = otherMovie.QualityProfileId;
|
||||||
|
|
||||||
Monitored = otherMovie.Monitored;
|
Monitored = otherMovie.Monitored;
|
||||||
MinimumAvailability = otherMovie.MinimumAvailability;
|
MinimumAvailability = otherMovie.MinimumAvailability;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Movies
|
namespace NzbDrone.Core.Movies
|
||||||
@ -16,9 +16,9 @@ public interface IMovieCutoffService
|
|||||||
public class MovieCutoffService : IMovieCutoffService
|
public class MovieCutoffService : IMovieCutoffService
|
||||||
{
|
{
|
||||||
private readonly IMovieRepository _movieRepository;
|
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;
|
_movieRepository = movieRepository;
|
||||||
_profileService = profileService;
|
_profileService = profileService;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Movies.AlternativeTitles;
|
using NzbDrone.Core.Movies.AlternativeTitles;
|
||||||
using NzbDrone.Core.Movies.Translations;
|
using NzbDrone.Core.Movies.Translations;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Movies
|
namespace NzbDrone.Core.Movies
|
||||||
@ -35,11 +35,11 @@ public interface IMovieRepository : IBasicRepository<Movie>
|
|||||||
|
|
||||||
public class MovieRepository : BasicRepository<Movie>, IMovieRepository
|
public class MovieRepository : BasicRepository<Movie>, IMovieRepository
|
||||||
{
|
{
|
||||||
private readonly IProfileRepository _profileRepository;
|
private readonly IQualityProfileRepository _profileRepository;
|
||||||
private readonly IAlternativeTitleRepository _alternativeTitleRepository;
|
private readonly IAlternativeTitleRepository _alternativeTitleRepository;
|
||||||
|
|
||||||
public MovieRepository(IMainDatabase database,
|
public MovieRepository(IMainDatabase database,
|
||||||
IProfileRepository profileRepository,
|
IQualityProfileRepository profileRepository,
|
||||||
IAlternativeTitleRepository alternativeTitleRepository,
|
IAlternativeTitleRepository alternativeTitleRepository,
|
||||||
IEventAggregator eventAggregator)
|
IEventAggregator eventAggregator)
|
||||||
: base(database, eventAggregator)
|
: base(database, eventAggregator)
|
||||||
@ -49,17 +49,17 @@ public MovieRepository(IMainDatabase database,
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override SqlBuilder Builder() => new SqlBuilder(_database.DatabaseType)
|
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)
|
.Join<Movie, MovieMetadata>((m, p) => m.MovieMetadataId == p.Id)
|
||||||
.LeftJoin<Movie, MovieFile>((m, f) => m.Id == f.MovieId)
|
.LeftJoin<Movie, MovieFile>((m, f) => m.Id == f.MovieId)
|
||||||
.LeftJoin<MovieMetadata, AlternativeTitle>((mm, t) => mm.Id == t.MovieMetadataId);
|
.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))
|
if (!dict.TryGetValue(movie.Id, out var movieEntry))
|
||||||
{
|
{
|
||||||
movieEntry = movie;
|
movieEntry = movie;
|
||||||
movieEntry.Profile = profile;
|
movieEntry.QualityProfile = profile;
|
||||||
movieEntry.MovieFile = movieFile;
|
movieEntry.MovieFile = movieFile;
|
||||||
dict.Add(movieEntry.Id, movieEntry);
|
dict.Add(movieEntry.Id, movieEntry);
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ protected override List<Movie> Query(SqlBuilder builder)
|
|||||||
{
|
{
|
||||||
var movieDictionary = new Dictionary<int, Movie>();
|
var movieDictionary = new Dictionary<int, Movie>();
|
||||||
|
|
||||||
_ = _database.QueryJoined<Movie, Profile, MovieFile, AlternativeTitle>(
|
_ = _database.QueryJoined<Movie, QualityProfile, MovieFile, AlternativeTitle>(
|
||||||
builder,
|
builder,
|
||||||
(movie, profile, file, altTitle) => Map(movieDictionary, movie, profile, file, altTitle));
|
(movie, profile, file, altTitle) => Map(movieDictionary, movie, profile, file, altTitle));
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ public override IEnumerable<Movie> All()
|
|||||||
{
|
{
|
||||||
movie.MovieFile = file;
|
movie.MovieFile = file;
|
||||||
movie.MovieMetadata = metadata;
|
movie.MovieMetadata = metadata;
|
||||||
movie.Profile = profiles[movie.ProfileId];
|
movie.QualityProfile = profiles[movie.QualityProfileId];
|
||||||
|
|
||||||
if (titles.TryGetValue(movie.MovieMetadataId, out var altTitles))
|
if (titles.TryGetValue(movie.MovieMetadataId, out var altTitles))
|
||||||
{
|
{
|
||||||
@ -143,12 +143,12 @@ private List<Movie> FindByMovieTitles(List<string> titles)
|
|||||||
var movieDictionary = new Dictionary<int, Movie>();
|
var movieDictionary = new Dictionary<int, Movie>();
|
||||||
|
|
||||||
var builder = new SqlBuilder(_database.DatabaseType)
|
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)
|
.Join<Movie, MovieMetadata>((m, p) => m.MovieMetadataId == p.Id)
|
||||||
.LeftJoin<Movie, MovieFile>((m, f) => m.Id == f.MovieId)
|
.LeftJoin<Movie, MovieFile>((m, f) => m.Id == f.MovieId)
|
||||||
.Where<MovieMetadata>(x => titles.Contains(x.CleanTitle) || titles.Contains(x.CleanOriginalTitle));
|
.Where<MovieMetadata>(x => titles.Contains(x.CleanTitle) || titles.Contains(x.CleanOriginalTitle));
|
||||||
|
|
||||||
_ = _database.QueryJoined<Movie, Profile, MovieFile>(
|
_ = _database.QueryJoined<Movie, QualityProfile, MovieFile>(
|
||||||
builder,
|
builder,
|
||||||
(movie, profile, file) => Map(movieDictionary, movie, profile, file));
|
(movie, profile, file) => Map(movieDictionary, movie, profile, file));
|
||||||
|
|
||||||
@ -162,11 +162,11 @@ private List<Movie> FindByAltTitles(List<string> titles)
|
|||||||
var builder = new SqlBuilder(_database.DatabaseType)
|
var builder = new SqlBuilder(_database.DatabaseType)
|
||||||
.Join<AlternativeTitle, MovieMetadata>((t, mm) => t.MovieMetadataId == mm.Id)
|
.Join<AlternativeTitle, MovieMetadata>((t, mm) => t.MovieMetadataId == mm.Id)
|
||||||
.Join<MovieMetadata, Movie>((mm, m) => mm.Id == m.MovieMetadataId)
|
.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)
|
.LeftJoin<Movie, MovieFile>((m, f) => m.Id == f.MovieId)
|
||||||
.Where<AlternativeTitle>(x => titles.Contains(x.CleanTitle));
|
.Where<AlternativeTitle>(x => titles.Contains(x.CleanTitle));
|
||||||
|
|
||||||
_ = _database.QueryJoined<AlternativeTitle, Profile, Movie, MovieFile>(
|
_ = _database.QueryJoined<AlternativeTitle, QualityProfile, Movie, MovieFile>(
|
||||||
builder,
|
builder,
|
||||||
(altTitle, profile, movie, file) =>
|
(altTitle, profile, movie, file) =>
|
||||||
{
|
{
|
||||||
@ -184,11 +184,11 @@ private List<Movie> FindByTransTitles(List<string> titles)
|
|||||||
var builder = new SqlBuilder(_database.DatabaseType)
|
var builder = new SqlBuilder(_database.DatabaseType)
|
||||||
.Join<MovieTranslation, MovieMetadata>((t, mm) => t.MovieMetadataId == mm.Id)
|
.Join<MovieTranslation, MovieMetadata>((t, mm) => t.MovieMetadataId == mm.Id)
|
||||||
.Join<MovieMetadata, Movie>((mm, m) => mm.Id == m.MovieMetadataId)
|
.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)
|
.LeftJoin<Movie, MovieFile>((m, f) => m.Id == f.MovieId)
|
||||||
.Where<MovieTranslation>(x => titles.Contains(x.CleanTitle));
|
.Where<MovieTranslation>(x => titles.Contains(x.CleanTitle));
|
||||||
|
|
||||||
_ = _database.QueryJoined<MovieTranslation, Profile, Movie, MovieFile>(
|
_ = _database.QueryJoined<MovieTranslation, QualityProfile, Movie, MovieFile>(
|
||||||
builder,
|
builder,
|
||||||
(trans, profile, movie, file) =>
|
(trans, profile, movie, file) =>
|
||||||
{
|
{
|
||||||
@ -272,7 +272,7 @@ private string BuildQualityCutoffWhereClause(List<QualitiesBelowCutoff> qualitie
|
|||||||
{
|
{
|
||||||
foreach (var belowCutoff in profile.QualityIds)
|
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},%')"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ private void SyncCollectionMovies(MovieCollection collection)
|
|||||||
{
|
{
|
||||||
TmdbId = m.TmdbId,
|
TmdbId = m.TmdbId,
|
||||||
Title = m.Title,
|
Title = m.Title,
|
||||||
ProfileId = collection.QualityProfileId,
|
QualityProfileId = collection.QualityProfileId,
|
||||||
RootFolderPath = collection.RootFolderPath,
|
RootFolderPath = collection.RootFolderPath,
|
||||||
MinimumAvailability = collection.MinimumAvailability,
|
MinimumAvailability = collection.MinimumAvailability,
|
||||||
AddOptions = new AddMovieOptions
|
AddOptions = new AddMovieOptions
|
||||||
|
@ -142,7 +142,7 @@ private Movie RefreshMovieInfo(int movieId)
|
|||||||
Title = movieInfo.CollectionTitle,
|
Title = movieInfo.CollectionTitle,
|
||||||
Monitored = movie.AddOptions?.Monitor == MonitorTypes.MovieAndCollection,
|
Monitored = movie.AddOptions?.Monitor == MonitorTypes.MovieAndCollection,
|
||||||
SearchOnAdd = movie.AddOptions?.SearchForMovie ?? false,
|
SearchOnAdd = movie.AddOptions?.SearchForMovie ?? false,
|
||||||
QualityProfileId = movie.ProfileId,
|
QualityProfileId = movie.QualityProfileId,
|
||||||
MinimumAvailability = movie.MinimumAvailability,
|
MinimumAvailability = movie.MinimumAvailability,
|
||||||
RootFolderPath = _folderService.GetBestRootFolderPath(movie.Path).TrimEnd('/', '\\', ' '),
|
RootFolderPath = _folderService.GetBestRootFolderPath(movie.Path).TrimEnd('/', '\\', ' '),
|
||||||
Tags = movie.Tags
|
Tags = movie.Tags
|
||||||
|
@ -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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Profiles
|
namespace NzbDrone.Core.Profiles.Qualities
|
||||||
{
|
{
|
||||||
public class QualityIndex : IComparable, IComparable<QualityIndex>
|
public class QualityIndex : IComparable, IComparable<QualityIndex>
|
||||||
{
|
{
|
@ -5,18 +5,18 @@
|
|||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.Qualities;
|
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>();
|
FormatItems = new List<ProfileFormatItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public int Cutoff { 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 MinFormatScore { get; set; }
|
||||||
public int CutoffFormatScore { get; set; }
|
public int CutoffFormatScore { get; set; }
|
||||||
public List<ProfileFormatItem> FormatItems { get; set; }
|
public List<ProfileFormatItem> FormatItems { get; set; }
|
@ -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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,21 +5,21 @@
|
|||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Qualities;
|
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)]
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public Quality Quality { 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 bool Allowed { get; set; }
|
||||||
|
|
||||||
public ProfileQualityItem()
|
public QualityProfileQualityItem()
|
||||||
{
|
{
|
||||||
Items = new List<ProfileQualityItem>();
|
Items = new List<QualityProfileQualityItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Quality> GetQualities()
|
public List<Quality> GetQualities()
|
@ -4,18 +4,18 @@
|
|||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
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);
|
bool Exists(int id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProfileRepository : BasicRepository<Profile>, IProfileRepository
|
public class QualityProfileRepository : BasicRepository<QualityProfile>, IQualityProfileRepository
|
||||||
{
|
{
|
||||||
private readonly ICustomFormatService _customFormatService;
|
private readonly ICustomFormatService _customFormatService;
|
||||||
|
|
||||||
public ProfileRepository(IMainDatabase database,
|
public QualityProfileRepository(IMainDatabase database,
|
||||||
IEventAggregator eventAggregator,
|
IEventAggregator eventAggregator,
|
||||||
ICustomFormatService customFormatService)
|
ICustomFormatService customFormatService)
|
||||||
: base(database, eventAggregator)
|
: base(database, eventAggregator)
|
||||||
@ -23,7 +23,7 @@ public ProfileRepository(IMainDatabase database,
|
|||||||
_customFormatService = customFormatService;
|
_customFormatService = customFormatService;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<Profile> Query(SqlBuilder builder)
|
protected override List<QualityProfile> Query(SqlBuilder builder)
|
||||||
{
|
{
|
||||||
var cfs = _customFormatService.All().ToDictionary(c => c.Id);
|
var cfs = _customFormatService.All().ToDictionary(c => c.Id);
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ protected override List<Profile> Query(SqlBuilder builder)
|
|||||||
|
|
||||||
public bool Exists(int id)
|
public bool Exists(int id)
|
||||||
{
|
{
|
||||||
return Query(x => x.Id == id).Count == 1;
|
return Query(p => p.Id == id).Count == 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,33 +11,33 @@
|
|||||||
using NzbDrone.Core.Movies.Collections;
|
using NzbDrone.Core.Movies.Collections;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Profiles
|
namespace NzbDrone.Core.Profiles.Qualities
|
||||||
{
|
{
|
||||||
public interface IProfileService
|
public interface IQualityProfileService
|
||||||
{
|
{
|
||||||
Profile Add(Profile profile);
|
QualityProfile Add(QualityProfile profile);
|
||||||
void Update(Profile profile);
|
void Update(QualityProfile profile);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
List<Profile> All();
|
List<QualityProfile> All();
|
||||||
Profile Get(int id);
|
QualityProfile Get(int id);
|
||||||
bool Exists(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);
|
List<Language> GetAcceptableLanguages(int profileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProfileService : IProfileService,
|
public class QualityProfileService : IQualityProfileService,
|
||||||
IHandle<ApplicationStartedEvent>,
|
IHandle<ApplicationStartedEvent>,
|
||||||
IHandle<CustomFormatAddedEvent>,
|
IHandle<CustomFormatAddedEvent>,
|
||||||
IHandle<CustomFormatDeletedEvent>
|
IHandle<CustomFormatDeletedEvent>
|
||||||
{
|
{
|
||||||
private readonly IProfileRepository _profileRepository;
|
private readonly IQualityProfileRepository _profileRepository;
|
||||||
private readonly ICustomFormatService _formatService;
|
private readonly ICustomFormatService _formatService;
|
||||||
private readonly IMovieService _movieService;
|
private readonly IMovieService _movieService;
|
||||||
private readonly IImportListFactory _importListFactory;
|
private readonly IImportListFactory _importListFactory;
|
||||||
private readonly IMovieCollectionService _collectionService;
|
private readonly IMovieCollectionService _collectionService;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public ProfileService(IProfileRepository profileRepository,
|
public QualityProfileService(IQualityProfileRepository profileRepository,
|
||||||
ICustomFormatService formatService,
|
ICustomFormatService formatService,
|
||||||
IMovieService movieService,
|
IMovieService movieService,
|
||||||
IImportListFactory importListFactory,
|
IImportListFactory importListFactory,
|
||||||
@ -52,32 +52,32 @@ public ProfileService(IProfileRepository profileRepository,
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Profile Add(Profile profile)
|
public QualityProfile Add(QualityProfile profile)
|
||||||
{
|
{
|
||||||
return _profileRepository.Insert(profile);
|
return _profileRepository.Insert(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(Profile profile)
|
public void Update(QualityProfile profile)
|
||||||
{
|
{
|
||||||
_profileRepository.Update(profile);
|
_profileRepository.Update(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(int id)
|
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);
|
_profileRepository.Delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Profile> All()
|
public List<QualityProfile> All()
|
||||||
{
|
{
|
||||||
return _profileRepository.All().ToList();
|
return _profileRepository.All().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Profile Get(int id)
|
public QualityProfile Get(int id)
|
||||||
{
|
{
|
||||||
return _profileRepository.Get(id);
|
return _profileRepository.Get(id);
|
||||||
}
|
}
|
||||||
@ -209,10 +209,10 @@ public void Handle(ApplicationStartedEvent message)
|
|||||||
Quality.Remux1080p);
|
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 groupedQualites = Quality.DefaultQualityDefinitions.GroupBy(q => q.Weight);
|
||||||
var items = new List<ProfileQualityItem>();
|
var items = new List<QualityProfileQualityItem>();
|
||||||
var groupId = 1000;
|
var groupId = 1000;
|
||||||
var profileCutoff = cutoff == null ? Quality.Unknown.Id : cutoff.Id;
|
var profileCutoff = cutoff == null ? Quality.Unknown.Id : cutoff.Id;
|
||||||
|
|
||||||
@ -222,17 +222,17 @@ public Profile GetDefaultProfile(string name, Quality cutoff = null, params Qual
|
|||||||
{
|
{
|
||||||
var quality = group.First().Quality;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var groupAllowed = group.Any(g => allowed.Contains(g.Quality));
|
var groupAllowed = group.Any(g => allowed.Contains(g.Quality));
|
||||||
|
|
||||||
items.Add(new ProfileQualityItem
|
items.Add(new QualityProfileQualityItem
|
||||||
{
|
{
|
||||||
Id = groupId,
|
Id = groupId,
|
||||||
Name = group.First().GroupName,
|
Name = group.First().GroupName,
|
||||||
Items = group.Select(g => new ProfileQualityItem
|
Items = group.Select(g => new QualityProfileQualityItem
|
||||||
{
|
{
|
||||||
Quality = g.Quality,
|
Quality = g.Quality,
|
||||||
Allowed = groupAllowed
|
Allowed = groupAllowed
|
||||||
@ -254,7 +254,7 @@ public Profile GetDefaultProfile(string name, Quality cutoff = null, params Qual
|
|||||||
Format = format
|
Format = format
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
var qualityProfile = new Profile
|
var qualityProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Name = name,
|
Name = name,
|
||||||
Cutoff = profileCutoff,
|
Cutoff = profileCutoff,
|
||||||
@ -286,7 +286,7 @@ public List<Language> GetAcceptableLanguages(int profileId)
|
|||||||
return wantedTitleLanguages;
|
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);
|
var profile = GetDefaultProfile(name, cutoff, allowed);
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Common.EnsureThat;
|
using NzbDrone.Common.EnsureThat;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Qualities
|
namespace NzbDrone.Core.Qualities
|
||||||
{
|
{
|
||||||
public class QualityModelComparer : IComparer<Quality>, IComparer<QualityModel>
|
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, () => profile).IsNotNull();
|
||||||
Ensure.That(profile.Items, () => profile.Items).HasItems();
|
Ensure.That(profile.Items, () => profile.Items).HasItems();
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
using FluentValidation.Validators;
|
using FluentValidation.Validators;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Validation
|
namespace NzbDrone.Core.Validation
|
||||||
{
|
{
|
||||||
public class ProfileExistsValidator : PropertyValidator
|
public class ProfileExistsValidator : PropertyValidator
|
||||||
{
|
{
|
||||||
private readonly IProfileService _profileService;
|
private readonly IQualityProfileService _profileService;
|
||||||
|
|
||||||
public ProfileExistsValidator(IProfileService profileService)
|
public ProfileExistsValidator(IQualityProfileService profileService)
|
||||||
{
|
{
|
||||||
_profileService = profileService;
|
_profileService = profileService;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ protected HistoryResource MapToResource(MovieHistory model, bool includeMovie)
|
|||||||
|
|
||||||
if (model.Movie != null)
|
if (model.Movie != null)
|
||||||
{
|
{
|
||||||
resource.QualityCutoffNotMet = _upgradableSpecification.QualityCutoffNotMet(model.Movie.Profile, model.Quality);
|
resource.QualityCutoffNotMet = _upgradableSpecification.QualityCutoffNotMet(model.Movie.QualityProfile, model.Quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
|
@ -39,7 +39,7 @@ public static HistoryResource ToResource(this MovieHistory model, ICustomFormatC
|
|||||||
}
|
}
|
||||||
|
|
||||||
var customFormats = formatCalculator.ParseCustomFormat(model, model.Movie);
|
var customFormats = formatCalculator.ParseCustomFormat(model, model.Movie);
|
||||||
var customFormatScore = model.Movie.Profile.CalculateCustomFormatScore(customFormats);
|
var customFormatScore = model.Movie.QualityProfile.CalculateCustomFormatScore(customFormats);
|
||||||
|
|
||||||
return new HistoryResource
|
return new HistoryResource
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@ public class ImportListBulkResource : ProviderBulkResource<ImportListBulkResourc
|
|||||||
{
|
{
|
||||||
public bool? EnableAuto { get; set; }
|
public bool? EnableAuto { get; set; }
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
public int? ProfileId { get; set; }
|
public int? QualityProfileId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ImportListBulkResourceMapper : ProviderBulkResourceMapper<ImportListBulkResource, ImportListDefinition>
|
public class ImportListBulkResourceMapper : ProviderBulkResourceMapper<ImportListBulkResource, ImportListDefinition>
|
||||||
@ -23,7 +23,7 @@ public override List<ImportListDefinition> UpdateModel(ImportListBulkResource re
|
|||||||
{
|
{
|
||||||
existing.EnableAuto = resource.EnableAuto ?? existing.EnableAuto;
|
existing.EnableAuto = resource.EnableAuto ?? existing.EnableAuto;
|
||||||
existing.RootFolderPath = resource.RootFolderPath ?? existing.RootFolderPath;
|
existing.RootFolderPath = resource.RootFolderPath ?? existing.RootFolderPath;
|
||||||
existing.ProfileId = resource.ProfileId ?? existing.ProfileId;
|
existing.QualityProfileId = resource.QualityProfileId ?? existing.QualityProfileId;
|
||||||
});
|
});
|
||||||
|
|
||||||
return existingDefinitions;
|
return existingDefinitions;
|
||||||
|
@ -34,7 +34,7 @@ public override ImportListResource ToResource(ImportListDefinition definition)
|
|||||||
resource.Monitor = definition.Monitor;
|
resource.Monitor = definition.Monitor;
|
||||||
resource.SearchOnAdd = definition.SearchOnAdd;
|
resource.SearchOnAdd = definition.SearchOnAdd;
|
||||||
resource.RootFolderPath = definition.RootFolderPath;
|
resource.RootFolderPath = definition.RootFolderPath;
|
||||||
resource.QualityProfileId = definition.ProfileId;
|
resource.QualityProfileId = definition.QualityProfileId;
|
||||||
resource.MinimumAvailability = definition.MinimumAvailability;
|
resource.MinimumAvailability = definition.MinimumAvailability;
|
||||||
resource.ListType = definition.ListType;
|
resource.ListType = definition.ListType;
|
||||||
resource.ListOrder = (int)definition.ListType;
|
resource.ListOrder = (int)definition.ListType;
|
||||||
@ -57,7 +57,7 @@ public override ImportListDefinition ToModel(ImportListResource resource, Import
|
|||||||
definition.Monitor = resource.Monitor;
|
definition.Monitor = resource.Monitor;
|
||||||
definition.SearchOnAdd = resource.SearchOnAdd;
|
definition.SearchOnAdd = resource.SearchOnAdd;
|
||||||
definition.RootFolderPath = resource.RootFolderPath;
|
definition.RootFolderPath = resource.RootFolderPath;
|
||||||
definition.ProfileId = resource.QualityProfileId;
|
definition.QualityProfileId = resource.QualityProfileId;
|
||||||
definition.MinimumAvailability = resource.MinimumAvailability;
|
definition.MinimumAvailability = resource.MinimumAvailability;
|
||||||
definition.ListType = resource.ListType;
|
definition.ListType = resource.ListType;
|
||||||
definition.MinRefreshInterval = resource.MinRefreshInterval;
|
definition.MinRefreshInterval = resource.MinRefreshInterval;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
using NzbDrone.Core.IndexerSearch;
|
using NzbDrone.Core.IndexerSearch;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Validation;
|
using NzbDrone.Core.Validation;
|
||||||
using Radarr.Http;
|
using Radarr.Http;
|
||||||
using HttpStatusCode = System.Net.HttpStatusCode;
|
using HttpStatusCode = System.Net.HttpStatusCode;
|
||||||
@ -39,7 +39,7 @@ public ReleaseController(IFetchAndParseRss rssFetcherAndParser,
|
|||||||
IDownloadService downloadService,
|
IDownloadService downloadService,
|
||||||
IMovieService movieService,
|
IMovieService movieService,
|
||||||
ICacheManager cacheManager,
|
ICacheManager cacheManager,
|
||||||
IProfileService qualityProfileService,
|
IQualityProfileService qualityProfileService,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
: base(qualityProfileService)
|
: base(qualityProfileService)
|
||||||
{
|
{
|
||||||
|
@ -2,16 +2,16 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using Radarr.Http.REST;
|
using Radarr.Http.REST;
|
||||||
|
|
||||||
namespace Radarr.Api.V3.Indexers
|
namespace Radarr.Api.V3.Indexers
|
||||||
{
|
{
|
||||||
public abstract class ReleaseControllerBase : RestController<ReleaseResource>
|
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);
|
_qualityProfile = qualityProfileService.GetDefaultProfile(string.Empty);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using Radarr.Http;
|
using Radarr.Http;
|
||||||
|
|
||||||
namespace Radarr.Api.V3.Indexers
|
namespace Radarr.Api.V3.Indexers
|
||||||
@ -28,7 +28,7 @@ public class ReleasePushController : ReleaseControllerBase
|
|||||||
public ReleasePushController(IMakeDownloadDecision downloadDecisionMaker,
|
public ReleasePushController(IMakeDownloadDecision downloadDecisionMaker,
|
||||||
IProcessDownloadDecisions downloadDecisionProcessor,
|
IProcessDownloadDecisions downloadDecisionProcessor,
|
||||||
IIndexerFactory indexerFactory,
|
IIndexerFactory indexerFactory,
|
||||||
IProfileService qualityProfileService,
|
IQualityProfileService qualityProfileService,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
: base(qualityProfileService)
|
: base(qualityProfileService)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ public static ManualImportResource ToResource(this ManualImportItem model)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var customFormats = model.CustomFormats;
|
var customFormats = model.CustomFormats;
|
||||||
var customFormatScore = model.Movie?.Profile?.CalculateCustomFormatScore(customFormats) ?? 0;
|
var customFormatScore = model.Movie?.QualityProfile?.CalculateCustomFormatScore(customFormats) ?? 0;
|
||||||
|
|
||||||
return new ManualImportResource
|
return new ManualImportResource
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ protected override MovieFileResource GetResourceById(int id)
|
|||||||
var resource = movieFile.ToResource(movie, _qualityUpgradableSpecification);
|
var resource = movieFile.ToResource(movie, _qualityUpgradableSpecification);
|
||||||
|
|
||||||
var customFormats = _formatCalculator.ParseCustomFormat(movieFile);
|
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.CustomFormats = customFormats.ToResource(false);
|
||||||
resource.CustomFormatScore = customFormatScore;
|
resource.CustomFormatScore = customFormatScore;
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public List<MovieFileResource> GetMovieFiles(int? movieId, [FromQuery] List<int>
|
|||||||
file.Movie = movie;
|
file.Movie = movie;
|
||||||
|
|
||||||
var customFormats = _formatCalculator.ParseCustomFormat(file);
|
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.CustomFormats = customFormats.ToResource(false);
|
||||||
resource.CustomFormatScore = customFormatScore;
|
resource.CustomFormatScore = customFormatScore;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public static MovieFileResource ToResource(this MovieFile model, NzbDrone.Core.M
|
|||||||
Edition = model.Edition,
|
Edition = model.Edition,
|
||||||
ReleaseGroup = model.ReleaseGroup,
|
ReleaseGroup = model.ReleaseGroup,
|
||||||
MediaInfo = model.MediaInfo.ToResource(model.SceneName),
|
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
|
OriginalFilePath = model.OriginalFilePath
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public IActionResult SaveAll([FromBody] MovieEditorResource resource)
|
|||||||
|
|
||||||
if (resource.QualityProfileId.HasValue)
|
if (resource.QualityProfileId.HasValue)
|
||||||
{
|
{
|
||||||
movie.ProfileId = resource.QualityProfileId.Value;
|
movie.QualityProfileId = resource.QualityProfileId.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resource.MinimumAvailability.HasValue)
|
if (resource.MinimumAvailability.HasValue)
|
||||||
|
@ -119,7 +119,7 @@ public static MovieResource ToResource(this Movie model, int availDelay, MovieTr
|
|||||||
SecondaryYear = model.MovieMetadata.Value.SecondaryYear,
|
SecondaryYear = model.MovieMetadata.Value.SecondaryYear,
|
||||||
|
|
||||||
Path = model.Path,
|
Path = model.Path,
|
||||||
QualityProfileId = model.ProfileId,
|
QualityProfileId = model.QualityProfileId,
|
||||||
|
|
||||||
Monitored = model.Monitored,
|
Monitored = model.Monitored,
|
||||||
MinimumAvailability = model.MinimumAvailability,
|
MinimumAvailability = model.MinimumAvailability,
|
||||||
@ -183,7 +183,7 @@ public static Movie ToModel(this MovieResource resource)
|
|||||||
},
|
},
|
||||||
|
|
||||||
Path = resource.Path,
|
Path = resource.Path,
|
||||||
ProfileId = resource.QualityProfileId,
|
QualityProfileId = resource.QualityProfileId,
|
||||||
|
|
||||||
Monitored = resource.Monitored,
|
Monitored = resource.Monitored,
|
||||||
MinimumAvailability = resource.MinimumAvailability,
|
MinimumAvailability = resource.MinimumAvailability,
|
||||||
|
@ -54,7 +54,7 @@ public ParseResource Parse(string title)
|
|||||||
_aggregationService.Augment(remoteMovie);
|
_aggregationService.Augment(remoteMovie);
|
||||||
|
|
||||||
remoteMovie.CustomFormats = _formatCalculator.ParseCustomFormat(remoteMovie, 0);
|
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
|
return new ParseResource
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.CustomFormats;
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using Radarr.Http;
|
using Radarr.Http;
|
||||||
using Radarr.Http.REST;
|
using Radarr.Http.REST;
|
||||||
using Radarr.Http.REST.Attributes;
|
using Radarr.Http.REST.Attributes;
|
||||||
@ -14,10 +14,10 @@ namespace Radarr.Api.V3.Profiles.Quality
|
|||||||
[V3ApiController]
|
[V3ApiController]
|
||||||
public class QualityProfileController : RestController<QualityProfileResource>
|
public class QualityProfileController : RestController<QualityProfileResource>
|
||||||
{
|
{
|
||||||
private readonly IProfileService _profileService;
|
private readonly IQualityProfileService _profileService;
|
||||||
private readonly ICustomFormatService _formatService;
|
private readonly ICustomFormatService _formatService;
|
||||||
|
|
||||||
public QualityProfileController(IProfileService profileService, ICustomFormatService formatService)
|
public QualityProfileController(IQualityProfileService profileService, ICustomFormatService formatService)
|
||||||
{
|
{
|
||||||
_profileService = profileService;
|
_profileService = profileService;
|
||||||
_formatService = formatService;
|
_formatService = formatService;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
using NzbDrone.Core.CustomFormats;
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using Radarr.Http.REST;
|
using Radarr.Http.REST;
|
||||||
|
|
||||||
namespace Radarr.Api.V3.Profiles.Quality
|
namespace Radarr.Api.V3.Profiles.Quality
|
||||||
@ -41,7 +42,7 @@ public class ProfileFormatItemResource : RestResource
|
|||||||
|
|
||||||
public static class ProfileResourceMapper
|
public static class ProfileResourceMapper
|
||||||
{
|
{
|
||||||
public static QualityProfileResource ToResource(this Profile model)
|
public static QualityProfileResource ToResource(this QualityProfile model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -62,7 +63,7 @@ public static QualityProfileResource ToResource(this Profile model)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static QualityProfileQualityItemResource ToResource(this ProfileQualityItem model)
|
public static QualityProfileQualityItemResource ToResource(this QualityProfileQualityItem model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -89,14 +90,14 @@ public static ProfileFormatItemResource ToResource(this ProfileFormatItem model)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Profile ToModel(this QualityProfileResource resource)
|
public static QualityProfile ToModel(this QualityProfileResource resource)
|
||||||
{
|
{
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Profile
|
return new QualityProfile
|
||||||
{
|
{
|
||||||
Id = resource.Id,
|
Id = resource.Id,
|
||||||
Name = resource.Name,
|
Name = resource.Name,
|
||||||
@ -110,14 +111,14 @@ public static Profile ToModel(this QualityProfileResource resource)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ProfileQualityItem ToModel(this QualityProfileQualityItemResource resource)
|
public static QualityProfileQualityItem ToModel(this QualityProfileQualityItemResource resource)
|
||||||
{
|
{
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ProfileQualityItem
|
return new QualityProfileQualityItem
|
||||||
{
|
{
|
||||||
Id = resource.Id,
|
Id = resource.Id,
|
||||||
Name = resource.Name,
|
Name = resource.Name,
|
||||||
@ -136,7 +137,7 @@ public static ProfileFormatItem ToModel(this ProfileFormatItemResource resource)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<QualityProfileResource> ToResource(this IEnumerable<Profile> models)
|
public static List<QualityProfileResource> ToResource(this IEnumerable<QualityProfile> models)
|
||||||
{
|
{
|
||||||
return models.Select(ToResource).ToList();
|
return models.Select(ToResource).ToList();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using Radarr.Http;
|
using Radarr.Http;
|
||||||
|
|
||||||
namespace Radarr.Api.V3.Profiles.Quality
|
namespace Radarr.Api.V3.Profiles.Quality
|
||||||
@ -7,9 +7,9 @@ namespace Radarr.Api.V3.Profiles.Quality
|
|||||||
[V3ApiController("qualityprofile/schema")]
|
[V3ApiController("qualityprofile/schema")]
|
||||||
public class QualityProfileSchemaController : Controller
|
public class QualityProfileSchemaController : Controller
|
||||||
{
|
{
|
||||||
private readonly IProfileService _profileService;
|
private readonly IQualityProfileService _profileService;
|
||||||
|
|
||||||
public QualityProfileSchemaController(IProfileService profileService)
|
public QualityProfileSchemaController(IQualityProfileService profileService)
|
||||||
{
|
{
|
||||||
_profileService = profileService;
|
_profileService = profileService;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
using NzbDrone.Core.Download.TrackedDownloads;
|
using NzbDrone.Core.Download.TrackedDownloads;
|
||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles.Qualities;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Queue;
|
using NzbDrone.Core.Queue;
|
||||||
using NzbDrone.SignalR;
|
using NzbDrone.SignalR;
|
||||||
@ -39,7 +39,7 @@ public class QueueController : RestControllerWithSignalR<QueueResource, NzbDrone
|
|||||||
public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
|
public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
|
||||||
IQueueService queueService,
|
IQueueService queueService,
|
||||||
IPendingReleaseService pendingReleaseService,
|
IPendingReleaseService pendingReleaseService,
|
||||||
ProfileService qualityProfileService,
|
QualityProfileService qualityProfileService,
|
||||||
ITrackedDownloadService trackedDownloadService,
|
ITrackedDownloadService trackedDownloadService,
|
||||||
IFailedDownloadService failedDownloadService,
|
IFailedDownloadService failedDownloadService,
|
||||||
IIgnoredDownloadService ignoredDownloadService,
|
IIgnoredDownloadService ignoredDownloadService,
|
||||||
|
@ -47,7 +47,7 @@ public static QueueResource ToResource(this NzbDrone.Core.Queue.Queue model, boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
var customFormats = model.RemoteMovie?.CustomFormats;
|
var customFormats = model.RemoteMovie?.CustomFormats;
|
||||||
var customFormatScore = model.Movie?.Profile?.CalculateCustomFormatScore(customFormats) ?? 0;
|
var customFormatScore = model.Movie?.QualityProfile?.CalculateCustomFormatScore(customFormats) ?? 0;
|
||||||
|
|
||||||
return new QueueResource
|
return new QueueResource
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user