mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
New: Bluray 1080p and 2160p remux qualities
This commit is contained in:
parent
a3b90650be
commit
897f3fea99
@ -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<Profile70>("SELECT Items FROM Profiles LIMIT 1");
|
||||
var profiles = db.Query<Profile71>("SELECT Items FROM Profiles LIMIT 1");
|
||||
|
||||
var items = profiles.First().Items;
|
||||
items.Should().HaveCount(2);
|
||||
|
@ -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<Profile70>("SELECT Items FROM Profiles LIMIT 1");
|
||||
var profiles = db.Query<Profile71>("SELECT Items FROM Profiles LIMIT 1");
|
||||
|
||||
var items = profiles.First().Items;
|
||||
items.Should().HaveCount(4);
|
||||
|
@ -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<add_remux_qualities_in_profile>
|
||||
{
|
||||
[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<Profile122>("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<Profile122>("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);
|
||||
}
|
||||
}
|
||||
}
|
@ -131,6 +131,7 @@
|
||||
<Compile Include="Datastore\DatabaseRelationshipFixture.cs" />
|
||||
<Compile Include="Datastore\MappingExtentionFixture.cs" />
|
||||
<Compile Include="Datastore\MarrDataLazyLoadingFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\101_add_ultrahd_quality_in_profilesFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\117_add_webrip_qualites_in_profileFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\108_fix_metadata_file_extensionsFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\109_import_extra_files_configFixture.cs" />
|
||||
@ -138,7 +139,7 @@
|
||||
<Compile Include="Datastore\Migration\106_update_btn_urlFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\103_fix_metadata_file_extensionsFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\099_extra_and_subtitle_filesFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\101_add_ultrahd_quality_in_profilesFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\122_add_remux_qualities_in_profile.cs" />
|
||||
<Compile Include="Datastore\Migration\071_unknown_quality_in_profileFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\072_history_downloadIdFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\070_delay_profileFixture.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)]
|
||||
|
@ -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<ProfileItem70> Items { get; set; }
|
||||
public List<ProfileItem71> 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<Profile70> _profiles;
|
||||
private HashSet<Profile70> _changedProfiles = new HashSet<Profile70>();
|
||||
private List<Profile71> _profiles;
|
||||
private HashSet<Profile71> _changedProfiles = new HashSet<Profile71>();
|
||||
|
||||
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<Profile70> GetProfiles()
|
||||
private List<Profile71> GetProfiles()
|
||||
{
|
||||
var profiles = new List<Profile70>();
|
||||
var profiles = new List<Profile71>();
|
||||
|
||||
using (var getProfilesCmd = _connection.CreateCommand())
|
||||
{
|
||||
@ -162,12 +163,12 @@ private List<Profile70> 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<List<ProfileItem70>>(profileReader.GetString(3)),
|
||||
Items = Json.Deserialize<List<ProfileItem71>>(profileReader.GetString(3)),
|
||||
Language = profileReader.GetInt32(4)
|
||||
});
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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<Profile117> _profiles;
|
||||
private HashSet<Profile117> _changedProfiles = new HashSet<Profile117>();
|
||||
|
||||
public ProfileUpdater116(IDbConnection conn, IDbTransaction tran)
|
||||
public ProfileUpdater117(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
_connection = conn;
|
||||
_transaction = tran;
|
||||
|
@ -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<ProfileItem122> 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<ProfileItem122> Items { get; set; }
|
||||
}
|
||||
|
||||
public class ProfileUpdater122
|
||||
{
|
||||
private readonly IDbConnection _connection;
|
||||
private readonly IDbTransaction _transaction;
|
||||
|
||||
private List<Profile122> _profiles;
|
||||
private HashSet<Profile122> _changedProfiles = new HashSet<Profile122>();
|
||||
|
||||
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<Profile122> GetProfiles()
|
||||
{
|
||||
var profiles = new List<Profile122>();
|
||||
|
||||
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<List<ProfileItem122>>(profileReader.GetString(3))
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return profiles;
|
||||
}
|
||||
}
|
||||
}
|
@ -313,6 +313,7 @@
|
||||
<Compile Include="Datastore\Migration\111_create_language_profiles.cs" />
|
||||
<Compile Include="Datastore\Migration\115_add_downloadclient_status.cs" />
|
||||
<Compile Include="Datastore\Migration\121_update_animetosho_url.cs" />
|
||||
<Compile Include="Datastore\Migration\122_add_remux_qualities_in_profile.cs" />
|
||||
<Compile Include="Datastore\Migration\117_add_webrip_and_br480_qualites_in_profile.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||
|
@ -49,10 +49,12 @@ public class QualityParser
|
||||
|
||||
private static readonly Regex OtherSourceRegex = new Regex(@"(?<hdtv>HD[-_. ]TV)|(?<sdtv>SD[-_. ]TV)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static readonly Regex AnimeBlurayRegex = new Regex(@"bd(?:720|1080)|(?<=[-_. (\[])bd(?=[-_. )\]])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex 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(?<remux>(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<Match>().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)
|
||||
|
@ -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 }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ public enum QualitySource
|
||||
Web,
|
||||
WebRip,
|
||||
DVD,
|
||||
Bluray
|
||||
Bluray,
|
||||
BlurayRaw
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
Loading…
Reference in New Issue
Block a user