From e951429ec03a7c05717b1fcd49c3762a9911ac8c Mon Sep 17 00:00:00 2001 From: lededev Date: Sun, 10 Apr 2022 05:39:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91=E6=88=90=E5=8A=9F=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E5=88=B7=E5=B1=8F?= =?UTF-8?q?=EF=BC=8C=E4=BB=85=E5=86=99=E5=85=A5.nfo=E6=97=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=AE=8C=E5=85=A8=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ImageProcessing/__init__.py | 5 +++-- core.py | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ImageProcessing/__init__.py b/ImageProcessing/__init__.py index 9fafc6e..dafbb55 100644 --- a/ImageProcessing/__init__.py +++ b/ImageProcessing/__init__.py @@ -2,6 +2,7 @@ import logging import os import config import importlib +from pathlib import Path from PIL import Image import shutil from ADC_function import file_not_exist_or_empty @@ -72,13 +73,13 @@ def cutImage(imagecut, path, fanart_path, poster_path): else: # 如果等于2/3 img2 = img img2.save(fullpath_poster) - print('[+]Image Cutted! ' + fullpath_poster) + print(f"[+]Image Cutted! {Path(fullpath_poster).name}") except Exception as e: print(e) print('[-]Cover cut failed!') elif imagecut == 0: # 复制封面 shutil.copyfile(fullpath_fanart, fullpath_poster) - print('[+]Image Copyed! ' + fullpath_poster) + print(f"[+]Image Copyed! {Path(fullpath_poster).name}") def face_center(filename, model): diff --git a/core.py b/core.py index 41d40e4..fff055d 100644 --- a/core.py +++ b/core.py @@ -71,11 +71,11 @@ def get_info(json_data): # 返回json里的数据 def small_cover_check(path, filename, cover_small, movie_path): - full_filepath = os.path.join(path, filename) - if config.getInstance().download_only_missing_images() and not file_not_exist_or_empty(full_filepath): + full_filepath = Path(path) / filename + if config.getInstance().download_only_missing_images() and not file_not_exist_or_empty(str(full_filepath)): return download_file_with_filename(cover_small, filename, path, movie_path) - print('[+]Image Downloaded! ' + full_filepath) + print('[+]Image Downloaded! ' + full_filepath.name) def create_folder(json_data): # 创建文件夹 @@ -216,7 +216,7 @@ def extrafanart_download_one_by_one(data, path, filepath): break if file_not_exist_or_empty(jpg_fullpath): return - print('[+]Image Downloaded!', jpg_fullpath) + print('[+]Image Downloaded!', Path(jpg_fullpath).name) j += 1 if conf.debug(): print(f'[!]Extrafanart download one by one mode runtime {time.perf_counter() - tm_start:.3f}s') @@ -247,7 +247,7 @@ def extrafanart_download_threadpool(url_list, save_dir, number): if failed: # 非致命错误,电影不移入失败文件夹,将来可以用模式3补齐 print(f"[-]Failed downloaded {failed}/{len(result)} extrafanart images for [{number}] to '{extrafanart_dir}', you may retry run mode 3 later.") else: - print(f"[+]Successfully downloaded {len(result)} extrafanart to '{extrafanart_dir}'") + print(f"[+]Successfully downloaded {len(result)} extrafanarts.") if conf.debug(): print(f'[!]Extrafanart download ThreadPool mode runtime {time.perf_counter() - tm_start:.3f}s') @@ -276,7 +276,7 @@ def image_download(cover, fanart_path, thumb_path, path, filepath): break if file_not_exist_or_empty(full_filepath): return - print('[+]Image Downloaded!', full_filepath) + print('[+]Image Downloaded!', Path(full_filepath).name) shutil.copyfile(full_filepath, os.path.join(path, thumb_path)) @@ -529,10 +529,10 @@ def paste_file_to_folder(filepath, path, multi_part, number, part, leak_word, c_ sub_targetpath = Path(path) / f"{number}{leak_word}{c_word}{hack_word}{''.join(subfile.suffixes)}" if link_mode not in (1, 2): shutil.move(str(subfile), str(sub_targetpath)) - print(f"[+]Sub Moved! '{sub_targetpath.name}'") + print(f"[+]Sub Moved! {sub_targetpath.name}") else: shutil.copyfile(str(subfile), str(sub_targetpath)) - print(f"[+]Sub Copied! '{sub_targetpath.name}'") + print(f"[+]Sub Copied! {sub_targetpath.name}") return except FileExistsError as fee: @@ -580,10 +580,10 @@ def paste_file_to_folder_mode2(filepath, path, multi_part, number, part, leak_wo sub_targetpath = Path(path) / f"{number}{leak_word}{c_word}{hack_word}{''.join(subfile.suffixes)}" if link_mode not in (1, 2): shutil.move(str(subfile), str(sub_targetpath)) - print(f"[+]Sub Moved! '{sub_targetpath.name}'") + print(f"[+]Sub Moved! {sub_targetpath.name}") else: shutil.copyfile(str(subfile), str(sub_targetpath)) - print(f"[+]Sub Copied! '{sub_targetpath.name}'") + print(f"[+]Sub Copied! {sub_targetpath.name}") return except FileExistsError as fee: print(f'[-]FileExistsError: {fee}')