1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 18:02:44 +01:00

Rename Source to QualitySource

This commit is contained in:
Qstick 2023-08-20 22:53:11 -05:00
parent 3cbdba51e9
commit bd3fad9636
16 changed files with 153 additions and 153 deletions

View File

@ -28,12 +28,12 @@ public class custom_format_rework_parserFixture : CoreTest<custom_format_rework>
[TestCase("R_576", "ResolutionSpecification", false, false, (int)Resolution.R576p)] [TestCase("R_576", "ResolutionSpecification", false, false, (int)Resolution.R576p)]
[TestCase("R_480", "ResolutionSpecification", false, false, (int)Resolution.R480p)] [TestCase("R_480", "ResolutionSpecification", false, false, (int)Resolution.R480p)]
[TestCase("R_2160", "ResolutionSpecification", false, false, (int)Resolution.R2160p)] [TestCase("R_2160", "ResolutionSpecification", false, false, (int)Resolution.R2160p)]
[TestCase("S_BLURAY", "SourceSpecification", false, false, (int)Source.BLURAY)] [TestCase("S_BLURAY", "SourceSpecification", false, false, (int)QualitySource.BLURAY)]
[TestCase("s_tv", "SourceSpecification", false, false, (int)Source.TV)] [TestCase("s_tv", "SourceSpecification", false, false, (int)QualitySource.TV)]
[TestCase("s_workPRINT", "SourceSpecification", false, false, (int)Source.WORKPRINT)] [TestCase("s_workPRINT", "SourceSpecification", false, false, (int)QualitySource.WORKPRINT)]
[TestCase("s_Dvd", "SourceSpecification", false, false, (int)Source.DVD)] [TestCase("s_Dvd", "SourceSpecification", false, false, (int)QualitySource.DVD)]
[TestCase("S_WEBdL", "SourceSpecification", false, false, (int)Source.WEBDL)] [TestCase("S_WEBdL", "SourceSpecification", false, false, (int)QualitySource.WEBDL)]
[TestCase("S_CAM", "SourceSpecification", false, false, (int)Source.CAM)] [TestCase("S_CAM", "SourceSpecification", false, false, (int)QualitySource.CAM)]
[TestCase("L_English", "LanguageSpecification", false, false, 1)] [TestCase("L_English", "LanguageSpecification", false, false, 1)]
[TestCase("L_Italian", "LanguageSpecification", false, false, 5)] [TestCase("L_Italian", "LanguageSpecification", false, false, 5)]
[TestCase("L_iTa", "LanguageSpecification", false, false, 5)] [TestCase("L_iTa", "LanguageSpecification", false, false, 5)]

View File

@ -37,13 +37,13 @@ public void Setup()
_mediaInfoAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>())).Returns(AugmentQualityResult.ResolutionOnly((int)Resolution.R1080p, Confidence.MediaInfo)); _mediaInfoAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>())).Returns(AugmentQualityResult.ResolutionOnly((int)Resolution.R1080p, Confidence.MediaInfo));
_fileExtensionAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>())) _fileExtensionAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>()))
.Returns(new AugmentQualityResult(Source.TV, Confidence.Fallback, (int)Resolution.R720p, Confidence.Fallback, Modifier.NONE, Confidence.Fallback, new Revision(), Confidence.Fallback)); .Returns(new AugmentQualityResult(QualitySource.TV, Confidence.Fallback, (int)Resolution.R720p, Confidence.Fallback, Modifier.NONE, Confidence.Fallback, new Revision(), Confidence.Fallback));
_nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>())) _nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>()))
.Returns(new AugmentQualityResult(Source.TV, Confidence.Default, 480, Confidence.Default, Modifier.NONE, Confidence.Fallback, new Revision(), Confidence.Default)); .Returns(new AugmentQualityResult(QualitySource.TV, Confidence.Default, 480, Confidence.Default, Modifier.NONE, Confidence.Fallback, new Revision(), Confidence.Default));
_releaseNameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>())) _releaseNameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>()))
.Returns(AugmentQualityResult.SourceOnly(Source.WEBDL, Confidence.MediaInfo)); .Returns(AugmentQualityResult.SourceOnly(QualitySource.WEBDL, Confidence.MediaInfo));
} }
private void GivenAugmenters(params Mock<IAugmentQuality>[] mocks) private void GivenAugmenters(params Mock<IAugmentQuality>[] mocks)
@ -130,7 +130,7 @@ public void should_return_version_1_when_no_version_specified()
public void should_return_version_2_when_name_indicates_proper() public void should_return_version_2_when_name_indicates_proper()
{ {
_nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>())) _nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>()))
.Returns(new AugmentQualityResult(Source.TV, Confidence.Default, 480, Confidence.Default, Modifier.NONE, Confidence.Default, new Revision(2), Confidence.Tag)); .Returns(new AugmentQualityResult(QualitySource.TV, Confidence.Default, 480, Confidence.Default, Modifier.NONE, Confidence.Default, new Revision(2), Confidence.Tag));
GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); GivenAugmenters(_nameAugmenter, _releaseNameAugmenter);
@ -144,7 +144,7 @@ public void should_return_version_2_when_name_indicates_proper()
public void should_return_version_0_when_file_name_indicates_v0() public void should_return_version_0_when_file_name_indicates_v0()
{ {
_nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>())) _nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>()))
.Returns(new AugmentQualityResult(Source.TV, Confidence.Default, 480, Confidence.Default, Modifier.NONE, Confidence.Default, new Revision(0), Confidence.Tag)); .Returns(new AugmentQualityResult(QualitySource.TV, Confidence.Default, 480, Confidence.Default, Modifier.NONE, Confidence.Default, new Revision(0), Confidence.Tag));
GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); GivenAugmenters(_nameAugmenter, _releaseNameAugmenter);
@ -158,10 +158,10 @@ public void should_return_version_0_when_file_name_indicates_v0()
public void should_return_version_2_when_file_name_indicates_v0_and_release_name_indicates_v2() public void should_return_version_2_when_file_name_indicates_v0_and_release_name_indicates_v2()
{ {
_nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>())) _nameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>()))
.Returns(new AugmentQualityResult(Source.TV, Confidence.Default, 480, Confidence.Default, Modifier.NONE, Confidence.Default, new Revision(0), Confidence.Tag)); .Returns(new AugmentQualityResult(QualitySource.TV, Confidence.Default, 480, Confidence.Default, Modifier.NONE, Confidence.Default, new Revision(0), Confidence.Tag));
_releaseNameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>())) _releaseNameAugmenter.Setup(s => s.AugmentQuality(It.IsAny<LocalMovie>(), It.IsAny<DownloadClientItem>()))
.Returns(new AugmentQualityResult(Source.TV, Confidence.Default, 480, Confidence.Default, Modifier.NONE, Confidence.Default, new Revision(2), Confidence.Tag)); .Returns(new AugmentQualityResult(QualitySource.TV, Confidence.Default, 480, Confidence.Default, Modifier.NONE, Confidence.Default, new Revision(2), Confidence.Tag));
GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); GivenAugmenters(_nameAugmenter, _releaseNameAugmenter);

View File

