1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-25 01:06:30 +00:00

simplified some quality types

This commit is contained in:
kay.one 2011-05-23 10:20:43 -07:00
parent 5be99200c6
commit c91852018e
9 changed files with 34 additions and 35 deletions

View file

@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test
HistoryId = new int(),
Date = DateTime.Now,
IsProper = false,
Quality = QualityTypes.TV,
Quality = QualityTypes.SDTV,
EpisodeId = episode.EpisodeId
}
};
@ -123,7 +123,7 @@ namespace NzbDrone.Core.Test
var target = new HistoryProvider(repo.Object);
//Act
var result = target.Exists(episode.EpisodeId, QualityTypes.TV, false);
var result = target.Exists(episode.EpisodeId, QualityTypes.SDTV, false);
//Assert
Assert.AreEqual(result, true);
@ -156,7 +156,7 @@ namespace NzbDrone.Core.Test
HistoryId = new int(),
Date = DateTime.Now,
IsProper = false,
Quality = QualityTypes.TV,
Quality = QualityTypes.SDTV,
EpisodeId = episode.EpisodeId
}
};
@ -168,7 +168,7 @@ namespace NzbDrone.Core.Test
var target = new HistoryProvider(repo.Object);
//Act
var result = target.Exists(episode.EpisodeId, QualityTypes.TV, true);
var result = target.Exists(episode.EpisodeId, QualityTypes.SDTV, true);
//Assert
Assert.AreEqual(result, false);

View file

@ -66,7 +66,7 @@ namespace NzbDrone.Core.Test
mocker.VerifyAllMocks();
Assert.AreEqual(fakeEpisode.SeriesId, result.SeriesId);
Assert.AreEqual(QualityTypes.BDRip, result.Quality);
Assert.AreEqual(QualityTypes.DVD, result.Quality);
Assert.AreEqual(Parser.NormalizePath(fileName), result.Path);
Assert.AreEqual(size, result.Size);
Assert.AreEqual(false, result.Proper);

View file

@ -67,28 +67,28 @@ namespace NzbDrone.Core.Test
[Test]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.BDRip)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.BDRip)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.DVD)]
[Row("Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", QualityTypes.HDTV)]
[Row("this has no extention or periods HDTV", QualityTypes.TV)]
[Row("Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.TV)]
[Row("this has no extention or periods HDTV", QualityTypes.SDTV)]
[Row("Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.SDTV)]
[Row("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", QualityTypes.DVD)]
[Row("The.Girls.Next.Door.S03E06.HDTV-WiDE", QualityTypes.TV)]
[Row("Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.TV)]
[Row("The.Girls.Next.Door.S03E06.HDTV-WiDE", QualityTypes.SDTV)]
[Row("Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.SDTV)]
[Row("Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", QualityTypes.WEBDL)]
[Row("Sonny.With.a.Chance.S02E15.720p", QualityTypes.HDTV)]
[Row("Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV)]
[Row("Sonny.With.a.Chance.S02E15.avi", QualityTypes.TV)]
[Row("Sonny.With.a.Chance.S02E15.xvid", QualityTypes.TV)]
[Row("Sonny.With.a.Chance.S02E15.divx", QualityTypes.TV)]
[Row("Sonny.With.a.Chance.S02E15.avi", QualityTypes.SDTV)]
[Row("Sonny.With.a.Chance.S02E15.xvid", QualityTypes.SDTV)]
[Row("Sonny.With.a.Chance.S02E15.divx", QualityTypes.SDTV)]
[Row("Sonny.With.a.Chance.S02E15", QualityTypes.Unknown)]
[Row("Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV)]
[Row("Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV)]
[Row("Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720)]
[Row("Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080)]
[Row("Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.BDRip)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.BDRip)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
[Row("Law & Order: Special Victims Unit - 11x11 - Quickie", QualityTypes.Unknown)]
[Row("(<a href=\"http://www.newzbin.com/browse/post/6076286/nzb/\">NZB</a>)", QualityTypes.Unknown)]
public void quality_parse(string postTitle, object quality)

View file

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test
var testProfile = new QualityProfile
{
Name = Guid.NewGuid().ToString(),
Cutoff = QualityTypes.TV,
Cutoff = QualityTypes.SDTV,
Allowed = new List<QualityTypes> { QualityTypes.HDTV, QualityTypes.DVD },
};
@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test
var testProfile = new QualityProfile
{
Name = Guid.NewGuid().ToString(),
Cutoff = QualityTypes.TV,
Cutoff = QualityTypes.SDTV,
Allowed = new List<QualityTypes> { QualityTypes.HDTV, QualityTypes.DVD },
};

View file

@ -197,15 +197,15 @@ namespace NzbDrone.Core
var sd = new QualityProfile
{
Name = "SD",
Allowed = new List<QualityTypes> { QualityTypes.TV, QualityTypes.DVD },
Cutoff = QualityTypes.TV
Allowed = new List<QualityTypes> { QualityTypes.SDTV, QualityTypes.DVD },
Cutoff = QualityTypes.SDTV
};
var hd = new QualityProfile
{
Name = "HD",
Allowed =
new List<QualityTypes> { QualityTypes.HDTV, QualityTypes.WEBDL, QualityTypes.BDRip, QualityTypes.Bluray720 },
new List<QualityTypes> { QualityTypes.HDTV, QualityTypes.WEBDL, QualityTypes.Bluray720 },
Cutoff = QualityTypes.HDTV
};

View file

@ -205,22 +205,19 @@ namespace NzbDrone.Core
var result = QualityTypes.Unknown;
name = name.ToLowerInvariant();
if (name.Contains("dvd"))
return QualityTypes.DVD;
if (name.Contains("bdrip") || name.Contains("brrip"))
if (name.Contains("dvd") || name.Contains("bdrip") || name.Contains("brrip"))
{
return QualityTypes.BDRip;
return QualityTypes.DVD;
}
if (name.Contains("xvid") || name.Contains("divx"))
{
if (name.Contains("bluray"))
{
return QualityTypes.BDRip;
return QualityTypes.DVD;
}
return QualityTypes.TV;
return QualityTypes.SDTV;
}
if (name.Contains("bluray"))
@ -253,7 +250,7 @@ namespace NzbDrone.Core
case ".wmv":
case ".mp4":
{
result = QualityTypes.TV;
result = QualityTypes.SDTV;
break;
}
case ".mkv":
@ -271,7 +268,7 @@ namespace NzbDrone.Core
}
if (name.Contains("hdtv"))
{
return QualityTypes.TV;
return QualityTypes.SDTV;
}
Logger.Trace("Quality Parsed:{0} Title:", result, name);

View file

@ -10,30 +10,32 @@ namespace NzbDrone.Core.Repository.Quality
/// Quality is unknown
/// </summary>
Unknown = 0,
/// <summary>
/// SD File (Source could be HD)
/// </summary>
TV = 1,
SDTV = 1,
/// <summary>
/// SD File (DVD Source)
/// </summary>
DVD = 2,
/// <summary>
/// SD File (HD Source)
/// </summary>
BDRip = 3,
/// <summary>
/// HD File (HDTV Source)
/// </summary>
HDTV = 4,
/// <summary>
/// HD File (Online Source)
/// </summary>
WEBDL = 5,
/// <summary>
/// HD File (720p Blu-ray Source)
/// </summary>
Bluray720 = 6,
/// <summary>
/// HD File (1080p Blu-ray Source)
/// </summary>