1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Add remux 1080p and 2160p as qualities (#900)

* Add Remux 1080p and 2160p as qualities, includes Tests & migration

* Whoops forgot to take this out
This commit is contained in:
Devin Buhl 2017-02-26 01:14:52 -05:00 committed by GitHub
parent e33265b58d
commit 28d27dca5c
6 changed files with 84 additions and 18 deletions

View File

@ -24,6 +24,8 @@ public class QualityParserFixture : CoreTest
new object[] { Quality.Bluray720p }, new object[] { Quality.Bluray720p },
new object[] { Quality.Bluray1080p }, new object[] { Quality.Bluray1080p },
new object[] { Quality.Bluray2160p }, new object[] { Quality.Bluray2160p },
new object[] { Quality.Remux1080p },
new object[] { Quality.Remux2160p },
}; };
public static object[] OtherSourceQualityParserCases = public static object[] OtherSourceQualityParserCases =
@ -40,6 +42,8 @@ public class QualityParserFixture : CoreTest
new object[] { "720p BluRay", Quality.Bluray720p }, new object[] { "720p BluRay", Quality.Bluray720p },
new object[] { "1080p BluRay", Quality.Bluray1080p }, new object[] { "1080p BluRay", Quality.Bluray1080p },
new object[] { "2160p BluRay", Quality.Bluray2160p }, new object[] { "2160p BluRay", Quality.Bluray2160p },
new object[] { "1080p Remux", Quality.Remux1080p },
new object[] { "2160p Remux", Quality.Remux2160p },
}; };
[TestCase("S07E23 .avi ", false)] [TestCase("S07E23 .avi ", false)]
@ -221,6 +225,20 @@ public void should_parse_bluray576p_quality(string title)
ParseAndVerifyQuality(title, Quality.Bluray576p, false); ParseAndVerifyQuality(title, Quality.Bluray576p, false);
} }
[TestCase("Contract.to.Kill.2016.REMUX.1080p.BluRay.AVC.DTS-HD.MA.5.1-iFT")]
[TestCase("27.Dresses.2008.REMUX.1080p.Bluray.AVC.DTS-HR.MA.5.1-LEGi0N")]
public void should_parse_remux1080p_quality(string title)
{
ParseAndVerifyQuality(title, Quality.Remux1080p, false);
}
[TestCase("Contract.to.Kill.2016.REMUX.2160p.BluRay.AVC.DTS-HD.MA.5.1-iFT")]
[TestCase("27.Dresses.2008.REMUX.2160p.Bluray.AVC.DTS-HR.MA.5.1-LEGi0N")]
public void should_parse_remux2160p_quality(string title)
{
ParseAndVerifyQuality(title, Quality.Remux2160p, false);
}
//[TestCase("POI S02E11 1080i HDTV DD5.1 MPEG2-TrollHD", false)] //[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("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)] //[TestCase("The Voice S01E11 The Finals 1080i HDTV DD5.1 MPEG2-TrollHD", false)]

View File

@ -0,0 +1,24 @@
using System.Data;
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(134)]
public class add_remux_qualities_for_the_wankers : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Execute.WithConnection(ConvertProfile);
}
private void ConvertProfile(IDbConnection conn, IDbTransaction tran)
{
var updater = new ProfileUpdater70(conn, tran);
updater.SplitQualityAppend(19, 31); // Remux2160p AFTER Bluray2160p
updater.SplitQualityAppend(7, 30); // Remux1080p AFTER Bluray1080p
updater.Commit();
}
}
}

View File

@ -124,6 +124,7 @@
<Compile Include="Authentication\UserRepository.cs" /> <Compile Include="Authentication\UserRepository.cs" />
<Compile Include="Authentication\UserService.cs" /> <Compile Include="Authentication\UserService.cs" />
<Compile Include="Datastore\Migration\123_create_netimport_table.cs" /> <Compile Include="Datastore\Migration\123_create_netimport_table.cs" />
<Compile Include="Datastore\Migration\134_add_remux_qualities_for_the_wankers.cs" />
<Compile Include="Datastore\Migration\129_add_parsed_movie_info_to_pending_release.cs" /> <Compile Include="Datastore\Migration\129_add_parsed_movie_info_to_pending_release.cs" />
<Compile Include="Datastore\Migration\128_remove_kickass.cs" /> <Compile Include="Datastore\Migration\128_remove_kickass.cs" />
<Compile Include="Datastore\Migration\130_remove_wombles_kickass.cs" /> <Compile Include="Datastore\Migration\130_remove_wombles_kickass.cs" />

View File

