Private GIT

Skip to content
Snippets Groups Projects
Commit 8c5d88c9 authored by miigotu's avatar miigotu
Browse files

Adjust name parser to add amazon and amzn, and make the lowest result for...

Adjust name parser to add amazon and amzn, and make the lowest result for netflix, amazon, and itunes be HDWEBDL - Replaces #4439
parent 643b98eb
No related branches found
No related tags found
No related merge requests found
......@@ -332,31 +332,31 @@ class Quality(object):
return Quality.UNKNOWN if result is None else result
# Is it UHD?
if ep.vres in [2160, 4320] and ep.scan == 'p':
if ep.vres in {2160, 4320} and ep.scan == 'p':
# BluRay
full_res = (ep.vres == 4320)
if ep.avc and ep.bluray:
result = Quality.UHD_4K_BLURAY if not full_res else Quality.UHD_8K_BLURAY
result = (Quality.UHD_4K_BLURAY, Quality.UHD_8K_BLURAY)[full_res]
# WEB-DL
elif ep.itunes or ep.amazon or ep.netflix or ep.web:
result = Quality.UHD_4K_WEBDL if not full_res else Quality.UHD_8K_WEBDL
elif (ep.avc and (ep.itunes or ep.amazon or ep.netflix)) or ep.web:
result = (Quality.UHD_4K_WEBDL, Quality.UHD_8K_WEBDL)[full_res]
# HDTV
elif ep.avc and ep.tv == 'hd':
result = Quality.UHD_4K_TV if not full_res else Quality.UHD_8K_TV
result = (Quality.UHD_4K_TV, Quality.UHD_8K_TV)[full_res]
# Is it HD?
elif ep.vres in [1080, 720]:
elif ep.vres in {1080, 720}:
if ep.scan == 'p':
# BluRay
full_res = (ep.vres == 1080)
if ep.avc and (ep.bluray or ep.hddvd):
result = Quality.FULLHDBLURAY if full_res else Quality.HDBLURAY
result = (Quality.HDBLURAY, Quality.FULLHDBLURAY)[full_res]
# WEB-DL
elif ep.itunes or ep.amazon or ep.netflix or ep.web:
result = Quality.FULLHDWEBDL if full_res else Quality.HDWEBDL
elif (ep.avc and (ep.itunes or ep.amazon or ep.netflix)) or ep.web:
result = (Quality.HDWEBDL, Quality.FULLHDWEBDL)[full_res]
# HDTV
elif ep.avc and ep.tv == 'hd':
result = Quality.FULLHDTV if full_res else Quality.HDTV #1080 HDTV h264
result = (Quality.HDTV, Quality.FULLHDTV)[full_res] # 1080 HDTV h264
# MPEG2 encoded
elif all([ep.vres == 1080, ep.tv == 'hd', ep.mpeg]):
result = Quality.RAWHDTV
......@@ -364,6 +364,8 @@ class Quality(object):
result = Quality.RAWHDTV
elif (ep.res == '1080i') and ep.tv == 'hd' and (ep.mpeg or (ep.raw and ep.avc_non_free)):
result = Quality.RAWHDTV
elif not ep.vres and ep.netflix or ep.amazon or ep.itunes:
result = Quality.HDWEBDL
elif ep.hrws:
result = Quality.HDTV
......@@ -382,7 +384,6 @@ class Quality(object):
# SD TV/HD TV
result = Quality.SDTV
return Quality.UNKNOWN if result is None else result
@staticmethod
......
......@@ -16,9 +16,9 @@ dvd = re.compile(r'(?P<hd>hd)?dvd(?P<rip>rip|mux)?', re.I)
web = re.compile(r'(web(?P<type>rip|mux|hd|.?dl|\b))', re.I)
bluray = re.compile(r'(blue?-?ray|b[rd](?:rip|mux))', re.I)
sat = re.compile(r'(dsr|satrip)', re.I)
itunes = re.compile(r'itunes(hd|uhd)', re.I)
netflix = re.compile(r'netflix(hd|uhd)', re.I)
amazon = re.compile(r'amazon(hd|uhd)', re.I)
itunes = re.compile(r'itunes(hd|uhd)?', re.I)
netflix = re.compile(r'netflix(hd|uhd)?', re.I)
amazon = re.compile(r'(amzn|amazon)(hd|uhd)?', re.I)
# Codecs
avc = re.compile(r'([xh].?26[45])', re.I)
......
......@@ -98,7 +98,13 @@ class QualityStringTests(unittest.TestCase):
"Test Show S01E02 720p WEB-DL AAC2 0 H 264-GROUP",
"Test_Show.S01E02_720p_WEB-DL_AAC2.0_H264-GROUP",
"Test.Show.S01E02.720p.WEB-DL.AAC2.0.H264-GROUP",
"Test.Show.S01E02.720p.iTunes.Rip.H264.AAC-GROUP"
"Test.Show.S01E02.720p.iTunes.Rip.H264.AAC-GROUP",
"Test.Show.S01E02.Show.Name.AMZN.WEB-DL.x264",
"Test.Show.S01E02.Show.Name.Amazon.WEB-DL.x264",
"Test.Show.S01E02.Show.Name.Itunes.WEB-DL.x264",
"Test.Show.S01E02.Show.Name.720p.AMZN.WEB-DL.x264",
"Test.Show.S01E02.Show.Name.720p.Amazon.WEB-DL.x264",
"Test.Show.S01E02.Show.Name.720p.Itunes.WEB-DL.x264"
],
'full_hd_web_dl': [
"Test.Show.S01E02.1080p.WEB-DL-GROUP",
......@@ -107,7 +113,11 @@ class QualityStringTests(unittest.TestCase):
"Test.Show.S01E02.WEBRip.1080p.H264.AAC.2.0-GROUP",
"Test.Show.S01E02.1080p.iTunes.H.264.AAC-GROUP",
"Test Show S01E02 1080p iTunes H 264 AAC-GROUP",
"Test_Show_S01E02_1080p_iTunes_H_264_AAC-GROUP"
"Test_Show_S01E02_1080p_iTunes_H_264_AAC-GROUP",
"Test.Show.S01E02.Show.Name.1080p.AMZN.WEB-DL.x264",
"Test.Show.S01E02.Show.Name.1080p.Amazon.WEB-DL.x264",
"Test.Show.S01E02.Show.Name.1080p.ItunesHD.WEB-DL.x264"
],
'hd_bluray': [
"Test.Show.S01E02.720p.BluRay.x264-GROUP",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment