1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-17 15:02:34 +02:00

Fixed: WEBDL-480p being detected as WEBDL-720p

Fixed Newznab DNS hostname test, finally!
This commit is contained in:
Mark McDowall 2012-12-16 01:08:02 -08:00
parent 6f1df9fe05
commit 8f1f96a573
5 changed files with 31 additions and 9 deletions

View File

@ -61,7 +61,7 @@ public class QualityParserTests : CoreTest
new object[] { "Pawn Stars S04E87 REPACK 720p HDTV x264 aAF", QualityTypes.HDTV, true },
new object[] { "The Real Housewives of Vancouver S01E04 DSR x264 2HD", QualityTypes.SDTV, false },
new object[] { "Vanguard S01E04 Mexicos Death Train DSR x264 MiNDTHEGAP", QualityTypes.SDTV, false },
new object[] { "Vanguard S01E04 Mexicos Death Train 720 WEB DL", QualityTypes.WEBDL720p, false },
new object[] { "Vanguard S01E04 Mexicos Death Train 720p WEB DL", QualityTypes.WEBDL720p, false },
new object[] { "Hawaii Five 0 S02E21 720p WEB DL DD5 1 H 264", QualityTypes.WEBDL720p, false },
new object[] { "Castle S04E22 720p WEB DL DD5 1 H 264 NFHD", QualityTypes.WEBDL720p, false },
new object[] { "Fringe S04E22 720p WEB-DL DD5.1 H264-EbP.mkv", QualityTypes.WEBDL720p, false },
@ -70,15 +70,20 @@ public class QualityParserTests : CoreTest
new object[] { "Criminal.Minds.S08E01.1080p.WEB-DL.DD5.1.H264-NFHD", QualityTypes.WEBDL1080p, false },
new object[] { "Its.Always.Sunny.in.Philadelphia.S08E01.1080p.WEB-DL.proper.AAC2.0.H.264", QualityTypes.WEBDL1080p, true },
new object[] { "Two and a Half Men S10E03 1080p WEB DL DD5 1 H 264 REPACK NFHD", QualityTypes.WEBDL1080p, true },
new object[] { "Glee.S04E09.Swan.Song.1080p.WEB-DL.DD5.1.H.264-ECI", QualityTypes.WEBDL1080p, false }
new object[] { "Glee.S04E09.Swan.Song.1080p.WEB-DL.DD5.1.H.264-ECI", QualityTypes.WEBDL1080p, false },
new object[] { "Elementary.S01E10.The.Leviathan.480p.WEB-DL.x264-mSD", QualityTypes.WEBDL480p, false },
new object[] { "Glee.S04E10.Glee.Actually.480p.WEB-DL.x264-mSD", QualityTypes.WEBDL480p, false },
new object[] { "The.Big.Bang.Theory.S06E11.The.Santa.Simulation.480p.WEB-DL.x264-mSD", QualityTypes.WEBDL480p, false }
};
public static object[] SelfQualityParserCases =
{
new object[] { QualityTypes.SDTV },
new object[] { QualityTypes.DVD },
new object[] { QualityTypes.WEBDL480p },
new object[] { QualityTypes.HDTV },
new object[] { QualityTypes.WEBDL720p },
new object[] { QualityTypes.WEBDL1080p },
new object[] { QualityTypes.Bluray720p },
new object[] { QualityTypes.Bluray1080p }
};

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
@ -304,10 +305,10 @@ public void CheckHostname_should_do_nothing_if_hostname_is_valid()
}
[Test]
[ExpectedException("System.Net.Sockets.SocketException")]
public void CheckHostname_should_log_error_and_throw_exception_if_dnsHostname_is_invalid()
{
Mocker.Resolve<NewznabProvider>().CheckHostname("http://BadName");
Assert.Throws<SocketException>(() => Mocker.Resolve<NewznabProvider>().CheckHostname("http://BadName"));
ExceptionVerification.ExpectedErrors(1);
}
}

View File

@ -29,9 +29,10 @@ public void SetupDefault_should_add_all_profiles()
//Assert
var types = Mocker.Resolve<QualityTypeProvider>().All();
types.Should().HaveCount(7);
types.Should().HaveCount(8);
types.Should().Contain(e => e.Name == "SDTV" && e.QualityTypeId == 1);
types.Should().Contain(e => e.Name == "DVD" && e.QualityTypeId == 2);
types.Should().Contain(e => e.Name == "WEBDL-480p" && e.QualityTypeId == 8);
types.Should().Contain(e => e.Name == "HDTV" && e.QualityTypeId == 4);
types.Should().Contain(e => e.Name == "WEBDL-720p" && e.QualityTypeId == 5);
types.Should().Contain(e => e.Name == "WEBDL-1080p" && e.QualityTypeId == 3);
@ -54,7 +55,7 @@ public void SetupDefault_already_exists_should_insert_missing()
//Assert
var types = Mocker.Resolve<QualityTypeProvider>().All();
types.Should().HaveCount(7);
types.Should().HaveCount(8);
}
[Test]

View File

@ -295,7 +295,20 @@ internal static QualityModel ParseQuality(string name)
result.Quality = QualityTypes.WEBDL1080p;
return result;
}
result.Quality = QualityTypes.WEBDL720p;
if (normalizedName.Contains("720p"))
{
result.Quality = QualityTypes.WEBDL720p;
return result;
}
if(name.Contains("[WEBDL]"))
{
result.Quality = QualityTypes.WEBDL720p;
return result;
}
result.Quality = QualityTypes.WEBDL480p;
return result;
}
if (normalizedName.Contains("x264") || normalizedName.Contains("h264") || normalizedName.Contains("720p"))

View File

@ -94,11 +94,12 @@ public override bool Equals(object obj)
public static QualityTypes Unknown = new QualityTypes { Id = 0, Name = "Unknown", Weight = 0 };
public static QualityTypes SDTV = new QualityTypes {Id = 1, Name = "SDTV", Weight = 1};
public static QualityTypes DVD = new QualityTypes { Id = 2, Name = "DVD", Weight = 2 };
public static QualityTypes WEBDL480p = new QualityTypes { Id = 8, Name = "WEBDL-480p", Weight = 2 };
public static QualityTypes DVD = new QualityTypes { Id = 2, Name = "DVD", Weight = 3 };
public static QualityTypes HDTV = new QualityTypes { Id = 4, Name = "HDTV", Weight = 4 };
public static QualityTypes WEBDL720p = new QualityTypes { Id = 5, Name = "WEBDL-720p", Weight = 5 };
public static QualityTypes WEBDL1080p = new QualityTypes { Id = 3, Name = "WEBDL-1080p", Weight = 7 };
public static QualityTypes Bluray720p = new QualityTypes { Id = 6, Name = "Bluray720p", Weight = 6 };
public static QualityTypes WEBDL1080p = new QualityTypes { Id = 3, Name = "WEBDL-1080p", Weight = 7 };
public static QualityTypes Bluray1080p = new QualityTypes { Id = 7, Name = "Bluray1080p", Weight = 8 };
public static List<QualityTypes> All()
@ -107,6 +108,7 @@ public static List<QualityTypes> All()
{
Unknown,
SDTV,
WEBDL480p,
DVD,
HDTV,
WEBDL720p,