双重异常有时会生成两条相同记录,用集合去重写回,并利用集合提升查询速度
This commit is contained in:
@@ -143,11 +143,17 @@ def movie_lists(root, conf, regexstr):
|
|||||||
cliRE = re.compile(regexstr, re.IGNORECASE)
|
cliRE = re.compile(regexstr, re.IGNORECASE)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
failed_list = []
|
failed_set = set()
|
||||||
if main_mode == 3 or soft_link:
|
if main_mode == 3 or soft_link:
|
||||||
try:
|
try:
|
||||||
failed_list = open(os.path.join(conf.failed_folder(), 'failed_list.txt'),
|
with open(os.path.join(conf.failed_folder(), 'failed_list.txt'), 'r', encoding='utf-8') as flt:
|
||||||
'r', encoding='utf-8').read().splitlines()
|
flist = flt.read().splitlines()
|
||||||
|
failed_set = set(flist)
|
||||||
|
flt.close()
|
||||||
|
if len(flist) != len(failed_set):
|
||||||
|
with open(os.path.join(conf.failed_folder(), 'failed_list.txt'), 'w', encoding='utf-8') as flt:
|
||||||
|
flt.writelines([line + '\n' for line in failed_set])
|
||||||
|
flt.close()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
for current_dir, subdirs, files in os.walk(root, topdown=False):
|
for current_dir, subdirs, files in os.walk(root, topdown=False):
|
||||||
@@ -158,7 +164,7 @@ def movie_lists(root, conf, regexstr):
|
|||||||
if not os.path.splitext(full_name)[1].upper() in file_type:
|
if not os.path.splitext(full_name)[1].upper() in file_type:
|
||||||
continue
|
continue
|
||||||
absf = os.path.abspath(full_name)
|
absf = os.path.abspath(full_name)
|
||||||
if absf in failed_list:
|
if absf in failed_set:
|
||||||
if debug:
|
if debug:
|
||||||
print('[!]Skip failed file:', absf)
|
print('[!]Skip failed file:', absf)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user