diff --git a/AV_Data_Capture.py b/AV_Data_Capture.py index 1523bfe..fc081d1 100755 --- a/AV_Data_Capture.py +++ b/AV_Data_Capture.py @@ -132,15 +132,17 @@ def movie_lists(root, conf): main_mode = conf.main_mode() debug = conf.debug() nfo_skip_days = conf.nfo_skip_days() + soft_link = conf.soft_link() total = [] file_type = conf.media_type().upper().split(",") trailerRE = re.compile(r'-trailer\.', re.IGNORECASE) - try: - failed_list = open(os.path.join(conf.failed_folder(), 'failed_list.txt'), - 'r', encoding='utf-8').read().splitlines() - except: - failed_list = [] - pass + failed_list = [] + if main_mode == 3 or soft_link: + try: + failed_list = open(os.path.join(conf.failed_folder(), 'failed_list.txt'), + 'r', encoding='utf-8').read().splitlines() + except: + pass for current_dir, subdirs, files in os.walk(root, topdown=False): if current_dir in escape_folder: continue @@ -159,7 +161,7 @@ def movie_lists(root, conf): continue if (main_mode == 3 or not is_link(absf)) and not trailerRE.search(f): total.append(absf) - if nfo_skip_days <= 0 or not conf.soft_link() or main_mode == 3: + if nfo_skip_days <= 0 or not soft_link or main_mode == 3: return total # 软连接方式,已经成功削刮的也需要从成功目录中检查.nfo更新天数,跳过N天内更新过的 skip_numbers = set() diff --git a/core.py b/core.py index 4951fab..fb6fccd 100755 --- a/core.py +++ b/core.py @@ -28,13 +28,18 @@ def moveFailedFolder(filepath, conf): # 模式3或软连接,改为维护一个失败列表,启动扫描时加载用于排除该路径,以免反复处理 # 原先的创建软连接到失败目录,并不直观,不方便找到失败文件位置,不如直接记录该文件路径 if conf.main_mode() == 3 or soft_link: - open(os.path.join(failed_folder, 'failed_list.txt'), 'a', encoding='utf-8' - ).write(f'{filepath}\n').close() - print('[-]Add to failed list file') + with open(os.path.join(failed_folder, 'failed_list.txt'), 'a', encoding='utf-8') as flt: + flt.write(f'{filepath}\n') + flt.close() + print('[-]Add to failed list file, see failed_list.txt') elif conf.failed_move() and not soft_link: - file_name = os.path.basename(filepath) - print('[-]Move to Failed output folder') - shutil.move(filepath, os.path.join(failed_folder, file_name)) + failed_name = os.path.join(failed_folder, os.path.basename(filepath)) + print('[-]Move to Failed output folder, see where_was_i_before_being_moved.txt') + with open(os.path.join(failed_folder, 'where_was_i_before_being_moved.txt'), 'a', + encoding='utf-8') as wwibbmt: + wwibbmt.write(f'FROM[{filepath}]TO[{failed_name}]\n') + wwibbmt.close() + shutil.move(filepath, failed_name) def get_info(json_data): # 返回json里的数据 @@ -418,7 +423,7 @@ def paste_file_to_folder(filepath, path, number, leak_word, c_word, conf: config print('[-]Error! Please run as administrator!') return except OSError as oserr: - print('[-]OS Error errno ' + oserr.errno) + print(f'[-]OS Error errno {oserr.errno}') return @@ -448,7 +453,7 @@ def paste_file_to_folder_mode2(filepath, path, multi_part, number, part, leak_wo print('[-]Error! Please run as administrator!') return except OSError as oserr: - print('[-]OS Error errno ' + oserr.errno) + print(f'[-]OS Error errno {oserr.errno}') return def get_part(filepath, conf):