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

Fixed Newznab DNS hostname test, finally!
pull/20/merge
Mark McDowall 12 years ago
parent 6f1df9fe05
commit 8f1f96a573

@ -61,7 +61,7 @@ namespace NzbDrone.Core.Test.ParserFixture
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 @@ namespace NzbDrone.Core.Test.ParserFixture
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 }
};

@ -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 @@ namespace NzbDrone.Core.Test.ProviderTests
}
[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);
}
}

@ -29,9 +29,10 @@ namespace NzbDrone.Core.Test.ProviderTests
//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 @@ namespace NzbDrone.Core.Test.ProviderTests
//Assert
var types = Mocker.Resolve<QualityTypeProvider>().All();
types.Should().HaveCount(7);
types.Should().HaveCount(8);
}
[Test]

@ -295,7 +295,20 @@ namespace NzbDrone.Core
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"))

@ -94,11 +94,12 @@ namespace NzbDrone.Core.Repository.Quality
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 @@ namespace NzbDrone.Core.Repository.Quality
{
Unknown,
SDTV,
WEBDL480p,
DVD,
HDTV,
WEBDL720p,

Loading…
Cancel
Save