@ -50,8 +50,8 @@ public class QualityParser
private static readonly Regex HardcodedSubsRegex = new Regex(@"\b(?<hcsub>(\w+SUBS?)\b)|(?<hc>(HC))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); private static readonly Regex HardcodedSubsRegex = new Regex(@"\b(?<hcsub>(\w+SUBS?)\b)|(?<hc>(HC))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
private static readonly Regex RawHDRegex = new Regex(@"\b(?<rawhd>RawHD|1080i[-_. ]HDTV|Raw[-_. ]HD|MPEG[-_. ]?2)\b", private static readonly Regex RemuxRegex = new Regex(@"\b(?<remux>Remux)\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex ProperRegex = new Regex(@"\b(?<proper>proper|repack|rerip)\b", private static readonly Regex ProperRegex = new Regex(@"\b(?<proper>proper|repack|rerip)\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
@ -95,16 +95,24 @@ public static QualityModel ParseQuality(string name)
} }
} }
//if (RawHDRegex.IsMatch(normalizedName))
//{
// result.Quality = Quality.RAWHD;
// return result;
//}
var sourceMatch = SourceRegex.Matches(normalizedName).OfType<Match>().LastOrDefault(); var sourceMatch = SourceRegex.Matches(normalizedName).OfType<Match>().LastOrDefault();
var resolution = ParseResolution(normalizedName); var resolution = ParseResolution(normalizedName);
var codecRegex = CodecRegex.Match(normalizedName); var codecRegex = CodecRegex.Match(normalizedName);
if (RemuxRegex.IsMatch(normalizedName))
{
if (resolution == Resolution.R2160p)
{
result.Quality = Quality.Remux2160p;
return result;
}
if (resolution == Resolution.R1080p)
{
result.Quality = Quality.Remux1080p;
return result;
}
}
if (sourceMatch != null && sourceMatch.Success) if (sourceMatch != null && sourceMatch.Success)
{ {

View File

@ -107,6 +107,8 @@ public void Handle(ApplicationStartedEvent message)
Quality.Bluray720p, Quality.Bluray720p,
Quality.Bluray1080p, Quality.Bluray1080p,
Quality.Bluray2160p, Quality.Bluray2160p,
Quality.Remux1080p,
Quality.Remux2160p,
Quality.BRDISK); Quality.BRDISK);
AddDefaultProfile("SD", Quality.Bluray480p, AddDefaultProfile("SD", Quality.Bluray480p,
@ -130,12 +132,14 @@ public void Handle(ApplicationStartedEvent message)
AddDefaultProfile("HD-1080p", Quality.Bluray1080p, AddDefaultProfile("HD-1080p", Quality.Bluray1080p,
Quality.HDTV1080p, Quality.HDTV1080p,
Quality.WEBDL1080p, Quality.WEBDL1080p,
Quality.Bluray1080p); Quality.Bluray1080p,
Quality.Remux1080p);
AddDefaultProfile("Ultra-HD", Quality.Bluray2160p, AddDefaultProfile("Ultra-HD", Quality.Remux2160p,
Quality.HDTV2160p, Quality.HDTV2160p,
Quality.WEBDL2160p, Quality.WEBDL2160p,
Quality.Bluray2160p); Quality.Bluray2160p,
Quality.Remux2160p);
AddDefaultProfile("HD - 720p/1080p", Quality.Bluray720p, AddDefaultProfile("HD - 720p/1080p", Quality.Bluray720p,
Quality.HDTV720p, Quality.HDTV720p,
@ -143,7 +147,10 @@ public void Handle(ApplicationStartedEvent message)
Quality.WEBDL720p, Quality.WEBDL720p,
Quality.WEBDL1080p, Quality.WEBDL1080p,
Quality.Bluray720p, Quality.Bluray720p,
Quality.Bluray1080p); Quality.Bluray1080p,
Quality.Remux1080p,
Quality.Remux2160p
);
} }
} }
} }

View File

@ -88,6 +88,10 @@ public override bool Equals(object obj)
public static Quality Bluray720p => new Quality(6, "Bluray-720p"); public static Quality Bluray720p => new Quality(6, "Bluray-720p");
public static Quality Bluray1080p => new Quality(7, "Bluray-1080p"); public static Quality Bluray1080p => new Quality(7, "Bluray-1080p");
public static Quality Bluray2160p => new Quality(19, "Bluray-2160p"); public static Quality Bluray2160p => new Quality(19, "Bluray-2160p");
public static Quality Remux1080p => new Quality(30, "Remux-1080p");
public static Quality Remux2160p => new Quality(31, "Remux-2160p");
public static Quality BRDISK => new Quality(22, "BR-DISK"); // new public static Quality BRDISK => new Quality(22, "BR-DISK"); // new
// Others // Others
@ -119,6 +123,8 @@ static Quality()
Bluray720p, Bluray720p,
Bluray1080p, Bluray1080p,
Bluray2160p, Bluray2160p,
Remux1080p,
Remux2160p,
BRDISK, BRDISK,
RAWHD RAWHD
}; };
@ -153,13 +159,15 @@ static Quality()
new QualityDefinition(Quality.HDTV1080p) { Weight = 17, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.HDTV1080p) { Weight = 17, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.WEBDL1080p) { Weight = 18, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.WEBDL1080p) { Weight = 18, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.Bluray1080p) { Weight = 19, MinSize = 0, MaxSize = null }, new QualityDefinition(Quality.Bluray1080p) { Weight = 19, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.Remux1080p) { Weight = 20, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.HDTV2160p) { Weight = 20, MinSize = 0, MaxSize = null }, new QualityDefinition(Quality.HDTV2160p) { Weight = 21, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.WEBDL2160p) { Weight = 21, MinSize = 0, MaxSize = null }, new QualityDefinition(Quality.WEBDL2160p) { Weight = 22, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.Bluray2160p) { Weight = 22, MinSize = 0, MaxSize = null }, new QualityDefinition(Quality.Bluray2160p) { Weight = 23, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.Remux2160p) { Weight = 24, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.BRDISK) { Weight = 23, MinSize = 0, MaxSize = null }, new QualityDefinition(Quality.BRDISK) { Weight = 25, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.RAWHD) { Weight = 24, MinSize = 0, MaxSize = null } new QualityDefinition(Quality.RAWHD) { Weight = 26, MinSize = 0, MaxSize = null }
}; };
} }