mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -07:00
Fix PEP8 invalid escape sequences
This commit is contained in:
parent
5ef4bdc1f4
commit
985f004e32
4 changed files with 14 additions and 14 deletions
|
@ -445,8 +445,8 @@ def initialize(section=None):
|
||||||
pass
|
pass
|
||||||
devnull.close()
|
devnull.close()
|
||||||
|
|
||||||
COMPRESSEDCONTAINER = [re.compile('.r\d{2}$', re.I),
|
COMPRESSEDCONTAINER = [re.compile(r'.r\d{2}$', re.I),
|
||||||
re.compile('.part\d+.rar$', re.I),
|
re.compile(r'.part\d+.rar$', re.I),
|
||||||
re.compile('.rar$', re.I)]
|
re.compile('.rar$', re.I)]
|
||||||
COMPRESSEDCONTAINER += [re.compile('{0}$'.format(ext), re.I) for ext in CFG["Extensions"]["compressedExtensions"]]
|
COMPRESSEDCONTAINER += [re.compile('{0}$'.format(ext), re.I) for ext in CFG["Extensions"]["compressedExtensions"]]
|
||||||
MEDIACONTAINER = CFG["Extensions"]["mediaExtensions"]
|
MEDIACONTAINER = CFG["Extensions"]["mediaExtensions"]
|
||||||
|
|
|
@ -123,7 +123,7 @@ def rename_script(dirname):
|
||||||
rename_file = ""
|
rename_file = ""
|
||||||
for dir, dirs, files in os.walk(dirname):
|
for dir, dirs, files in os.walk(dirname):
|
||||||
for file in files:
|
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)
|
rename_file = os.path.join(dir, file)
|
||||||
dirname = dir
|
dirname = dir
|
||||||
break
|
break
|
||||||
|
|
|
@ -132,7 +132,7 @@ def build_commands(file, new_dir, movie_name, bitbucket):
|
||||||
elif check:
|
elif check:
|
||||||
name = ('{0}.cd{1}'.format(movie_name, check.groups()[0]))
|
name = ('{0}.cd{1}'.format(movie_name, check.groups()[0]))
|
||||||
elif core.CONCAT and re.match("(.+)[cC][dD][0-9]", name):
|
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.
|
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'
|
core.VEXTENSION = '-transcoded{ext}'.format(ext=core.VEXTENSION) # adds '-transcoded.ext'
|
||||||
else:
|
else:
|
||||||
|
@ -649,8 +649,8 @@ def rip_iso(item, new_dir, bitbucket):
|
||||||
print_cmd(cmd)
|
print_cmd(cmd)
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=bitbucket)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=bitbucket)
|
||||||
out, err = proc.communicate()
|
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
|
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(".+VIDEO_TS[\\\/]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb]", line)]
|
out.splitlines() if re.match(r".+VIDEO_TS[/\\]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb]", line)]
|
||||||
combined = []
|
combined = []
|
||||||
for n in range(99):
|
for n in range(99):
|
||||||
concat = []
|
concat = []
|
||||||
|
|
|
@ -244,7 +244,7 @@ def is_min_size(input_name, min_size):
|
||||||
|
|
||||||
def is_sample(input_name):
|
def is_sample(input_name):
|
||||||
# Ignore 'sample' in files
|
# 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
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -1014,13 +1014,13 @@ def clean_file_name(filename):
|
||||||
space, but handles decimal numbers in string, for example:
|
space, but handles decimal numbers in string, for example:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
filename = re.sub("(\D)\.(?!\s)(\D)", "\\1 \\2", filename)
|
filename = re.sub(r"(\D)\.(?!\s)(\D)", r"\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(r"(\d)\.(\d{4})", r"\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(r"(\D)\.(?!\s)", r"\1 ", filename)
|
||||||
filename = re.sub("\.(?!\s)(\D)", " \\1", filename)
|
filename = re.sub(r"\.(?!\s)(\D)", r" \1", filename)
|
||||||
filename = filename.replace("_", " ")
|
filename = filename.replace("_", " ")
|
||||||
filename = re.sub("-$", "", filename)
|
filename = re.sub("-$", "", filename)
|
||||||
filename = re.sub("^\[.*\]", "", filename)
|
filename = re.sub(r"^\[.*]", "", filename)
|
||||||
return filename.strip()
|
return filename.strip()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1102,14 +1102,14 @@ def find_imdbid(dir_name, input_name, omdb_api_key):
|
||||||
|
|
||||||
# find imdbid in dirName
|
# find imdbid in dirName
|
||||||
logger.info('Searching folder and file names for imdbID ...')
|
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:
|
if m:
|
||||||
imdbid = m.group(1)
|
imdbid = m.group(1)
|
||||||
logger.info("Found imdbID [{0}]".format(imdbid))
|
logger.info("Found imdbID [{0}]".format(imdbid))
|
||||||
return imdbid
|
return imdbid
|
||||||
if os.path.isdir(dir_name):
|
if os.path.isdir(dir_name):
|
||||||
for file in os.listdir(text_type(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:
|
if m:
|
||||||
imdbid = m.group(1)
|
imdbid = m.group(1)
|
||||||
logger.info("Found imdbID [{0}] via file name".format(imdbid))
|
logger.info("Found imdbID [{0}] via file name".format(imdbid))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue