From 897f3fea99555b954091aca9298f2f212bd620fe Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 3 Jun 2018 21:36:15 -0700 Subject: [PATCH] New: Bluray 1080p and 2160p remux qualities --- .../071_unknown_quality_in_profileFixture.cs | 4 +- ..._add_ultrahd_quality_in_profilesFixture.cs | 4 +- .../122_add_remux_qualities_in_profile.cs | 58 ++++++++ .../NzbDrone.Core.Test.csproj | 3 +- .../ParserTests/QualityParserFixture.cs | 18 +++ .../071_unknown_quality_in_profile.cs | 35 ++--- .../101_add_ultrahd_quality_in_profiles.cs | 4 +- ...dd_webrip_and_br480_qualites_in_profile.cs | 6 +- .../122_add_remux_qualities_in_profile.cs | 137 ++++++++++++++++++ src/NzbDrone.Core/NzbDrone.Core.csproj | 1 + src/NzbDrone.Core/Parser/QualityParser.cs | 51 +++++-- src/NzbDrone.Core/Qualities/Quality.cs | 16 +- src/NzbDrone.Core/Qualities/QualitySource.cs | 3 +- .../IntegrationTestBase.cs | 2 +- 14 files changed, 297 insertions(+), 45 deletions(-) create mode 100644 src/NzbDrone.Core.Test/Datastore/Migration/122_add_remux_qualities_in_profile.cs create mode 100644 src/NzbDrone.Core/Datastore/Migration/122_add_remux_qualities_in_profile.cs diff --git a/src/NzbDrone.Core.Test/Datastore/Migration/071_unknown_quality_in_profileFixture.cs b/src/NzbDrone.Core.Test/Datastore/Migration/071_unknown_quality_in_profileFixture.cs index ad31df44c..4aa14402f 100644 --- a/src/NzbDrone.Core.Test/Datastore/Migration/071_unknown_quality_in_profileFixture.cs +++ b/src/NzbDrone.Core.Test/Datastore/Migration/071_unknown_quality_in_profileFixture.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Datastore.Migration; @@ -24,7 +24,7 @@ public void should_add_unknown_to_old_profile() }); }); - var profiles = db.Query("SELECT Items FROM Profiles LIMIT 1"); + var profiles = db.Query("SELECT Items FROM Profiles LIMIT 1"); var items = profiles.First().Items; items.Should().HaveCount(2); diff --git a/src/NzbDrone.Core.Test/Datastore/Migration/101_add_ultrahd_quality_in_profilesFixture.cs b/src/NzbDrone.Core.Test/Datastore/Migration/101_add_ultrahd_quality_in_profilesFixture.cs index 8e5562824..6062e562c 100644 --- a/src/NzbDrone.Core.Test/Datastore/Migration/101_add_ultrahd_quality_in_profilesFixture.cs +++ b/src/NzbDrone.Core.Test/Datastore/Migration/101_add_ultrahd_quality_in_profilesFixture.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Datastore.Migration; @@ -24,7 +24,7 @@ public void should_add_ultrahd_to_old_profile() }); }); - var profiles = db.Query("SELECT Items FROM Profiles LIMIT 1"); + var profiles = db.Query("SELECT Items FROM Profiles LIMIT 1"); var items = profiles.First().Items; items.Should().HaveCount(4); diff --git a/src/NzbDrone.Core.Test/Datastore/Migration/122_add_remux_qualities_in_profile.cs b/src/NzbDrone.Core.Test/Datastore/Migration/122_add_remux_qualities_in_profile.cs new file mode 100644 index 000000000..00ef9fb8c --- /dev/null +++ b/src/NzbDrone.Core.Test/Datastore/Migration/122_add_remux_qualities_in_profile.cs @@ -0,0 +1,58 @@ +using System.Linq; +using FluentAssertions; +using NUnit.Framework; +using NzbDrone.Core.Datastore.Migration; +using NzbDrone.Core.Test.Framework; + +namespace NzbDrone.Core.Test.Datastore.Migration +{ + [TestFixture] + public class add_remux_qualities_in_profileFixture : MigrationTest + { + [Test] + public void should_add_remux_to_old_profile() + { + var db = WithMigrationTestDb(c => + { + c.Insert.IntoTable("Profiles").Row(new + { + Id = 0, + Name = "Bluray", + Cutoff = 7, + Items = "[ { \"quality\": 7, \"allowed\": true }, { \"quality\": 19, \"allowed\": true } ]" + }); + }); + + var profiles = db.Query("SELECT Items FROM Profiles LIMIT 1"); + + var items = profiles.First().Items; + items.Should().HaveCount(4); + items.Select(v => v.Quality).Should().BeEquivalentTo(7, 20, 19, 21); + items.Select(v => v.Allowed).Should().BeEquivalentTo(true, false, true, false); + items.Select(v => v.Name).Should().BeEquivalentTo(null, null, null, null); + } + + [Test] + public void should_add_remux_to_old_profile_with_groups() + { + var db = WithMigrationTestDb(c => + { + c.Insert.IntoTable("Profiles").Row(new + { + Id = 0, + Name = "Bluray", + Cutoff = 7, + Items = "[ { \"id\": 1001, \"name\": \"Why?!\", \"allowed\": true, \"items\": [{ \"quality\": 8, \"allowed\": true }, { \"quality\": 7, \"allowed\": true }] }, { \"quality\": 19, \"allowed\": true } ]" + }); + }); + + var profiles = db.Query("SELECT Items FROM Profiles LIMIT 1"); + + var items = profiles.First().Items; + items.Should().HaveCount(4); + items.Select(v => v.Quality).Should().BeEquivalentTo(null, 20, 19, 21); + items.Select(v => v.Allowed).Should().BeEquivalentTo(true, false, true, false); + items.Select(v => v.Name).Should().BeEquivalentTo("Why?!", null, null, null); + } + } +} diff --git a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 310b16ff2..fa0396a3d 100644 --- a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -131,6 +131,7 @@ + @@ -138,7 +139,7 @@ - + diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index 49a091cc3..ce2c35418 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -286,6 +286,16 @@ public void should_parse_bluray1080p_quality(string title, bool proper) ParseAndVerifyQuality(title, Quality.Bluray1080p, proper); } + [TestCase("Yuri!!! on ICE - S01E12[JP BD Remux][ENG subs]", false)] + [TestCase("Agents.of.S.H.I.E.L.D.S01E08.The.Well.BluRay.1080p.AVC.DTS-HD.MA.5.1.REMUX-FraMeSToR", false)] + [TestCase("Miami.Vice.2x11.Nato.Per.La.Truffa.Bluray.Remux.AVC.1080p.AC3.ITA", false)] + [TestCase("Miami.Vice.2x11.Nato.Per.La.Truffa.Bluray.Remux.AVC.AC3.ITA", false)] + [TestCase("Arrow.S03E01.The.Calm.1080p.DTS-HD.MA.5.1.AVC.REMUX-FraMeSToR", false)] + public void should_parse_bluray1080p_remux_quality(string title, bool proper) + { + ParseAndVerifyQuality(title, Quality.Bluray1080pRemux, proper); + } + [TestCase("House.of.Cards.US.s05e13.4K.UHD.Bluray", false)] [TestCase("House.of.Cards.US.s05e13.UHD.4K.Bluray", false)] [TestCase("[DameDesuYo] Backlog Bundle - Part 1 (BD 4K 8bit FLAC)", false)] @@ -294,6 +304,14 @@ public void should_parse_bluray2160p_quality(string title, bool proper) ParseAndVerifyQuality(title, Quality.Bluray2160p, proper); } + [TestCase("Yuri!!! on ICE - S01E12[JP BD 2160p Remux][ENG subs]", false)] + [TestCase("Agents.of.S.H.I.E.L.D.S01E08.The.Well.BluRay.2160p.AVC.DTS-HD.MA.5.1.REMUX-FraMeSToR", false)] + [TestCase("Miami.Vice.2x11.Nato.Per.La.Truffa.Bluray.Remux.AVC.2160p.AC3.ITA", false)] + public void should_parse_bluray2160p_remux_quality(string title, bool proper) + { + ParseAndVerifyQuality(title, Quality.Bluray2160pRemux, proper); + } + [TestCase("POI S02E11 1080i HDTV DD5.1 MPEG2-TrollHD", false)] [TestCase("How I Met Your Mother S01E18 Nothing Good Happens After 2 A.M. 720p HDTV DD5.1 MPEG2-TrollHD", false)] [TestCase("The Voice S01E11 The Finals 1080i HDTV DD5.1 MPEG2-TrollHD", false)] diff --git a/src/NzbDrone.Core/Datastore/Migration/071_unknown_quality_in_profile.cs b/src/NzbDrone.Core/Datastore/Migration/071_unknown_quality_in_profile.cs index a033e8410..cc1f10fe1 100644 --- a/src/NzbDrone.Core/Datastore/Migration/071_unknown_quality_in_profile.cs +++ b/src/NzbDrone.Core/Datastore/Migration/071_unknown_quality_in_profile.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Data; using System.Linq; using FluentMigrator; @@ -19,35 +19,36 @@ protected override void MainDbUpgrade() private void ConvertProfile(IDbConnection conn, IDbTransaction tran) { - var updater = new ProfileUpdater70(conn, tran); + var updater = new ProfileUpdater71(conn, tran); updater.PrependQuality(0); updater.Commit(); } } - public class Profile70 + + public class Profile71 { public int Id { get; set; } public string Name { get; set; } public int Cutoff { get; set; } - public List Items { get; set; } + public List Items { get; set; } public int Language { get; set; } } - public class ProfileItem70 + public class ProfileItem71 { public int Quality { get; set; } public bool Allowed { get; set; } } - public class ProfileUpdater70 + public class ProfileUpdater71 { private readonly IDbConnection _connection; private readonly IDbTransaction _transaction; - private List _profiles; - private HashSet _changedProfiles = new HashSet(); + private List _profiles; + private HashSet _changedProfiles = new HashSet(); - public ProfileUpdater70(IDbConnection conn, IDbTransaction tran) + public ProfileUpdater71(IDbConnection conn, IDbTransaction tran) { _connection = conn; _transaction = tran; @@ -82,7 +83,7 @@ public void PrependQuality(int quality) { if (profile.Items.Any(v => v.Quality == quality)) continue; - profile.Items.Insert(0, new ProfileItem70 + profile.Items.Insert(0, new ProfileItem71 { Quality = quality, Allowed = false @@ -98,7 +99,7 @@ public void AppendQuality(int quality) { if (profile.Items.Any(v => v.Quality == quality)) continue; - profile.Items.Add(new ProfileItem70 + profile.Items.Add(new ProfileItem71 { Quality = quality, Allowed = false @@ -116,7 +117,7 @@ public void SplitQualityPrepend(int find, int quality) var findIndex = profile.Items.FindIndex(v => v.Quality == find); - profile.Items.Insert(findIndex, new ProfileItem70 + profile.Items.Insert(findIndex, new ProfileItem71 { Quality = quality, Allowed = profile.Items[findIndex].Allowed @@ -139,7 +140,7 @@ public void SplitQualityAppend(int find, int quality) var findIndex = profile.Items.FindIndex(v => v.Quality == find); - profile.Items.Insert(findIndex + 1, new ProfileItem70 + profile.Items.Insert(findIndex + 1, new ProfileItem71 { Quality = quality, Allowed = false @@ -149,9 +150,9 @@ public void SplitQualityAppend(int find, int quality) } } - private List GetProfiles() + private List GetProfiles() { - var profiles = new List(); + var profiles = new List(); using (var getProfilesCmd = _connection.CreateCommand()) { @@ -162,12 +163,12 @@ private List GetProfiles() { while (profileReader.Read()) { - profiles.Add(new Profile70 + profiles.Add(new Profile71 { Id = profileReader.GetInt32(0), Name = profileReader.GetString(1), Cutoff = profileReader.GetInt32(2), - Items = Json.Deserialize>(profileReader.GetString(3)), + Items = Json.Deserialize>(profileReader.GetString(3)), Language = profileReader.GetInt32(4) }); } diff --git a/src/NzbDrone.Core/Datastore/Migration/101_add_ultrahd_quality_in_profiles.cs b/src/NzbDrone.Core/Datastore/Migration/101_add_ultrahd_quality_in_profiles.cs index 171607fa6..e8049c9b4 100644 --- a/src/NzbDrone.Core/Datastore/Migration/101_add_ultrahd_quality_in_profiles.cs +++ b/src/NzbDrone.Core/Datastore/Migration/101_add_ultrahd_quality_in_profiles.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; @@ -14,7 +14,7 @@ protected override void MainDbUpgrade() private void ConvertProfile(IDbConnection conn, IDbTransaction tran) { - var updater = new ProfileUpdater70(conn, tran); + var updater = new ProfileUpdater71(conn, tran); updater.AppendQuality(16); // HDTV2160p updater.AppendQuality(18); // WEBDL2160p updater.AppendQuality(19); // Bluray2160p diff --git a/src/NzbDrone.Core/Datastore/Migration/117_add_webrip_and_br480_qualites_in_profile.cs b/src/NzbDrone.Core/Datastore/Migration/117_add_webrip_and_br480_qualites_in_profile.cs index 9adb7f5a0..e56c9ddd2 100644 --- a/src/NzbDrone.Core/Datastore/Migration/117_add_webrip_and_br480_qualites_in_profile.cs +++ b/src/NzbDrone.Core/Datastore/Migration/117_add_webrip_and_br480_qualites_in_profile.cs @@ -18,7 +18,7 @@ protected override void MainDbUpgrade() private void ConvertProfile(IDbConnection conn, IDbTransaction tran) { - var updater = new ProfileUpdater116(conn, tran); + var updater = new ProfileUpdater117(conn, tran); updater.CreateGroupAt(8, 1000, "WEB 480p", new[] {12, 8}); // Group WEBRip480p with WEBDL480p updater.CreateGroupAt(2, 1001, "DVD", new[] {2, 13}); // Group Bluray480p with DVD @@ -54,7 +54,7 @@ public ProfileItem117() } } - public class ProfileUpdater116 + public class ProfileUpdater117 { private readonly IDbConnection _connection; private readonly IDbTransaction _transaction; @@ -62,7 +62,7 @@ public class ProfileUpdater116 private List _profiles; private HashSet _changedProfiles = new HashSet(); - public ProfileUpdater116(IDbConnection conn, IDbTransaction tran) + public ProfileUpdater117(IDbConnection conn, IDbTransaction tran) { _connection = conn; _transaction = tran; diff --git a/src/NzbDrone.Core/Datastore/Migration/122_add_remux_qualities_in_profile.cs b/src/NzbDrone.Core/Datastore/Migration/122_add_remux_qualities_in_profile.cs new file mode 100644 index 000000000..a4fa59f90 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/122_add_remux_qualities_in_profile.cs @@ -0,0 +1,137 @@ +using System.Collections.Generic; +using System.Data; +using System.Linq; +using FluentMigrator; +using Newtonsoft.Json; +using NzbDrone.Common.Serializer; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(122)] + public class add_remux_qualities_in_profile : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Execute.WithConnection(ConvertProfile); + } + + private void ConvertProfile(IDbConnection conn, IDbTransaction tran) + { + var updater = new ProfileUpdater122(conn, tran); + + // Insert 2060p, in case the user grouped Bluray 1080p and 2160p together. + + updater.SplitQualityAppend(19, 21); // Bluray2160pRemux after Bluray2160p + updater.SplitQualityAppend(7, 20); // Bluray1080pRemux after Bluray1080p + + updater.Commit(); + } + } + + public class Profile122 + { + public int Id { get; set; } + public string Name { get; set; } + public int Cutoff { get; set; } + public List Items { get; set; } + } + + public class ProfileItem122 + { + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public int Id { get; set; } + + public string Name { get; set; } + + public int? Quality { get; set; } + + public bool Allowed { get; set; } + public List Items { get; set; } + } + + public class ProfileUpdater122 + { + private readonly IDbConnection _connection; + private readonly IDbTransaction _transaction; + + private List _profiles; + private HashSet _changedProfiles = new HashSet(); + + public ProfileUpdater122(IDbConnection conn, IDbTransaction tran) + { + _connection = conn; + _transaction = tran; + + _profiles = GetProfiles(); + } + + public void Commit() + { + foreach (var profile in _changedProfiles) + { + using (var updateProfileCmd = _connection.CreateCommand()) + { + updateProfileCmd.Transaction = _transaction; + updateProfileCmd.CommandText = "UPDATE Profiles SET Name = ?, Cutoff = ?, Items = ? WHERE Id = ?"; + updateProfileCmd.AddParameter(profile.Name); + updateProfileCmd.AddParameter(profile.Cutoff); + updateProfileCmd.AddParameter(profile.Items.ToJson()); + updateProfileCmd.AddParameter(profile.Id); + + updateProfileCmd.ExecuteNonQuery(); + } + } + + _changedProfiles.Clear(); + } + + public void SplitQualityAppend(int find, int quality) + { + foreach (var profile in _profiles) + { + if (profile.Items.Any(v => v.Quality == quality)) continue; + + var findIndex = profile.Items.FindIndex(v => + { + return v.Quality == find || (v.Items != null && v.Items.Any(b => b.Quality == find)); + }); + + profile.Items.Insert(findIndex + 1, new ProfileItem122 + { + Quality = quality, + Allowed = false + }); + + _changedProfiles.Add(profile); + } + } + + private List GetProfiles() + { + var profiles = new List(); + + using (var getProfilesCmd = _connection.CreateCommand()) + { + getProfilesCmd.Transaction = _transaction; + getProfilesCmd.CommandText = @"SELECT Id, Name, Cutoff, Items FROM Profiles"; + + using (var profileReader = getProfilesCmd.ExecuteReader()) + { + while (profileReader.Read()) + { + profiles.Add(new Profile122 + { + Id = profileReader.GetInt32(0), + Name = profileReader.GetString(1), + Cutoff = profileReader.GetInt32(2), + Items = Json.Deserialize>(profileReader.GetString(3)) + }); + } + } + } + + return profiles; + } + } +} diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 25ed48504..d30f96914 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -313,6 +313,7 @@ + diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index a177e2f37..c3e5b3439 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -49,10 +49,12 @@ public class QualityParser private static readonly Regex OtherSourceRegex = new Regex(@"(?HD[-_. ]TV)|(?SD[-_. ]TV)", RegexOptions.Compiled | RegexOptions.IgnoreCase); - private static readonly Regex AnimeBlurayRegex = new Regex(@"bd(?:720|1080)|(?<=[-_. (\[])bd(?=[-_. )\]])", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex AnimeBlurayRegex = new Regex(@"bd(?:720|1080|2160)|(?<=[-_. (\[])bd(?=[-_. )\]])", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex HighDefPdtvRegex = new Regex(@"hr[-_. ]ws", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex RemuxRegex = new Regex(@"\b(?(BD)?[-_. ]?Remux)\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); + public static QualityModel ParseQuality(string name) { Logger.Debug("Trying to parse quality for {0}", name); @@ -61,7 +63,7 @@ public static QualityModel ParseQuality(string name) var result = ParseQualityName(name); - //Based on extension + // Based on extension if (result.Quality == Quality.Unknown && !name.ContainsInvalidPathChars()) { try @@ -71,8 +73,8 @@ public static QualityModel ParseQuality(string name) } catch (ArgumentException) { - //Swallow exception for cases where string contains illegal - //path characters. + // Swallow exception for cases where string contains illegal + // path characters. } } @@ -93,6 +95,7 @@ public static QualityModel ParseQualityName(string name) var sourceMatch = SourceRegex.Matches(normalizedName).OfType().LastOrDefault(); var resolution = ParseResolution(normalizedName); var codecRegex = CodecRegex.Match(normalizedName); + var remuxMatch = RemuxRegex.IsMatch(normalizedName); if (sourceMatch != null && sourceMatch.Success) { @@ -106,13 +109,14 @@ public static QualityModel ParseQualityName(string name) if (resolution == Resolution.R2160p) { - result.Quality = Quality.Bluray2160p; + result.Quality = remuxMatch ? Quality.Bluray2160pRemux : Quality.Bluray2160p; + return result; } if (resolution == Resolution.R1080p) { - result.Quality = Quality.Bluray1080p; + result.Quality = remuxMatch ? Quality.Bluray1080pRemux : Quality.Bluray1080p; return result; } @@ -122,6 +126,13 @@ public static QualityModel ParseQualityName(string name) return result; } + // Treat a remux without a source as 1080p, not 720p. + if (remuxMatch) + { + result.Quality = Quality.Bluray1080pRemux; + return result; + } + result.Quality = Quality.Bluray720p; return result; } @@ -262,7 +273,7 @@ public static QualityModel ParseQualityName(string name) } - //Anime Bluray matching + // Anime Bluray matching if (AnimeBlurayRegex.Match(normalizedName).Success) { if (resolution == Resolution.R480P || resolution == Resolution.R576p || normalizedName.Contains("480p")) @@ -272,6 +283,19 @@ public static QualityModel ParseQualityName(string name) } if (resolution == Resolution.R1080p || normalizedName.Contains("1080p")) + { + result.Quality = remuxMatch ? Quality.Bluray1080pRemux : Quality.Bluray1080p; + return result; + } + + if (resolution == Resolution.R2160p || normalizedName.Contains("2160p")) + { + result.Quality = remuxMatch ? Quality.Bluray2160pRemux : Quality.Bluray2160p; + return result; + } + + // Treat a remux without a source as 1080p, not 720p. + if (remuxMatch) { result.Quality = Quality.Bluray1080p; return result; @@ -283,13 +307,13 @@ public static QualityModel ParseQualityName(string name) if (resolution == Resolution.R2160p) { - result.Quality = Quality.HDTV2160p; + result.Quality = remuxMatch ? Quality.Bluray2160pRemux : Quality.HDTV2160p; return result; } if (resolution == Resolution.R1080p) { - result.Quality = Quality.HDTV1080p; + result.Quality = remuxMatch ? Quality.Bluray1080pRemux : Quality.HDTV1080p; return result; } @@ -351,6 +375,11 @@ public static QualityModel ParseQualityName(string name) result.Quality = Quality.Bluray1080p; } + if (normalizedName.Contains("bluray2160p")) + { + result.Quality = Quality.Bluray2160p; + } + var otherSourceMatch = OtherSourceMatch(normalizedName); if (otherSourceMatch != Quality.Unknown) @@ -402,8 +431,8 @@ private static QualityModel ParseQualityModifiers(string name, string normalized result.Revision.Version = Convert.ToInt32(versionRegexResult.Groups["version"].Value); } - //TODO: re-enable this when we have a reliable way to determine real - //TODO: Only treat it as a real if it comes AFTER the season/epsiode number + // TODO: re-enable this when we have a reliable way to determine real + // TODO: Only treat it as a real if it comes AFTER the season/epsiode number var realRegexResult = RealRegex.Matches(name); if (realRegexResult.Count > 0) diff --git a/src/NzbDrone.Core/Qualities/Quality.cs b/src/NzbDrone.Core/Qualities/Quality.cs index 360160eaf..f710b3ee5 100644 --- a/src/NzbDrone.Core/Qualities/Quality.cs +++ b/src/NzbDrone.Core/Qualities/Quality.cs @@ -79,6 +79,8 @@ public override bool Equals(object obj) public static Quality WEBRip2160p { get { return new Quality(17, "WEBRip-2160p", QualitySource.WebRip, 2160); } } public static Quality WEBDL2160p => new Quality(18, "WEBDL-2160p", QualitySource.Web, 2160); public static Quality Bluray2160p => new Quality(19, "Bluray-2160p", QualitySource.Bluray, 2160); + public static Quality Bluray1080pRemux => new Quality(20, "Bluray-1080p Remux", QualitySource.BlurayRaw, 1080); + public static Quality Bluray2160pRemux => new Quality(21, "Bluray-2160p Remux", QualitySource.BlurayRaw, 2160); static Quality() { @@ -102,7 +104,9 @@ static Quality() HDTV2160p, WEBRip2160p, WEBDL2160p, - Bluray2160p + Bluray2160p, + Bluray1080pRemux, + Bluray2160pRemux }; AllLookup = new Quality[All.Select(v => v.Id).Max() + 1]; @@ -128,10 +132,12 @@ static Quality() new QualityDefinition(Quality.WEBRip1080p) { Weight = 11, MinSize = 0, MaxSize = 100, GroupName = "WEB 1080p" }, new QualityDefinition(Quality.WEBDL1080p) { Weight = 11, MinSize = 0, MaxSize = 100, GroupName = "WEB 1080p" }, new QualityDefinition(Quality.Bluray1080p) { Weight = 12, MinSize = 0, MaxSize = 100 }, - new QualityDefinition(Quality.HDTV2160p) { Weight = 13, MinSize = 0, MaxSize = null }, - new QualityDefinition(Quality.WEBRip2160p) { Weight = 14, MinSize = 0, MaxSize = null, GroupName = "WEB 2160p" }, - new QualityDefinition(Quality.WEBDL2160p) { Weight = 14, MinSize = 0, MaxSize = null, GroupName = "WEB 2160p" }, - new QualityDefinition(Quality.Bluray2160p) { Weight = 15, MinSize = 0, MaxSize = null } + new QualityDefinition(Quality.Bluray1080pRemux) { Weight = 13, MinSize = 0, MaxSize = null }, + new QualityDefinition(Quality.HDTV2160p) { Weight = 14, MinSize = 0, MaxSize = null }, + new QualityDefinition(Quality.WEBRip2160p) { Weight = 15, MinSize = 0, MaxSize = null, GroupName = "WEB 2160p" }, + new QualityDefinition(Quality.WEBDL2160p) { Weight = 15, MinSize = 0, MaxSize = null, GroupName = "WEB 2160p" }, + new QualityDefinition(Quality.Bluray2160p) { Weight = 16, MinSize = 0, MaxSize = null }, + new QualityDefinition(Quality.Bluray2160pRemux) { Weight = 17, MinSize = 0, MaxSize = null } }; } diff --git a/src/NzbDrone.Core/Qualities/QualitySource.cs b/src/NzbDrone.Core/Qualities/QualitySource.cs index 258de8813..c454958a8 100644 --- a/src/NzbDrone.Core/Qualities/QualitySource.cs +++ b/src/NzbDrone.Core/Qualities/QualitySource.cs @@ -8,6 +8,7 @@ public enum QualitySource Web, WebRip, DVD, - Bluray + Bluray, + BlurayRaw } } diff --git a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs index 44423640e..3a20d4c70 100644 --- a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs +++ b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq;