Fix PEP8 invalid escape sequences

This commit is contained in:
Labrys of Knossos 2018-12-26 11:31:17 -05:00 committed by Lizband
commit 985f004e32
4 changed files with 14 additions and 14 deletions

View file

@ -445,8 +445,8 @@ def initialize(section=None):
pass
devnull.close()
COMPRESSEDCONTAINER = [re.compile('.r\d{2}$', re.I),
re.compile('.part\d+.rar$', re.I),
COMPRESSEDCONTAINER = [re.compile(r'.r\d{2}$', re.I),
re.compile(r'.part\d+.rar$', re.I),
re.compile('.rar$', re.I)]
COMPRESSEDCONTAINER += [re.compile('{0}$'.format(ext), re.I) for ext in CFG["Extensions"]["compressedExtensions"]]
MEDIACONTAINER = CFG["Extensions"]["mediaExtensions"]

View file

@ -123,7 +123,7 @@ def rename_script(dirname):
rename_file = ""
for dir, dirs, files in os.walk(dirname):
for file in files:
if re.search('(rename\S*\.(sh|bat)$)', file, re.IGNORECASE):
if re.search(r'(rename\S*\.(sh|bat)$)', file, re.IGNORECASE):
rename_file = os.path.join(dir, file)
dirname = dir
break

View file

@ -132,7 +132,7 @@ def build_commands(file, new_dir, movie_name, bitbucket):
elif check:
name = ('{0}.cd{1}'.format(movie_name, check.groups()[0]))
elif core.CONCAT and re.match("(.+)[cC][dD][0-9]", name):
name = re.sub("([\ \.\-\_\=\:]+[cC][dD][0-9])", "", name)
name = re.sub('([ ._=:-]+[cC][dD][0-9])', "", name)
if ext == core.VEXTENSION and new_dir == dir: # we need to change the name to prevent overwriting itself.
core.VEXTENSION = '-transcoded{ext}'.format(ext=core.VEXTENSION) # adds '-transcoded.ext'
else:
@ -649,8 +649,8 @@ def rip_iso(item, new_dir, bitbucket):
print_cmd(cmd)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=bitbucket)
out, err = proc.communicate()
file_list = [re.match(".+(VIDEO_TS[\\\/]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb])", line).groups()[0] for line in
out.splitlines() if re.match(".+VIDEO_TS[\\\/]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb]", line)]
file_list = [re.match(r".+(VIDEO_TS[/\\]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb])", line).groups()[0] for line in
out.splitlines() if re.match(r".+VIDEO_TS[/\\]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb]", line)]
combined = []
for n in range(99):
concat = []

View file

@ -244,7 +244,7 @@ def is_min_size(input_name, min_size):
def is_sample(input_name):
# Ignore 'sample' in files
if re.search('(^|[\W_])sample\d*[\W_]', input_name.lower()):
if re.search('(^|[\\W_])sample\\d*[\\W_]', input_name.lower()):
return True
@ -1014,13 +1014,13 @@ def clean_file_name(filename):
space, but handles decimal numbers in string, for example:
"""
filename = re.sub("(\D)\.(?!\s)(\D)", "\\1 \\2", filename)
filename = re.sub("(\d)\.(\d{4})", "\\1 \\2", filename) # if it ends in a year then don't keep the dot
filename = re.sub("(\D)\.(?!\s)", "\\1 ", filename)
filename = re.sub("\.(?!\s)(\D)", " \\1", filename)
filename = re.sub(r"(\D)\.(?!\s)(\D)", r"\1 \2", filename)
filename = re.sub(r"(\d)\.(\d{4})", r"\1 \2", filename) # if it ends in a year then don't keep the dot
filename = re.sub(r"(\D)\.(?!\s)", r"\1 ", filename)
filename = re.sub(r"\.(?!\s)(\D)", r" \1", filename)
filename = filename.replace("_", " ")
filename = re.sub("-$", "", filename)
filename = re.sub("^\[.*\]", "", filename)
filename = re.sub(r"^\[.*]", "", filename)
return filename.strip()
@ -1102,14 +1102,14 @@ def find_imdbid(dir_name, input_name, omdb_api_key):
# find imdbid in dirName
logger.info('Searching folder and file names for imdbID ...')
m = re.search('(tt\d{7})', dir_name + input_name)
m = re.search(r'(tt\d{7})', dir_name + input_name)
if m:
imdbid = m.group(1)
logger.info("Found imdbID [{0}]".format(imdbid))
return imdbid
if os.path.isdir(dir_name):
for file in os.listdir(text_type(dir_name)):
m = re.search('(tt\d{7})', file)
m = re.search(r'(tt\d{7})', file)
if m:
imdbid = m.group(1)
logger.info("Found imdbID [{0}] via file name".format(imdbid))