Skip to content

Instantly share code, notes, and snippets.

@wrboyce
Created February 25, 2011 11:41
Show Gist options
  • Save wrboyce/843687 to your computer and use it in GitHub Desktop.
Save wrboyce/843687 to your computer and use it in GitHub Desktop.
diff --git a/sickbeard/common.py b/sickbeard/common.py
index e90cc2b..7df40e5 100644
--- a/sickbeard/common.py
+++ b/sickbeard/common.py
@@ -124,17 +124,17 @@ class Quality:
checkName = lambda list, func: func([re.search(x, name, re.I) for x in list])
- if checkName(["pdtv.xvid", "hdtv.xvid", "dsr.xvid"], any) and not checkName(["720p"], all):
+ if checkName(["pdtv", "hdtv", "dsr"], any) and not checkName(["720p"], all):^M
return Quality.SDTV
- elif checkName(["dvdrip.xvid", "bdrip.xvid", "dvdrip.divx", "dvdrip.ws.xvid"], any) and not checkName(["720p"], all):
+ elif checkName(["dvdrip", "bdrip"], any) and not checkName(["720p"], all):^M
return Quality.SDDVD
- elif checkName(["720p", "hdtv", "x264"], all) or checkName(["hr.ws.pdtv.x264"], any):
+ elif checkName(["hdtv", "hr.ws.pdtv"], any):^M
return Quality.HDTV
- elif checkName(["720p", "web.dl"], all) or checkName(["720p", "itunes", "h.?264"], all):
+ elif checkName(["web.dl", "itunes"], any) and checkName(["720p", "1080p"], any):^M
return Quality.HDWEBDL
- elif checkName(["720p", "bluray", "x264"], all):
+ elif checkName(["720p", "bluray"], all):^M
return Quality.HDBLURAY
- elif checkName(["1080p", "bluray", "x264"], all):
+ elif checkName(["1080p", "bluray"], all):^M
return Quality.FULLHDBLURAY
else:
return Quality.UNKNOWN
@staticmethod
def nameQuality(name):
name = os.path.basename(name)
# if we have our exact text then assume we put it there
for x in Quality.qualityStrings:
if x == Quality.UNKNOWN:
continue
regex = '\W'+Quality.qualityStrings[x].replace(' ','\W')+'\W'
regex_match = re.search(regex, name, re.I)
if regex_match:
return x
checkName = lambda list, func: func([re.search(x, name, re.I) for x in list])
if checkName(["pdtv", "hdtv", "dsr"], any) and not checkName(["720p"], all):
return Quality.SDTV
elif checkName(["dvdrip", "bdrip"], any) and not checkName(["720p"], all):
return Quality.SDDVD
elif checkName(["hdtv", "hr.ws.pdtv"], any):
return Quality.HDTV
elif checkName(["web.dl", "itunes"], any) and checkName(["720p", "1080p"], any):
return Quality.HDWEBDL
elif checkName(["720p", "bluray"], all):
return Quality.HDBLURAY
elif checkName(["1080p", "bluray"], all):
return Quality.FULLHDBLURAY
else:
return Quality.UNKNOWN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment