Skip to content

Commit

Permalink
Speed up by skipping scan in escape folders
Browse files Browse the repository at this point in the history
Try again using older Python APIs. Let me know the detailed error if this doesn't work.
  • Loading branch information
mtxcab authored Mar 28, 2020
1 parent ccee4eb commit ea95bed
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions AV_Data_Capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,19 @@ def argparse_get_file():
else:
return args.file

def movie_lists(escape_folder):
escape_folder = re.split('[,,]', escape_folder)
def movie_lists(root, escape_folder):
for folder in escape_folder:
if folder in root:
return []
total = []
file_type = ['.mp4', '.avi', '.rmvb', '.wmv', '.mov', '.mkv', '.flv', '.ts', '.webm', '.MP4', '.AVI', '.RMVB', '.WMV','.MOV', '.MKV', '.FLV', '.TS', '.WEBM', ]
file_root = os.getcwd()
for root, dirs, files in os.walk(file_root):
flag_escape = 0
for folder in escape_folder:
if folder in root:
flag_escape = 1
break
if flag_escape == 1:
continue
for f in files:
if os.path.splitext(f)[1] in file_type:
path = os.path.join(root, f)
path = path.replace(file_root, '.')
total.append(path)
dirs = os.listdir(root)
for entry in dirs:
f = os.path.join(root, entry)
if os.path.isdir(f):
total += movie_lists(f, escape_folder)
elif os.path.splitext(f)[1] in file_type:
total.append(f)
return total


Expand Down Expand Up @@ -103,14 +98,15 @@ def getNumber(filepath,absolute_path = False):
success_folder = config['common']['success_output_folder']
failed_folder = config['common']['failed_output_folder'] # 失败输出目录
escape_folder = config['escape']['folders'] # 多级目录刮削需要排除的目录
escape_folder = re.split('[,,]', escape_folder)
print('[*]================== AV Data Capture ===================')
print('[*] Version ' + version)
print('[*]======================================================')

UpdateCheck(version)
CreatFailedFolder(failed_folder)
os.chdir(os.getcwd())
movie_list = movie_lists(escape_folder)
movie_list = movie_lists('.', escape_folder)

#========== 野鸡番号拖动 ==========
number_argparse=argparse_get_file()
Expand Down Expand Up @@ -160,4 +156,4 @@ def getNumber(filepath,absolute_path = False):
CEF(success_folder)
CEF(failed_folder)
print("[+]All finished!!!")
input("[+][+]Press enter key exit, you can check the error messge before you exit.")
input("[+][+]Press enter key exit, you can check the error messge before you exit.")

0 comments on commit ea95bed

Please sign in to comment.