1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-25 17:17:02 +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 @@ public void AllItems()
HistoryId = new int(), HistoryId = new int(),
Date = DateTime.Now, Date = DateTime.Now,
IsProper = false, IsProper = false,
Quality = QualityTypes.TV, Quality = QualityTypes.SDTV,
EpisodeId = episode.EpisodeId EpisodeId = episode.EpisodeId
} }
}; };
@ -123,7 +123,7 @@ public void Exists_True()
var target = new HistoryProvider(repo.Object); var target = new HistoryProvider(repo.Object);
//Act //Act
var result = target.Exists(episode.EpisodeId, QualityTypes.TV, false); var result = target.Exists(episode.EpisodeId, QualityTypes.SDTV, false);
//Assert //Assert
Assert.AreEqual(result, true); Assert.AreEqual(result, true);
@ -156,7 +156,7 @@ public void Exists_False()
HistoryId = new int(), HistoryId = new int(),
Date = DateTime.Now, Date = DateTime.Now,
IsProper = false, IsProper = false,
Quality = QualityTypes.TV, Quality = QualityTypes.SDTV,
EpisodeId = episode.EpisodeId EpisodeId = episode.EpisodeId
} }
}; };
@ -168,7 +168,7 @@ public void Exists_False()
var target = new HistoryProvider(repo.Object); var target = new HistoryProvider(repo.Object);
//Act //Act
var result = target.Exists(episode.EpisodeId, QualityTypes.TV, true); var result = target.Exists(episode.EpisodeId, QualityTypes.SDTV, true);
//Assert //Assert
Assert.AreEqual(result, false); Assert.AreEqual(result, false);

View file

@ -66,7 +66,7 @@ public void import_new_file()
mocker.VerifyAllMocks(); mocker.VerifyAllMocks();
Assert.AreEqual(fakeEpisode.SeriesId, result.SeriesId); 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(Parser.NormalizePath(fileName), result.Path);
Assert.AreEqual(size, result.Size); Assert.AreEqual(size, result.Size);
Assert.AreEqual(false, result.Proper); Assert.AreEqual(false, result.Proper);

View file

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

View file

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

View file

@ -197,15 +197,15 @@ private static void SetupDefaultQualityProfiles(IRepository repository)
var sd = new QualityProfile var sd = new QualityProfile
{ {
Name = "SD", Name = "SD",
Allowed = new List<QualityTypes> { QualityTypes.TV, QualityTypes.DVD }, Allowed = new List<QualityTypes> { QualityTypes.SDTV, QualityTypes.DVD },
Cutoff = QualityTypes.TV Cutoff = QualityTypes.SDTV
}; };
var hd = new QualityProfile var hd = new QualityProfile
{ {
Name = "HD", Name = "HD",
Allowed = Allowed =
new List<QualityTypes> { QualityTypes.HDTV, QualityTypes.WEBDL, QualityTypes.BDRip, QualityTypes.Bluray720 }, new List<QualityTypes> { QualityTypes.HDTV, QualityTypes.WEBDL, QualityTypes.Bluray720 },
Cutoff = QualityTypes.HDTV Cutoff = QualityTypes.HDTV
}; };

View file

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

View file

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