summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/common/packagetools.py55
1 files changed, 28 insertions, 27 deletions
diff --git a/module/common/packagetools.py b/module/common/packagetools.py
index 578148b50..d930157e1 100644
--- a/module/common/packagetools.py
+++ b/module/common/packagetools.py
@@ -5,18 +5,19 @@ import re
from urlparse import urlparse
-endings = ("3gp", "7zip", "7z", "abr", "ac3", "aiff", "aifc", "aif", "ai", "au",
- "avi", "bin", "bz2", "cbr", "cbz", "ccf", "cue", "cvd", "chm", "dta",
- "deb", "divx", "djvu", "dlc", "dmg", "doc", "docx", "dot", "eps", "exe",
- "ff", "flv", "f4v", "gsd", "gif", "gz", "iwd", "iso", "ipsw", "java",
- "jar", "jpg", "jpeg", "jdeatme", "load", "mws", "mw", "m4v", "m4a",
- "mkv", "mp2", "mp3", "mp4", "mov", "movie", "mpeg", "mpe", "mpg", "msi",
- "msu", "msp", "nfo", "npk", "oga", "ogg", "ogv", "otrkey", "pkg", "png",
- "pdf", "pptx", "ppt", "pps", "ppz", "pot", "psd", "qt", "rmvb", "rm",
- "rar", "ram", "ra", "rev", "rnd", "r\d+", "rpm", "run", "rsdf", "rtf",
- "sh(!?tml)", "srt", "snd", "sfv", "swf", "tar", "tif", "tiff", "ts",
- "txt", "viv", "vivo", "vob", "wav", "wmv", "xla", "xls", "xpi", "zeno",
- "zip", "z\d+", "_[_a-z]{2}", "\d+$")
+endings = ("jdeatme", "3gp", "7zip", "7z", "abr", "ac3", "aiff", "aifc", "aif", "ai",
+ "au", "avi", "apk", "bin", "bmp", "bat", "bz2", "cbr", "cbz", "ccf", "chm",
+ "cr2", "cso", "cue", "cvd", "dta", "deb", "divx", "djvu", "dlc", "dmg", "doc",
+ "docx", "dot", "eps", "epub", "exe", "ff", "flv", "flac", "f4v", "gsd", "gif",
+ "gpg", "gz", "iwd", "idx", "iso", "ipa", "ipsw", "java", "jar", "jpe?g", "load",
+ "m2ts", "m4v", "m4a", "md5", "mkv", "mp2", "mp3", "mp4", "mobi", "mov", "movie",
+ "mpeg", "mpe", "mpg", "mpq", "msi", "msu", "msp", "mv", "mws", "nfo", "npk", "oga",
+ "ogg", "ogv", "otrkey", "par2", "pkg", "png", "pdf", "pptx?", "ppsx?", "ppz", "pot",
+ "psd", "qt", "rmvb", "rm", "rar", "ram", "ra", "rev", "rnd", "rpm", "run", "rsdf",
+ "reg", "rtf", "shnf", "sh(?!tml)", "ssa", "smi", "sub", "srt", "snd", "sfv", "sfx",
+ "swf", "swc", "tar\.(gz|bz2|xz)", "tar", "tgz", "tiff?", "ts", "txt", "viv", "vivo",
+ "vob", "vtt", "webm", "wav", "wmv", "wma", "xla", "xls", "xpi", "zeno", "zip",
+ "[r-z]\d{2}", "_[_a-z]{2}", "\d{3,4}(?=\?|$|\"|\r|\n)")
rarPats = [re.compile(r'(.*)(\.|_|-)pa?r?t?\.?\d+.(rar|exe)$', re.I),
re.compile(r'(.*)(\.|_|-)part\.?[0]*[1].(rar|exe)$', re.I),
@@ -48,9 +49,9 @@ def matchFirst(string, *args):
""" matches against list of regexp and returns first match """
for patternlist in args:
for pattern in patternlist:
- r = pattern.search(string)
- if r is not None:
- name = r.group(1)
+ m = pattern.search(string)
+ if m is not None:
+ name = m.group(1)
return name
return string
@@ -96,19 +97,19 @@ def parseNames(files):
patternMatch = True
# xtremsplit pattern
- r = pat4.search(name)
- if r is not None:
- name = r.group(1)
+ m = pat4.search(name)
+ if m is not None:
+ name = m.group(1)
# remove part and cd pattern
- r = pat1.search(name)
- if r is not None:
- name = name.replace(r.group(0), "")
+ m = pat1.search(name)
+ if m is not None:
+ name = name.replace(m.group(0), "")
patternMatch = True
- r = pat2.search(name)
- if r is not None:
- name = name.replace(r.group(0), "")
+ m = pat2.search(name)
+ if m is not None:
+ name = name.replace(m.group(0), "")
patternMatch = True
# additional checks if extension pattern matched
@@ -123,9 +124,9 @@ def parseNames(files):
name = name[:-length]
# remove endings like . _ -
- r = pat3.search(name)
- if r is not None:
- name = r.group(1)
+ m = pat3.search(name)
+ if m is not None:
+ name = m.group(1)
# replace . and _ with space
name = name.replace(".", " ")