@ -69,7 +69,7 @@ public void should_return_closest_resolution(int mediaInfoWidth, int mediaInfoHe
result.Should().NotBe(null); result.Should().NotBe(null);
result.Resolution.Should().Be((int)expectedResolution); result.Resolution.Should().Be((int)expectedResolution);
result.Source.Should().Be(Source.UNKNOWN); result.Source.Should().Be(QualitySource.UNKNOWN);
} }
[Test] [Test]
@ -89,7 +89,7 @@ public void should_include_source_if_extracted_from_title()
result.Should().NotBe(null); result.Should().NotBe(null);
result.Resolution.Should().Be(1080); result.Resolution.Should().Be(1080);
result.Source.Should().Be(Source.WEBDL); result.Source.Should().Be(QualitySource.WEBDL);
} }
[Test] [Test]
@ -109,7 +109,7 @@ public void should_have_unknown_source_if_no_source_extracted_from_title()
result.Should().NotBe(null); result.Should().NotBe(null);
result.Resolution.Should().Be(1080); result.Resolution.Should().Be(1080);
result.Source.Should().Be(Source.UNKNOWN); result.Source.Should().Be(QualitySource.UNKNOWN);
} }
} }
} }

View File

@ -55,10 +55,10 @@ public void should_return_null_if_no_grabbed_history()
Subject.AugmentQuality(_localMovie, _downloadClientItem).Should().BeNull(); Subject.AugmentQuality(_localMovie, _downloadClientItem).Should().BeNull();
} }
[TestCase("Series.Title.S01E01.1080p.WEB.x264", Source.WEBDL, Confidence.Tag, 1080, Confidence.Tag)] [TestCase("Series.Title.S01E01.1080p.WEB.x264", QualitySource.WEBDL, Confidence.Tag, 1080, Confidence.Tag)]
[TestCase("Series.Title.S01E01.WEB.x264", Source.WEBDL, Confidence.Tag, 480, Confidence.Fallback)] [TestCase("Series.Title.S01E01.WEB.x264", QualitySource.WEBDL, Confidence.Tag, 480, Confidence.Fallback)]
[TestCase("Series.Title.S01E01.720p.x264", Source.TV, Confidence.Fallback, 720, Confidence.Tag)] [TestCase("Series.Title.S01E01.720p.x264", QualitySource.TV, Confidence.Fallback, 720, Confidence.Tag)]
public void should_return_augmented_quality(string title, Source source, Confidence sourceConfidence, int resolution, Confidence resolutionConfidence) public void should_return_augmented_quality(string title, QualitySource source, Confidence sourceConfidence, int resolution, Confidence resolutionConfidence)
{ {
Mocker.GetMock<IDownloadHistoryService>() Mocker.GetMock<IDownloadHistoryService>()
.Setup(s => s.GetLatestGrab(It.IsAny<string>())) .Setup(s => s.GetLatestGrab(It.IsAny<string>()))

View File

@ -19,26 +19,26 @@ public void Setup()
// public static object[] SelfQualityParserCases = QualityDefinition.DefaultQualityDefinitions.ToArray(); // public static object[] SelfQualityParserCases = QualityDefinition.DefaultQualityDefinitions.ToArray();
public static object[] OtherSourceQualityParserCases = public static object[] OtherSourceQualityParserCases =
{ {
new object[] { "SD TV", Source.TV, Resolution.R480p, Modifier.NONE }, new object[] { "SD TV", QualitySource.TV, Resolution.R480p, Modifier.NONE },
new object[] { "SD DVD", Source.DVD, Resolution.Unknown, Modifier.NONE }, new object[] { "SD DVD", QualitySource.DVD, Resolution.Unknown, Modifier.NONE },
new object[] { "480p WEB-DL", Source.WEBDL, Resolution.R480p, Modifier.NONE }, new object[] { "480p WEB-DL", QualitySource.WEBDL, Resolution.R480p, Modifier.NONE },
new object[] { "HD TV", Source.TV, Resolution.R720p, Modifier.NONE }, new object[] { "HD TV", QualitySource.TV, Resolution.R720p, Modifier.NONE },
new object[] { "1080p HD TV", Source.TV, Resolution.R1080p, Modifier.NONE }, new object[] { "1080p HD TV", QualitySource.TV, Resolution.R1080p, Modifier.NONE },
new object[] { "2160p HD TV", Source.TV, Resolution.R2160p, Modifier.NONE }, new object[] { "2160p HD TV", QualitySource.TV, Resolution.R2160p, Modifier.NONE },
new object[] { "720p WEB-DL", Source.WEBDL, Resolution.R720p, Modifier.NONE }, new object[] { "720p WEB-DL", QualitySource.WEBDL, Resolution.R720p, Modifier.NONE },
new object[] { "1080p WEB-DL", Source.WEBDL, Resolution.R1080p, Modifier.NONE }, new object[] { "1080p WEB-DL", QualitySource.WEBDL, Resolution.R1080p, Modifier.NONE },
new object[] { "2160p WEB-DL", Source.WEBDL, Resolution.R2160p, Modifier.NONE }, new object[] { "2160p WEB-DL", QualitySource.WEBDL, Resolution.R2160p, Modifier.NONE },
new object[] { "720p BluRay", Source.BLURAY, Resolution.R720p, Modifier.NONE }, new object[] { "720p BluRay", QualitySource.BLURAY, Resolution.R720p, Modifier.NONE },
new object[] { "1080p BluRay", Source.BLURAY, Resolution.R1080p, Modifier.NONE }, new object[] { "1080p BluRay", QualitySource.BLURAY, Resolution.R1080p, Modifier.NONE },
new object[] { "2160p BluRay", Source.BLURAY, Resolution.R2160p, Modifier.NONE }, new object[] { "2160p BluRay", QualitySource.BLURAY, Resolution.R2160p, Modifier.NONE },
new object[] { "1080p Remux", Source.BLURAY, Resolution.R1080p, Modifier.REMUX }, new object[] { "1080p Remux", QualitySource.BLURAY, Resolution.R1080p, Modifier.REMUX },
new object[] { "2160p Remux", Source.BLURAY, Resolution.R2160p, Modifier.REMUX }, new object[] { "2160p Remux", QualitySource.BLURAY, Resolution.R2160p, Modifier.REMUX },
}; };
[TestCase("Movie.Title.3.2017.720p.TSRip.x264.AAC-Ozlem", false)] [TestCase("Movie.Title.3.2017.720p.TSRip.x264.AAC-Ozlem", false)]
public void should_parse_ts(string title, bool proper) public void should_parse_ts(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.TELESYNC, proper, Resolution.R720p); ParseAndVerifyQuality(title, QualitySource.TELESYNC, proper, Resolution.R720p);
} }
[TestCase("Movie Name 2018 NEW PROPER 720p HD-CAM X264 HQ-CPG", true)] [TestCase("Movie Name 2018 NEW PROPER 720p HD-CAM X264 HQ-CPG", true)]
@ -47,7 +47,7 @@ public void should_parse_ts(string title, bool proper)
[TestCase("Movie Name (2022) New HDCAMRip 1080p [Love Rulz]", false)] [TestCase("Movie Name (2022) New HDCAMRip 1080p [Love Rulz]", false)]
public void should_parse_cam(string title, bool proper) public void should_parse_cam(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.CAM, proper, Resolution.Unknown); ParseAndVerifyQuality(title, QualitySource.CAM, proper, Resolution.Unknown);
} }
[TestCase("S07E23 .avi ", false)] [TestCase("S07E23 .avi ", false)]
@ -68,7 +68,7 @@ public void should_parse_cam(string title, bool proper)
[TestCase("Movie Name.S03.TVRip.XviD-NOGRP", false)] [TestCase("Movie Name.S03.TVRip.XviD-NOGRP", false)]
public void should_parse_sdtv_quality(string title, bool proper) public void should_parse_sdtv_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.TV, proper, Resolution.R480p); ParseAndVerifyQuality(title, QualitySource.TV, proper, Resolution.R480p);
} }
[TestCase("Some.Movie.S03E06.DVDRip.XviD-WiDE", false)] [TestCase("Some.Movie.S03E06.DVDRip.XviD-WiDE", false)]
@ -79,7 +79,7 @@ public void should_parse_sdtv_quality(string title, bool proper)
[TestCase("SomeMovie.2018.DVDRip.ts", false)] [TestCase("SomeMovie.2018.DVDRip.ts", false)]
public void should_parse_dvd_quality(string title, bool proper) public void should_parse_dvd_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.DVD, proper, Resolution.Unknown); ParseAndVerifyQuality(title, QualitySource.DVD, proper, Resolution.Unknown);
} }
[TestCase("Some.Movie.Magic.Rainbow.2007.DVD5.NTSC", false)] [TestCase("Some.Movie.Magic.Rainbow.2007.DVD5.NTSC", false)]
@ -91,7 +91,7 @@ public void should_parse_dvd_quality(string title, bool proper)
[TestCase("Some.Movie.2005.PAL.MDVDR-SOMegRoUP", false)] [TestCase("Some.Movie.2005.PAL.MDVDR-SOMegRoUP", false)]
public void should_parse_dvdr_quality(string title, bool proper) public void should_parse_dvdr_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.DVD, proper, Resolution.R480p, Modifier.REMUX); ParseAndVerifyQuality(title, QualitySource.DVD, proper, Resolution.R480p, Modifier.REMUX);
} }
[TestCase("Movie.Name.S01E10.The.Leviathan.480p.WEB-DL.x264-mSD", false)] [TestCase("Movie.Name.S01E10.The.Leviathan.480p.WEB-DL.x264-mSD", false)]
@ -103,13 +103,13 @@ public void should_parse_dvdr_quality(string title, bool proper)
[TestCase("[Erai-raws] Movie Title [540p][Multiple Subtitle].mkv", false)] [TestCase("[Erai-raws] Movie Title [540p][Multiple Subtitle].mkv", false)]
public void should_parse_webdl480p_quality(string title, bool proper) public void should_parse_webdl480p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.WEBDL, proper, Resolution.R480p); ParseAndVerifyQuality(title, QualitySource.WEBDL, proper, Resolution.R480p);
} }
[TestCase("Movie.Name.1x04.ITA.WEBMux.x264-NovaRip", false)] [TestCase("Movie.Name.1x04.ITA.WEBMux.x264-NovaRip", false)]
public void should_parse_webrip480p_quality(string title, bool proper) public void should_parse_webrip480p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.WEBRIP, proper, Resolution.R480p); ParseAndVerifyQuality(title, QualitySource.WEBRIP, proper, Resolution.R480p);
} }
[TestCase("Movie.Name (BD)(640x480(RAW) (BATCH 1) (1-13)", false)] [TestCase("Movie.Name (BD)(640x480(RAW) (BATCH 1) (1-13)", false)]
@ -118,7 +118,7 @@ public void should_parse_webrip480p_quality(string title, bool proper)
[TestCase("Movie.Name.2011.LIMITED.BluRay.360p.H264-20-40", false)] [TestCase("Movie.Name.2011.LIMITED.BluRay.360p.H264-20-40", false)]
public void should_parse_bluray480p_quality(string title, bool proper) public void should_parse_bluray480p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.BLURAY, proper, Resolution.R480p); ParseAndVerifyQuality(title, QualitySource.BLURAY, proper, Resolution.R480p);
} }
[TestCase("Movie Name - S01E01 - Title [HDTV]", false)] [TestCase("Movie Name - S01E01 - Title [HDTV]", false)]
@ -134,7 +134,7 @@ public void should_parse_bluray480p_quality(string title, bool proper)
[TestCase("Movie.Name.The.Lost.Pilots.Movie.HR.WS.PDTV.x264-DHD-Remux.mkv", false)] [TestCase("Movie.Name.The.Lost.Pilots.Movie.HR.WS.PDTV.x264-DHD-Remux.mkv", false)]
public void should_parse_hdtv720p_quality(string title, bool proper) public void should_parse_hdtv720p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.TV, proper, Resolution.R720p); ParseAndVerifyQuality(title, QualitySource.TV, proper, Resolution.R720p);
} }
[TestCase("Movie Name.S07E01.ARE.YOU.1080P.HDTV.X264-QCF", false)] [TestCase("Movie Name.S07E01.ARE.YOU.1080P.HDTV.X264-QCF", false)]
@ -144,7 +144,7 @@ public void should_parse_hdtv720p_quality(string title, bool proper)
[TestCase("Movie.Name.2020.1080i.HDTV.DD5.1.H.264-NOGRP", false)] [TestCase("Movie.Name.2020.1080i.HDTV.DD5.1.H.264-NOGRP", false)]
public void should_parse_hdtv1080p_quality(string title, bool proper) public void should_parse_hdtv1080p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.TV, proper, Resolution.R1080p); ParseAndVerifyQuality(title, QualitySource.TV, proper, Resolution.R1080p);
} }
[TestCase("Movie Name S01E04 Mexicos Death Train 720p WEB DL", false)] [TestCase("Movie Name S01E04 Mexicos Death Train 720p WEB DL", false)]
@ -167,14 +167,14 @@ public void should_parse_hdtv1080p_quality(string title, bool proper)
[TestCase("Movie.Title.2021.DP.WEB.720p.DDP.5.1.H.264.PLEX", false)] [TestCase("Movie.Title.2021.DP.WEB.720p.DDP.5.1.H.264.PLEX", false)]
public void should_parse_webdl720p_quality(string title, bool proper) public void should_parse_webdl720p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.WEBDL, proper, Resolution.R720p); ParseAndVerifyQuality(title, QualitySource.WEBDL, proper, Resolution.R720p);
} }
[TestCase("Movie.Title.ITA.720p.WEBMux.x264-NovaRip", false)] [TestCase("Movie.Title.ITA.720p.WEBMux.x264-NovaRip", false)]
[TestCase("Movie Name.S04E01.720p.WEBRip.AAC2.0.x264-NFRiP", false)] [TestCase("Movie Name.S04E01.720p.WEBRip.AAC2.0.x264-NFRiP", false)]
public void should_parse_webrip720p_quality(string title, bool proper) public void should_parse_webrip720p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.WEBRIP, proper, Resolution.R720p); ParseAndVerifyQuality(title, QualitySource.WEBRIP, proper, Resolution.R720p);
} }
[TestCase("Movie Name S09E03 1080p WEB DL DD5 1 H264 NFHD", false)] [TestCase("Movie Name S09E03 1080p WEB DL DD5 1 H264 NFHD", false)]
@ -206,7 +206,7 @@ public void should_parse_webrip720p_quality(string title, bool proper)
[TestCase("Movie Title 2018 (WEB 1080p HEVC Opus) [Netaro]", false)] [TestCase("Movie Title 2018 (WEB 1080p HEVC Opus) [Netaro]", false)]
public void should_parse_webdl1080p_quality(string title, bool proper) public void should_parse_webdl1080p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.WEBDL, proper, Resolution.R1080p); ParseAndVerifyQuality(title, QualitySource.WEBDL, proper, Resolution.R1080p);
} }
[TestCase("Movie.Name.S04E01.iNTERNAL.1080p.WEBRip.x264-QRUS", false)] [TestCase("Movie.Name.S04E01.iNTERNAL.1080p.WEBRip.x264-QRUS", false)]
@ -215,7 +215,7 @@ public void should_parse_webdl1080p_quality(string title, bool proper)
[TestCase("Movie.Title.2019.1080p.AMZN.WEB-Rip.DDP.5.1.HEVC", false)] [TestCase("Movie.Title.2019.1080p.AMZN.WEB-Rip.DDP.5.1.HEVC", false)]
public void should_parse_webrip1080p_quality(string title, bool proper) public void should_parse_webrip1080p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.WEBRIP, proper, Resolution.R1080p); ParseAndVerifyQuality(title, QualitySource.WEBRIP, proper, Resolution.R1080p);
} }
[TestCase("Movie.Name.2016.03.14.2160p.WEB.x264-spamTV", false)] [TestCase("Movie.Name.2016.03.14.2160p.WEB.x264-spamTV", false)]
@ -226,7 +226,7 @@ public void should_parse_webrip1080p_quality(string title, bool proper)
[TestCase("The.Movie.2022.NORDiC.2160p.DV.HDR.WEB.H.265-NiDHUG", false)] [TestCase("The.Movie.2022.NORDiC.2160p.DV.HDR.WEB.H.265-NiDHUG", false)]
public void should_parse_webdl2160p_quality(string title, bool proper) public void should_parse_webdl2160p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.WEBDL, proper, Resolution.R2160p); ParseAndVerifyQuality(title, QualitySource.WEBDL, proper, Resolution.R2160p);
} }
[TestCase("Movie Name S01E01.2160P AMZN WEBRIP DD2.0 HI10P X264-TROLLUHD", false)] [TestCase("Movie Name S01E01.2160P AMZN WEBRIP DD2.0 HI10P X264-TROLLUHD", false)]
@ -235,7 +235,7 @@ public void should_parse_webdl2160p_quality(string title, bool proper)
[TestCase("Movie Name S01E01 2160p AMZN WEBRip DD2.0 Hi10P x264-TrollUHD", false)] [TestCase("Movie Name S01E01 2160p AMZN WEBRip DD2.0 Hi10P x264-TrollUHD", false)]
public void should_parse_webrip2160p_quality(string title, bool proper) public void should_parse_webrip2160p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.WEBRIP, proper, Resolution.R2160p); ParseAndVerifyQuality(title, QualitySource.WEBRIP, proper, Resolution.R2160p);
} }
[TestCase("Movie.Name.S03E01-06.DUAL.Bluray.AC3.-HELLYWOOD.avi", false)] [TestCase("Movie.Name.S03E01-06.DUAL.Bluray.AC3.-HELLYWOOD.avi", false)]
@ -258,7 +258,7 @@ public void should_parse_webrip2160p_quality(string title, bool proper)
[TestCase("Movie.Hunter.2018.720p.Blu-ray.Remux.AVC.FLAC.2.0-SiCFoI", false)] [TestCase("Movie.Hunter.2018.720p.Blu-ray.Remux.AVC.FLAC.2.0-SiCFoI", false)]
public void should_parse_bluray720p_quality(string title, bool proper) public void should_parse_bluray720p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.BLURAY, proper, Resolution.R720p); ParseAndVerifyQuality(title, QualitySource.BLURAY, proper, Resolution.R720p);
} }
[TestCase("Movie Title - S01E03 - Come Fly With Me - 1080p BluRay.mkv", false)] [TestCase("Movie Title - S01E03 - Come Fly With Me - 1080p BluRay.mkv", false)]
@ -281,7 +281,7 @@ public void should_parse_bluray720p_quality(string title, bool proper)
[TestCase("Movie.Title.2012.German.DL.1080p.UHD2BD.x264-QfG", false)] [TestCase("Movie.Title.2012.German.DL.1080p.UHD2BD.x264-QfG", false)]
public void should_parse_bluray1080p_quality(string title, bool proper) public void should_parse_bluray1080p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.BLURAY, proper, Resolution.R1080p); ParseAndVerifyQuality(title, QualitySource.BLURAY, proper, Resolution.R1080p);
} }
[TestCase("Movie.S01E02.Chained.Heat.[Bluray2160p].mkv", false)] [TestCase("Movie.S01E02.Chained.Heat.[Bluray2160p].mkv", false)]
@ -299,20 +299,20 @@ public void should_parse_bluray1080p_quality(string title, bool proper)
[TestCase("Movie.Title.2014.2160p.BDRip.AAC.7.1.HDR10.x265.10bit-Markll", false)] [TestCase("Movie.Title.2014.2160p.BDRip.AAC.7.1.HDR10.x265.10bit-Markll", false)]
public void should_parse_bluray2160p_quality(string title, bool proper) public void should_parse_bluray2160p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.BLURAY, proper, Resolution.R2160p); ParseAndVerifyQuality(title, QualitySource.BLURAY, proper, Resolution.R2160p);
} }
[TestCase("Movie.Name.2004.576p.BDRip.x264-HANDJOB")] [TestCase("Movie.Name.2004.576p.BDRip.x264-HANDJOB")]
[TestCase("Movie.Title.S01E05.576p.BluRay.DD5.1.x264-HiSD")] [TestCase("Movie.Title.S01E05.576p.BluRay.DD5.1.x264-HiSD")]
public void should_parse_bluray576p_quality(string title) public void should_parse_bluray576p_quality(string title)
{ {
ParseAndVerifyQuality(title, Source.BLURAY, false, Resolution.R576p); ParseAndVerifyQuality(title, QualitySource.BLURAY, false, Resolution.R576p);
} }
[TestCase("Movie.1993.720p.BluRay.REMUX.AVC.FLAC.2.0-BLURANiUM")] [TestCase("Movie.1993.720p.BluRay.REMUX.AVC.FLAC.2.0-BLURANiUM")]
public void should_parse_remux720p_as_bluray720p_quality(string title) public void should_parse_remux720p_as_bluray720p_quality(string title)
{ {
ParseAndVerifyQuality(title, Source.BLURAY, false, Resolution.R720p); ParseAndVerifyQuality(title, QualitySource.BLURAY, false, Resolution.R720p);
} }
[TestCase("Movie.Title.2016.REMUX.1080p.BluRay.AVC.DTS-HD.MA.5.1-iFT")] [TestCase("Movie.Title.2016.REMUX.1080p.BluRay.AVC.DTS-HD.MA.5.1-iFT")]
@ -326,7 +326,7 @@ public void should_parse_remux720p_as_bluray720p_quality(string title)
[TestCase("This.Wonderful.Movie.1991.German.ML.1080p.BluRay.AVC-GeRMaNSCeNEGRoUP")] [TestCase("This.Wonderful.Movie.1991.German.ML.1080p.BluRay.AVC-GeRMaNSCeNEGRoUP")]
public void should_parse_remux1080p_quality(string title) public void should_parse_remux1080p_quality(string title)
{ {
ParseAndVerifyQuality(title, Source.BLURAY, false, Resolution.R1080p, Modifier.REMUX); ParseAndVerifyQuality(title, QualitySource.BLURAY, false, Resolution.R1080p, Modifier.REMUX);
} }
[TestCase("Movie.Title.2016.REMUX.2160p.BluRay.AVC.DTS-HD.MA.5.1-iFT")] [TestCase("Movie.Title.2016.REMUX.2160p.BluRay.AVC.DTS-HD.MA.5.1-iFT")]
@ -339,7 +339,7 @@ public void should_parse_remux1080p_quality(string title)
[TestCase("This.Wonderful.Movie.1991.German.ML.2160p.BluRay.HEVC-GeRMaNSCeNEGRoUP")] [TestCase("This.Wonderful.Movie.1991.German.ML.2160p.BluRay.HEVC-GeRMaNSCeNEGRoUP")]
public void should_parse_remux2160p_quality(string title) public void should_parse_remux2160p_quality(string title)
{ {
ParseAndVerifyQuality(title, Source.BLURAY, false, Resolution.R2160p, Modifier.REMUX); ParseAndVerifyQuality(title, QualitySource.BLURAY, false, Resolution.R2160p, Modifier.REMUX);
} }
[TestCase("Movie.Title.2013.BDISO")] [TestCase("Movie.Title.2013.BDISO")]
@ -366,14 +366,14 @@ public void should_parse_remux2160p_quality(string title)
[TestCase("Movie.2009.Blu.ray.AVC.DTS.HD.MA.5.1")] [TestCase("Movie.2009.Blu.ray.AVC.DTS.HD.MA.5.1")]
public void should_parse_brdisk_1080p_quality(string title) public void should_parse_brdisk_1080p_quality(string title)
{ {
ParseAndVerifyQuality(title, Source.BLURAY, false, Resolution.R1080p, Modifier.BRDISK); ParseAndVerifyQuality(title, QualitySource.BLURAY, false, Resolution.R1080p, Modifier.BRDISK);
} }
[TestCase("Movie.Title.2015.Open.Matte.1080i.HDTV.DD5.1.MPEG2", false)] [TestCase("Movie.Title.2015.Open.Matte.1080i.HDTV.DD5.1.MPEG2", false)]
[TestCase("Movie.Title.2009.1080i.HDTV.AAC2.0.MPEG2-PepelefuF", false)] [TestCase("Movie.Title.2009.1080i.HDTV.AAC2.0.MPEG2-PepelefuF", false)]
public void should_parse_raw_quality(string title, bool proper) public void should_parse_raw_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.TV, proper, Resolution.R1080p, Modifier.RAWHD); ParseAndVerifyQuality(title, QualitySource.TV, proper, Resolution.R1080p, Modifier.RAWHD);
} }
[TestCase("Some.Movie.S02E15", false)] [TestCase("Some.Movie.S02E15", false)]
@ -382,7 +382,7 @@ public void should_parse_raw_quality(string title, bool proper)
[TestCase("Movie.Title.S01E01.The.Web.MT-dd", false)] [TestCase("Movie.Title.S01E01.The.Web.MT-dd", false)]
public void quality_parse(string title, bool proper) public void quality_parse(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Source.UNKNOWN, proper, Resolution.Unknown); ParseAndVerifyQuality(title, QualitySource.UNKNOWN, proper, Resolution.Unknown);
} }
/*[Test, TestCaseSource("SelfQualityParserCases")] /*[Test, TestCaseSource("SelfQualityParserCases")]
@ -401,7 +401,7 @@ public void parsing_our_own_quality_enum_name(QualityDefinition definition)
[Test] [Test]
[TestCaseSource("OtherSourceQualityParserCases")] [TestCaseSource("OtherSourceQualityParserCases")]
public void should_parse_quality_from_other_source(string qualityString, Source source, Resolution resolution, Modifier modifier = Modifier.NONE) public void should_parse_quality_from_other_source(string qualityString, QualitySource source, Resolution resolution, Modifier modifier = Modifier.NONE)
{ {
foreach (var c in new char[] { '-', '.', ' ', '_' }) foreach (var c in new char[] { '-', '.', ' ', '_' })
{ {
@ -486,7 +486,7 @@ public void should_be_able_to_parse_repack(string title, bool isRepack, int vers
result.Revision.IsRepack.Should().Be(isRepack); result.Revision.IsRepack.Should().Be(isRepack);
} }
private void ParseAndVerifyQuality(string title, Source source, bool proper, Resolution resolution, Modifier modifier = Modifier.NONE) private void ParseAndVerifyQuality(string title, QualitySource source, bool proper, Resolution resolution, Modifier modifier = Modifier.NONE)
{ {
var result = QualityParser.ParseQuality(title); var result = QualityParser.ParseQuality(title);
if (resolution != Resolution.Unknown) if (resolution != Resolution.Unknown)

View File

@ -7,56 +7,56 @@ namespace NzbDrone.Core.Test.Qualities
[TestFixture] [TestFixture]
public class QualityFinderFixture public class QualityFinderFixture
{ {
[TestCase(Source.CAM, 480, Modifier.NONE)] [TestCase(QualitySource.CAM, 480, Modifier.NONE)]
[TestCase(Source.CAM, 1080, Modifier.NONE)] [TestCase(QualitySource.CAM, 1080, Modifier.NONE)]
[TestCase(Source.CAM, 0, Modifier.NONE)] [TestCase(QualitySource.CAM, 0, Modifier.NONE)]
public void should_return_CAM(Source source, int resolution, Modifier modifier) public void should_return_CAM(QualitySource source, int resolution, Modifier modifier)
{ {
QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.CAM); QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.CAM);
} }
[TestCase(Source.CAM, 1080, Modifier.SCREENER)] [TestCase(QualitySource.CAM, 1080, Modifier.SCREENER)]
[TestCase(Source.CAM, 0, Modifier.SCREENER)] [TestCase(QualitySource.CAM, 0, Modifier.SCREENER)]
public void should_return_Unknown(Source source, int resolution, Modifier modifier) public void should_return_Unknown(QualitySource source, int resolution, Modifier modifier)
{ {
QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.Unknown); QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.Unknown);
} }
[TestCase(Source.DVD, 480, Modifier.REMUX)] [TestCase(QualitySource.DVD, 480, Modifier.REMUX)]
public void should_return_DVD_Remux(Source source, int resolution, Modifier modifier) public void should_return_DVD_Remux(QualitySource source, int resolution, Modifier modifier)
{ {
QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.DVDR); QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.DVDR);
} }
[TestCase(Source.DVD, 480, Modifier.NONE)] [TestCase(QualitySource.DVD, 480, Modifier.NONE)]
[TestCase(Source.DVD, 576, Modifier.NONE)] [TestCase(QualitySource.DVD, 576, Modifier.NONE)]
public void should_return_DVD(Source source, int resolution, Modifier modifier) public void should_return_DVD(QualitySource source, int resolution, Modifier modifier)
{ {
QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.DVD); QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.DVD);
} }
[TestCase(Source.TV, 480, Modifier.NONE)] [TestCase(QualitySource.TV, 480, Modifier.NONE)]
public void should_return_SDTV(Source source, int resolution, Modifier modifier) public void should_return_SDTV(QualitySource source, int resolution, Modifier modifier)
{ {
QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.SDTV); QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.SDTV);
} }
[TestCase(Source.TV, 720, Modifier.NONE)] [TestCase(QualitySource.TV, 720, Modifier.NONE)]
[TestCase(Source.UNKNOWN, 720, Modifier.NONE)] [TestCase(QualitySource.UNKNOWN, 720, Modifier.NONE)]
public void should_return_HDTV_720p(Source source, int resolution, Modifier modifier) public void should_return_HDTV_720p(QualitySource source, int resolution, Modifier modifier)
{ {
QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.HDTV720p); QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.HDTV720p);
} }
[TestCase(Source.TV, 1080, Modifier.NONE)] [TestCase(QualitySource.TV, 1080, Modifier.NONE)]
[TestCase(Source.UNKNOWN, 1080, Modifier.NONE)] [TestCase(QualitySource.UNKNOWN, 1080, Modifier.NONE)]
public void should_return_HDTV_1080p(Source source, int resolution, Modifier modifier) public void should_return_HDTV_1080p(QualitySource source, int resolution, Modifier modifier)
{ {
QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.HDTV1080p); QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.HDTV1080p);
} }
[TestCase(Source.BLURAY, 720, Modifier.NONE)] [TestCase(QualitySource.BLURAY, 720, Modifier.NONE)]
public void should_return_Bluray720p(Source source, int resolution, Modifier modifier) public void should_return_Bluray720p(QualitySource source, int resolution, Modifier modifier)
{ {
QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.Bluray720p); QualityFinder.FindBySourceAndResolution(source, resolution, modifier).Should().Be(Quality.Bluray720p);
} }

View File

@ -20,12 +20,12 @@ public class SourceSpecification : CustomFormatSpecificationBase
public override int Order => 5; public override int Order => 5;
public override string ImplementationName => "Source"; public override string ImplementationName => "Source";
[FieldDefinition(1, Label = "Source", Type = FieldType.Select, SelectOptions = typeof(Source))] [FieldDefinition(1, Label = "Source", Type = FieldType.Select, SelectOptions = typeof(QualitySource))]
public int Value { get; set; } public int Value { get; set; }
protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input) protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input)
{ {
return (input.MovieInfo?.Quality?.Quality?.Source ?? (int)Source.UNKNOWN) == (Source)Value; return (input.MovieInfo?.Quality?.Quality?.Source ?? (int)QualitySource.UNKNOWN) == (QualitySource)Value;
} }
public override NzbDroneValidationResult Validate() public override NzbDroneValidationResult Validate()

View File

@ -133,28 +133,28 @@ private Resolution ParseResolution(string value)
} }
} }
private Source ParseSource(string value) private QualitySource ParseSource(string value)
{ {
switch (value) switch (value)
{ {
case "cam": case "cam":
return Source.CAM; return QualitySource.CAM;
case "telesync": case "telesync":
return Source.TELESYNC; return QualitySource.TELESYNC;
case "telecine": case "telecine":
return Source.TELECINE; return QualitySource.TELECINE;
case "workprint": case "workprint":
return Source.WORKPRINT; return QualitySource.WORKPRINT;
case "dvd": case "dvd":
return Source.DVD; return QualitySource.DVD;
case "tv": case "tv":
return Source.TV; return QualitySource.TV;
case "webdl": case "webdl":
return Source.WEBDL; return QualitySource.WEBDL;
case "bluray": case "bluray":
return Source.BLURAY; return QualitySource.BLURAY;
default: default:
return Source.UNKNOWN; return QualitySource.UNKNOWN;
} }
} }

View File

@ -22,7 +22,7 @@ public AggregateQuality(IEnumerable<IAugmentQuality> augmentQualities,
public LocalMovie Aggregate(LocalMovie localMovie, DownloadClientItem downloadClientItem) public LocalMovie Aggregate(LocalMovie localMovie, DownloadClientItem downloadClientItem)
{ {
var source = Source.UNKNOWN; var source = QualitySource.UNKNOWN;
var sourceConfidence = Confidence.Default; var sourceConfidence = Confidence.Default;
var resolution = 0; var resolution = 0;
var resolutionConfidence = Confidence.Default; var resolutionConfidence = Confidence.Default;
@ -41,8 +41,8 @@ public LocalMovie Aggregate(LocalMovie localMovie, DownloadClientItem downloadCl
_logger.Trace("Considering Source {0} ({1}) Resolution {2} ({3}) Revision {4} from {5}", augmentedQuality.Source, augmentedQuality.SourceConfidence, augmentedQuality.Resolution, augmentedQuality.ResolutionConfidence, augmentedQuality.Revision, augmentQuality.Name); _logger.Trace("Considering Source {0} ({1}) Resolution {2} ({3}) Revision {4} from {5}", augmentedQuality.Source, augmentedQuality.SourceConfidence, augmentedQuality.Resolution, augmentedQuality.ResolutionConfidence, augmentedQuality.Revision, augmentQuality.Name);
if (source == Source.UNKNOWN || if (source == QualitySource.UNKNOWN ||
(augmentedQuality.SourceConfidence > sourceConfidence && augmentedQuality.Source != Source.UNKNOWN)) (augmentedQuality.SourceConfidence > sourceConfidence && augmentedQuality.Source != QualitySource.UNKNOWN))
{ {
source = augmentedQuality.Source; source = augmentedQuality.Source;
sourceConfidence = augmentedQuality.SourceConfidence; sourceConfidence = augmentedQuality.SourceConfidence;

View File

@ -28,7 +28,7 @@ public AugmentQualityResult AugmentQuality(LocalMovie localMovie, DownloadClient
var width = localMovie.MediaInfo.Width; var width = localMovie.MediaInfo.Width;
var height = localMovie.MediaInfo.Height; var height = localMovie.MediaInfo.Height;
var source = Source.UNKNOWN; var source = QualitySource.UNKNOWN;
var sourceConfidence = Confidence.Default; var sourceConfidence = Confidence.Default;
var title = localMovie.MediaInfo.Title; var title = localMovie.MediaInfo.Title;
@ -37,7 +37,7 @@ public AugmentQualityResult AugmentQuality(LocalMovie localMovie, DownloadClient
var parsedQuality = QualityParser.ParseQualityName(title.Trim()); var parsedQuality = QualityParser.ParseQualityName(title.Trim());
// Only use the quality if it's not unknown and the source is from the name (which is MediaInfo's title in this case) // Only use the quality if it's not unknown and the source is from the name (which is MediaInfo's title in this case)
if (parsedQuality.Quality.Source != Source.UNKNOWN && if (parsedQuality.Quality.Source != QualitySource.UNKNOWN &&
parsedQuality.SourceDetectionSource == QualityDetectionSource.Name) parsedQuality.SourceDetectionSource == QualityDetectionSource.Name)
{ {
source = parsedQuality.Quality.Source; source = parsedQuality.Quality.Source;

View File

@ -5,7 +5,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Aggregation.Aggregators.Augmenter
public class AugmentQualityResult public class AugmentQualityResult
{ {
public string Name { get; set; } public string Name { get; set; }
public Source Source { get; set; } public QualitySource Source { get; set; }
public Confidence SourceConfidence { get; set; } public Confidence SourceConfidence { get; set; }
public int Resolution { get; set; } public int Resolution { get; set; }
public Confidence ResolutionConfidence { get; set; } public Confidence ResolutionConfidence { get; set; }
@ -14,7 +14,7 @@ public class AugmentQualityResult
public Revision Revision { get; set; } public Revision Revision { get; set; }
public Confidence RevisionConfidence { get; set; } public Confidence RevisionConfidence { get; set; }
public AugmentQualityResult(Source source, public AugmentQualityResult(QualitySource source,
Confidence sourceConfidence, Confidence sourceConfidence,
int resolution, int resolution,
Confidence resolutionConfidence, Confidence resolutionConfidence,
@ -33,22 +33,22 @@ public AugmentQualityResult(Source source,
RevisionConfidence = revisionConfidence; RevisionConfidence = revisionConfidence;
} }
public static AugmentQualityResult SourceOnly(Source source, Confidence sourceConfidence) public static AugmentQualityResult SourceOnly(QualitySource source, Confidence sourceConfidence)
{ {
return new AugmentQualityResult(source, sourceConfidence, 0, Confidence.Default, Modifier.NONE, Confidence.Default, null, Confidence.Default); return new AugmentQualityResult(source, sourceConfidence, 0, Confidence.Default, Modifier.NONE, Confidence.Default, null, Confidence.Default);
} }
public static AugmentQualityResult ResolutionOnly(int resolution, Confidence resolutionConfidence) public static AugmentQualityResult ResolutionOnly(int resolution, Confidence resolutionConfidence)
{ {
return new AugmentQualityResult(Source.UNKNOWN, Confidence.Default, resolution, resolutionConfidence, Modifier.NONE, Confidence.Default, null, Confidence.Default); return new AugmentQualityResult(QualitySource.UNKNOWN, Confidence.Default, resolution, resolutionConfidence, Modifier.NONE, Confidence.Default, null, Confidence.Default);
} }
public static AugmentQualityResult ModifierOnly(Modifier modifier, Confidence modifierConfidence) public static AugmentQualityResult ModifierOnly(Modifier modifier, Confidence modifierConfidence)
{ {
return new AugmentQualityResult(Source.UNKNOWN, Confidence.Default, 0, Confidence.Default, modifier, modifierConfidence, null, Confidence.Default); return new AugmentQualityResult(QualitySource.UNKNOWN, Confidence.Default, 0, Confidence.Default, modifier, modifierConfidence, null, Confidence.Default);
} }
public static AugmentQualityResult SourceAndResolutionOnly(Source source, Confidence sourceConfidence, int resolution, Confidence resolutionConfidence) public static AugmentQualityResult SourceAndResolutionOnly(QualitySource source, Confidence sourceConfidence, int resolution, Confidence resolutionConfidence)
{ {
return new AugmentQualityResult(source, sourceConfidence, resolution, resolutionConfidence, Modifier.NONE, Confidence.Default, null, Confidence.Default); return new AugmentQualityResult(source, sourceConfidence, resolution, resolutionConfidence, Modifier.NONE, Confidence.Default, null, Confidence.Default);
} }

View File

@ -198,25 +198,25 @@ private void RemoveMovieFromCollection(TraktSettings settings, Movie movie)
_proxy.RemoveFromCollection(payload, settings.AccessToken); _proxy.RemoveFromCollection(payload, settings.AccessToken);
} }
private string MapMediaType(Source source) private string MapMediaType(QualitySource source)
{ {
var traktSource = string.Empty; var traktSource = string.Empty;
switch (source) switch (source)
{ {
case Source.BLURAY: case QualitySource.BLURAY:
traktSource = "bluray"; traktSource = "bluray";
break; break;
case Source.WEBDL: case QualitySource.WEBDL:
traktSource = "digital"; traktSource = "digital";
break; break;
case Source.WEBRIP: case QualitySource.WEBRIP:
traktSource = "digital"; traktSource = "digital";
break; break;
case Source.DVD: case QualitySource.DVD:
traktSource = "dvd"; traktSource = "dvd";
break; break;
case Source.TV: case QualitySource.TV:
traktSource = "dvd"; traktSource = "dvd";
break; break;
} }

View File

@ -459,13 +459,13 @@ public static QualityModel ParseQualityName(string name)
if (resolution != Resolution.Unknown) if (resolution != Resolution.Unknown)
{ {
var source = Source.UNKNOWN; var source = QualitySource.UNKNOWN;
var modifier = Modifier.NONE; var modifier = Modifier.NONE;
if (remuxMatch) if (remuxMatch)
{ {
result.SourceDetectionSource = QualityDetectionSource.Name; result.SourceDetectionSource = QualityDetectionSource.Name;
source = Source.BLURAY; source = QualitySource.BLURAY;
modifier = Modifier.REMUX; modifier = Modifier.REMUX;
} }
else else
@ -490,7 +490,7 @@ public static QualityModel ParseQualityName(string name)
{ {
result.ResolutionDetectionSource = QualityDetectionSource.Name; result.ResolutionDetectionSource = QualityDetectionSource.Name;
result.Quality = source == Source.UNKNOWN result.Quality = source == QualitySource.UNKNOWN
? Quality.HDTV2160p ? Quality.HDTV2160p
: QualityFinder.FindBySourceAndResolution(source, 2160, modifier); : QualityFinder.FindBySourceAndResolution(source, 2160, modifier);
@ -501,7 +501,7 @@ public static QualityModel ParseQualityName(string name)
{ {
result.ResolutionDetectionSource = QualityDetectionSource.Name; result.ResolutionDetectionSource = QualityDetectionSource.Name;
result.Quality = source == Source.UNKNOWN result.Quality = source == QualitySource.UNKNOWN
? Quality.HDTV1080p ? Quality.HDTV1080p
: QualityFinder.FindBySourceAndResolution(source, 1080, modifier); : QualityFinder.FindBySourceAndResolution(source, 1080, modifier);
@ -512,7 +512,7 @@ public static QualityModel ParseQualityName(string name)
{ {
result.ResolutionDetectionSource = QualityDetectionSource.Name; result.ResolutionDetectionSource = QualityDetectionSource.Name;
result.Quality = source == Source.UNKNOWN result.Quality = source == QualitySource.UNKNOWN
? Quality.HDTV720p ? Quality.HDTV720p
: QualityFinder.FindBySourceAndResolution(source, 720, modifier); : QualityFinder.FindBySourceAndResolution(source, 720, modifier);
@ -524,7 +524,7 @@ public static QualityModel ParseQualityName(string name)
{ {
result.ResolutionDetectionSource = QualityDetectionSource.Name; result.ResolutionDetectionSource = QualityDetectionSource.Name;
result.Quality = source == Source.UNKNOWN result.Quality = source == QualitySource.UNKNOWN
? Quality.SDTV ? Quality.SDTV
: QualityFinder.FindBySourceAndResolution(source, 480, modifier); : QualityFinder.FindBySourceAndResolution(source, 480, modifier);

View File

@ -9,7 +9,7 @@ public class Quality : IEmbeddedDocument, IEquatable<Quality>
{ {
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public Source Source { get; set; } public QualitySource Source { get; set; }
public int Resolution { get; set; } public int Resolution { get; set; }
public Modifier Modifier { get; set; } public Modifier Modifier { get; set; }
@ -17,7 +17,7 @@ public Quality()
{ {
} }
private Quality(int id, string name, Source source, int resolution, Modifier modifier = Modifier.NONE) private Quality(int id, string name, QualitySource source, int resolution, Modifier modifier = Modifier.NONE)
{ {
Id = id; Id = id;
Name = name; Name = name;
@ -77,51 +77,51 @@ public override bool Equals(object obj)
} }
// Unable to determine // Unable to determine
public static Quality Unknown => new Quality(0, "Unknown", Source.UNKNOWN, 0); public static Quality Unknown => new Quality(0, "Unknown", QualitySource.UNKNOWN, 0);
// Pre-release // Pre-release
public static Quality WORKPRINT => new Quality(24, "WORKPRINT", Source.WORKPRINT, 0); // new public static Quality WORKPRINT => new Quality(24, "WORKPRINT", QualitySource.WORKPRINT, 0); // new
public static Quality CAM => new Quality(25, "CAM", Source.CAM, 0); // new public static Quality CAM => new Quality(25, "CAM", QualitySource.CAM, 0); // new
public static Quality TELESYNC => new Quality(26, "TELESYNC", Source.TELESYNC, 0); // new public static Quality TELESYNC => new Quality(26, "TELESYNC", QualitySource.TELESYNC, 0); // new
public static Quality TELECINE => new Quality(27, "TELECINE", Source.TELECINE, 0); // new public static Quality TELECINE => new Quality(27, "TELECINE", QualitySource.TELECINE, 0); // new
public static Quality DVDSCR => new Quality(28, "DVDSCR", Source.DVD, 480, Modifier.SCREENER); // new public static Quality DVDSCR => new Quality(28, "DVDSCR", QualitySource.DVD, 480, Modifier.SCREENER); // new
public static Quality REGIONAL => new Quality(29, "REGIONAL", Source.DVD, 480, Modifier.REGIONAL); // new public static Quality REGIONAL => new Quality(29, "REGIONAL", QualitySource.DVD, 480, Modifier.REGIONAL); // new
// SD // SD
public static Quality SDTV => new Quality(1, "SDTV", Source.TV, 480); public static Quality SDTV => new Quality(1, "SDTV", QualitySource.TV, 480);
public static Quality DVD => new Quality(2, "DVD", Source.DVD, 0); public static Quality DVD => new Quality(2, "DVD", QualitySource.DVD, 0);
public static Quality DVDR => new Quality(23, "DVD-R", Source.DVD, 480, Modifier.REMUX); // new public static Quality DVDR => new Quality(23, "DVD-R", QualitySource.DVD, 480, Modifier.REMUX); // new
// HDTV // HDTV
public static Quality HDTV720p => new Quality(4, "HDTV-720p", Source.TV, 720); public static Quality HDTV720p => new Quality(4, "HDTV-720p", QualitySource.TV, 720);
public static Quality HDTV1080p => new Quality(9, "HDTV-1080p", Source.TV, 1080); public static Quality HDTV1080p => new Quality(9, "HDTV-1080p", QualitySource.TV, 1080);
public static Quality HDTV2160p => new Quality(16, "HDTV-2160p", Source.TV, 2160); public static Quality HDTV2160p => new Quality(16, "HDTV-2160p", QualitySource.TV, 2160);
// Web-DL // Web-DL
public static Quality WEBDL480p => new Quality(8, "WEBDL-480p", Source.WEBDL, 480); public static Quality WEBDL480p => new Quality(8, "WEBDL-480p", QualitySource.WEBDL, 480);
public static Quality WEBDL720p => new Quality(5, "WEBDL-720p", Source.WEBDL, 720); public static Quality WEBDL720p => new Quality(5, "WEBDL-720p", QualitySource.WEBDL, 720);
public static Quality WEBDL1080p => new Quality(3, "WEBDL-1080p", Source.WEBDL, 1080); public static Quality WEBDL1080p => new Quality(3, "WEBDL-1080p", QualitySource.WEBDL, 1080);
public static Quality WEBDL2160p => new Quality(18, "WEBDL-2160p", Source.WEBDL, 2160); public static Quality WEBDL2160p => new Quality(18, "WEBDL-2160p", QualitySource.WEBDL, 2160);
// Bluray // Bluray
public static Quality Bluray480p => new Quality(20, "Bluray-480p", Source.BLURAY, 480); // new public static Quality Bluray480p => new Quality(20, "Bluray-480p", QualitySource.BLURAY, 480); // new
public static Quality Bluray576p => new Quality(21, "Bluray-576p", Source.BLURAY, 576); // new public static Quality Bluray576p => new Quality(21, "Bluray-576p", QualitySource.BLURAY, 576); // new
public static Quality Bluray720p => new Quality(6, "Bluray-720p", Source.BLURAY, 720); public static Quality Bluray720p => new Quality(6, "Bluray-720p", QualitySource.BLURAY, 720);
public static Quality Bluray1080p => new Quality(7, "Bluray-1080p", Source.BLURAY, 1080); public static Quality Bluray1080p => new Quality(7, "Bluray-1080p", QualitySource.BLURAY, 1080);
public static Quality Bluray2160p => new Quality(19, "Bluray-2160p", Source.BLURAY, 2160); public static Quality Bluray2160p => new Quality(19, "Bluray-2160p", QualitySource.BLURAY, 2160);
public static Quality Remux1080p => new Quality(30, "Remux-1080p", Source.BLURAY, 1080, Modifier.REMUX); public static Quality Remux1080p => new Quality(30, "Remux-1080p", QualitySource.BLURAY, 1080, Modifier.REMUX);
public static Quality Remux2160p => new Quality(31, "Remux-2160p", Source.BLURAY, 2160, Modifier.REMUX); public static Quality Remux2160p => new Quality(31, "Remux-2160p", QualitySource.BLURAY, 2160, Modifier.REMUX);
public static Quality BRDISK => new Quality(22, "BR-DISK", Source.BLURAY, 1080, Modifier.BRDISK); // new public static Quality BRDISK => new Quality(22, "BR-DISK", QualitySource.BLURAY, 1080, Modifier.BRDISK); // new
// Others // Others
public static Quality RAWHD => new Quality(10, "Raw-HD", Source.TV, 1080, Modifier.RAWHD); public static Quality RAWHD => new Quality(10, "Raw-HD", QualitySource.TV, 1080, Modifier.RAWHD);
public static Quality WEBRip480p => new Quality(12, "WEBRip-480p", Source.WEBRIP, 480); public static Quality WEBRip480p => new Quality(12, "WEBRip-480p", QualitySource.WEBRIP, 480);
public static Quality WEBRip720p => new Quality(14, "WEBRip-720p", Source.WEBRIP, 720); public static Quality WEBRip720p => new Quality(14, "WEBRip-720p", QualitySource.WEBRIP, 720);
public static Quality WEBRip1080p => new Quality(15, "WEBRip-1080p", Source.WEBRIP, 1080); public static Quality WEBRip1080p => new Quality(15, "WEBRip-1080p", QualitySource.WEBRIP, 1080);
public static Quality WEBRip2160p => new Quality(17, "WEBRip-2160p", Source.WEBRIP, 2160); public static Quality WEBRip2160p => new Quality(17, "WEBRip-2160p", QualitySource.WEBRIP, 2160);
static Quality() static Quality()
{ {

View File

@ -8,7 +8,7 @@ public static class QualityFinder
{ {
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(QualityFinder)); private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(QualityFinder));
public static Quality FindBySourceAndResolution(Source source, int resolution, Modifier modifer) public static Quality FindBySourceAndResolution(QualitySource source, int resolution, Modifier modifer)
{ {
// Check for a perfect 3-way match // Check for a perfect 3-way match
var matchingQuality = Quality.All.SingleOrDefault(q => q.Source == source && q.Resolution == resolution && q.Modifier == modifer); var matchingQuality = Quality.All.SingleOrDefault(q => q.Source == source && q.Resolution == resolution && q.Modifier == modifer);

View File

@ -1,6 +1,6 @@
namespace NzbDrone.Core.Qualities namespace NzbDrone.Core.Qualities
{ {
public enum Source public enum QualitySource
{ {
UNKNOWN = 0, UNKNOWN = 0,
CAM, CAM,