From 1e407ef96209fca424e8e5adc6c6c1175edcd379 Mon Sep 17 00:00:00 2001 From: mo_yy <54110819+moyy996@users.noreply.github.com> Date: Mon, 19 Aug 2019 00:50:43 +0800 Subject: [PATCH 1/3] Update core.py --- core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/core.py b/core.py index 7fd5f6b..30f1258 100755 --- a/core.py +++ b/core.py @@ -40,6 +40,7 @@ cover='' imagecut='' tag=[] cn_sub='' +multi_part=0 path='' houzhui='' website='' From fd05706636dcd836cc35cfcb7bf748484308f9d7 Mon Sep 17 00:00:00 2001 From: mo_yy <54110819+moyy996@users.noreply.github.com> Date: Mon, 19 Aug 2019 10:18:32 +0800 Subject: [PATCH 2/3] Update core.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持分集 --- core.py | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/core.py b/core.py index 30f1258..a18de08 100755 --- a/core.py +++ b/core.py @@ -41,6 +41,7 @@ imagecut='' tag=[] cn_sub='' multi_part=0 +part='' path='' houzhui='' website='' @@ -273,7 +274,13 @@ def imageDownload(filepath): #封面是否下载成功,否则移动到failed if DownloadFileWithFilename(cover, number + '.jpg', path) == 'failed': moveFailedFolder() DownloadFileWithFilename(cover, number + '.jpg', path) - print('[+]Image Downloaded!', path + '/' + number + '.jpg') + if multi_part == 1: + old_name = os.path.join(path, number + '.jpg') + new_name = os.path.join(path, number + part + '.jpg') + os.rename(old_name, new_name) + print('[+]Image Downloaded!', path + '/' + number + part + '.jpg') + else: + print('[+]Image Downloaded!', path + '/' + number + '.jpg') elif option == 'plex': if DownloadFileWithFilename(cover, 'fanart.jpg', path) == 'failed': moveFailedFolder() @@ -448,9 +455,22 @@ def renameJpgToBackdrop_copy(): if option == 'emby': shutil.copy(path + '/' + number + '.jpg', path + '/Backdrop.jpg') +def renameBackdropToJpg_copy(): + if option == 'plex': + shutil.copy(path + '/fanart.jpg', path + '/Backdrop.jpg') + shutil.copy(path + '/poster.png', path + '/thumb.png') + if option == 'emby': + shutil.copy(path + '/Backdrop.jpg', path + '/' + number + '.jpg') + print('[+]Image Downloaded!', path + '/' + number + '.jpg') +def get_part(filepath): + if re.search('-CD\d+', filepath): + return re.findall('-CD\d+', filepath)[0] if __name__ == '__main__': filepath=argparse_get_file()[0] #影片的路径 + if '-CD' in filepath or '-cd' in filepath: + multi_part = 1 + part = get_part(filepath) if '-c.' in filepath or '-C.' in filepath or '中文' in filepath or '字幕' in filepath: cn_sub='1' @@ -467,11 +487,17 @@ if __name__ == '__main__': getDataFromJSON(number) # 定义番号 creatFolder() # 创建文件夹 if program_mode == '1': - imageDownload(filepath) # creatFoder会返回番号路径 - PrintFiles(filepath) # 打印文件 - smallCoverCheck() - cutImage() # 裁剪图 + if part == '-CD1' or multi_part == 0: + imageDownload(filepath) # creatFoder会返回番号路径 + if multi_part == 1: + number += part + PrintFiles(filepath) # 打印文件 + smallCoverCheck() + cutImage() # 裁剪图 + renameJpgToBackdrop_copy() + else: + number += part + renameBackdropToJpg_copy() pasteFileToFolder(filepath, path) # 移动文件 - renameJpgToBackdrop_copy() elif program_mode == '2': pasteFileToFolder_mode2(filepath, path) # 移动文件 From b438312c9765890fa4532d54d385421b1a2839f1 Mon Sep 17 00:00:00 2001 From: mo_yy <54110819+moyy996@users.noreply.github.com> Date: Mon, 19 Aug 2019 12:23:45 +0800 Subject: [PATCH 3/3] Update core.py --- core.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core.py b/core.py index a18de08..9d26f78 100755 --- a/core.py +++ b/core.py @@ -463,8 +463,12 @@ def renameBackdropToJpg_copy(): shutil.copy(path + '/Backdrop.jpg', path + '/' + number + '.jpg') print('[+]Image Downloaded!', path + '/' + number + '.jpg') def get_part(filepath): - if re.search('-CD\d+', filepath): - return re.findall('-CD\d+', filepath)[0] + try: + if re.search('-CD\d+', filepath): + return re.findall('-CD\d+', filepath)[0] + except: + print("[-]failed!Please rename the filename again!") + moveFailedFolder() if __name__ == '__main__': filepath=argparse_get_file()[0] #影片的路径