From 13844b9934615e61ebdb33662da5624b63b23b45 Mon Sep 17 00:00:00 2001 From: yoshiko2 Date: Sat, 2 Jan 2021 00:31:55 +0800 Subject: [PATCH] Change the way to reading movie types and sub types to config file --- AV_Data_Capture.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/AV_Data_Capture.py b/AV_Data_Capture.py index e1b2692..e937ee0 100755 --- a/AV_Data_Capture.py +++ b/AV_Data_Capture.py @@ -39,19 +39,18 @@ def argparse_function(ver: str) -> [str, str, bool]: return args.file, args.config, args.number, args.autoexit -def movie_lists(root, escape_folder): +def movie_lists(root, escape_folder, c: config.Config): 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', '.iso', '.ISO'] + file_type = c.media_type().upper() 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: + elif os.path.splitext(f)[1].upper() in file_type: total.append(f) return total