From f285a1ab6bf44d8d4176c1936dfbc54bea6b429c Mon Sep 17 00:00:00 2001 From: lhiqwj173 Date: Sat, 19 Oct 2019 20:05:25 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0kodi=E9=80=89=E9=A1=B9?= =?UTF-8?q?=EF=BC=8C=E5=AE=8C=E5=96=84kodi=E5=88=86=E9=9B=86=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.ini | 8 +++--- core.py | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 84 insertions(+), 6 deletions(-) diff --git a/config.ini b/config.ini index 09f3c2b..95e7e8e 100644 --- a/config.ini +++ b/config.ini @@ -4,20 +4,20 @@ failed_output_folder=failed success_output_folder=JAV_output [proxy] -proxy=127.0.0.1:1080 +proxy= timeout=10 retry=3 [Name_Rule] -location_rule=actor+'/'+number +location_rule=number naming_rule=number+'-'+title [update] update_check=1 [media] -media_warehouse=emby -#emby or plex +media_warehouse=kodi +#emby or plex or kodi [directory_capture] directory= diff --git a/core.py b/core.py index 605b8fe..f623c5b 100755 --- a/core.py +++ b/core.py @@ -186,6 +186,14 @@ def smallCoverCheck(): img.save(path + '/' + number + '.png') time.sleep(1) os.remove(path + '/1.jpg') + if option == 'kodi': + DownloadFileWithFilename(cover_small, '1.jpg', path) + img = Image.open(path + '/1.jpg') + w = img.width + h = img.height + img.save(path + '/' + number + '-poster.jpg') + time.sleep(1) + os.remove(path + '/1.jpg') if option == 'plex': DownloadFileWithFilename(cover_small, '1.jpg', path) img = Image.open(path + '/1.jpg') @@ -270,6 +278,11 @@ def imageDownload(filepath): #封面是否下载成功,否则移动到failed print('[+]Image Downloaded!', path + '/' + number + part + '.jpg') else: print('[+]Image Downloaded!', path + '/' + number + '.jpg') + elif option == 'kodi': + if DownloadFileWithFilename(cover, number + '-fanart.jpg', path) == 'failed': + moveFailedFolder() + DownloadFileWithFilename(cover, number + '-fanart.jpg', path) + print('[+]Image Downloaded!', path + '/' + number + '-fanart.jpg') elif option == 'plex': if DownloadFileWithFilename(cover, 'fanart.jpg', path) == 'failed': moveFailedFolder() @@ -373,6 +386,52 @@ def PrintFiles(filepath): print(" " + "https://www.javbus.com/" + number + "", file=code) print("", file=code) print("[+]Writeed! " + path + "/" + number + ".nfo") + elif option == 'kodi': + with open(path + "/" + number + ".nfo", "wt", encoding='UTF-8') as code: + print("", file=code) + print(" " + naming_rule + "", file=code) + print(" ", file=code) + print(" ", file=code) + print(" " + studio + "+", file=code) + print(" " + year + "", file=code) + print(" " + outline + "", file=code) + print(" " + outline + "", file=code) + print(" " + str(runtime).replace(" ", "") + "", file=code) + print(" " + director + "", file=code) + print(" " + number + "-poster.jpg", file=code) + print(" " + number + '-fanart.jpg' + "", file=code) + try: + for key, value in actor_photo.items(): + print(" ", file=code) + print(" " + key + "", file=code) + if not actor_photo == '': # or actor_photo == []: + print(" " + value + "", file=code) + print(" ", file=code) + except: + aaaa = '' + print(" " + studio + "", file=code) + print(" ", file=code) + if cn_sub == '1': + print(" 中文字幕", file=code) + try: + for i in tag: + print(" " + i + "", file=code) + except: + aaaaa = '' + try: + for i in tag: + print(" " + i + "", file=code) + except: + aaaaaaaa = '' + if cn_sub == '1': + print(" 中文字幕", file=code) + print(" " + number + "", file=code) + print(" " + release + "", file=code) + print(" " + cover + "", file=code) + print(" " + "https://www.javbus.com/" + number + "", file=code) + print("", file=code) + print("[+]Writeed! " + path + "/" + number + ".nfo") except IOError as e: print("[-]Write Failed!") print(e) @@ -414,6 +473,22 @@ def cutImage(): w = img.width h = img.height img.save(path + '/' + number + '.png') + elif option == 'kodi': + if imagecut == 1: + try: + img = Image.open(path + '/' + number + '-fanart.jpg') + imgSize = img.size + w = img.width + h = img.height + img2 = img.crop((w / 1.9, 0, w, h)) + img2.save(path + '/' + number + '-poster.jpg') + except: + print('[-]Cover cut failed!') + elif imagecut == 0: + img = Image.open(path + '/' + number + '-fanart.jpg') + w = img.width + h = img.height + img.save(path + '/' + number + '-poster.jpg') def pasteFileToFolder(filepath, path): #文件路径,番号,后缀,要移动至的位置 global houzhui houzhui = str(re.search('[.](AVI|RMVB|WMV|MOV|MP4|MKV|FLV|TS|avi|rmvb|wmv|mov|mp4|mkv|flv|ts)$', filepath).group()) @@ -432,6 +507,8 @@ def renameJpgToBackdrop_copy(): shutil.copy(path + '/poster.png', path + '/thumb.png') if option == 'emby': shutil.copy(path + '/' + number + '.jpg', path + '/Backdrop.jpg') + if option == 'kodi': + shutil.copy(path + '/' + number + '-fanart.jpg', path + '/Backdrop.jpg') def renameBackdropToJpg_copy(): if option == 'plex': shutil.copy(path + '/fanart.jpg', path + '/Backdrop.jpg') @@ -439,6 +516,9 @@ def renameBackdropToJpg_copy(): if option == 'emby': shutil.copy(path + '/Backdrop.jpg', path + '/' + number + '.jpg') print('[+]Image Downloaded!', path + '/' + number + '.jpg') + if option == 'kodi': + shutil.copy(path + '/Backdrop.jpg', path + '/' + number + '-fanart.jpg') + print('[+]Image Downloaded!', path + '/' + number + '-fanart.jpg') def get_part(filepath): try: if re.search('-CD\d+', filepath): @@ -486,8 +566,6 @@ if __name__ == '__main__': if part == '-CD1' or multi_part == 0: smallCoverCheck() imageDownload(filepath) # creatFoder会返回番号路径 - if multi_part == 1: - number += part PrintFiles(filepath) # 打印文件 cutImage() # 裁剪图 renameJpgToBackdrop_copy() From 3b9ab41dccf1c5df8bccdf3f1f18e71d1b0bbb2c Mon Sep 17 00:00:00 2001 From: lhiqwj173 Date: Sat, 19 Oct 2019 23:43:18 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0kodi=E9=80=89=E9=A1=B9?= =?UTF-8?q?=EF=BC=8C=E5=AE=8C=E5=96=84kodi=E5=9B=BE=E7=89=87=E6=98=BE?= =?UTF-8?q?=E7=A4=BA,=E5=AE=8C=E5=96=84kodi=E5=88=86=E9=9B=86=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core.py b/core.py index f623c5b..cc18d90 100755 --- a/core.py +++ b/core.py @@ -492,6 +492,9 @@ def cutImage(): def pasteFileToFolder(filepath, path): #文件路径,番号,后缀,要移动至的位置 global houzhui houzhui = str(re.search('[.](AVI|RMVB|WMV|MOV|MP4|MKV|FLV|TS|avi|rmvb|wmv|mov|mp4|mkv|flv|ts)$', filepath).group()) + if part == '-CD1' and option == 'kodi': + global number + number += part try: os.rename(filepath, path + '/' + number + houzhui) except FileExistsError: @@ -517,8 +520,7 @@ def renameBackdropToJpg_copy(): shutil.copy(path + '/Backdrop.jpg', path + '/' + number + '.jpg') print('[+]Image Downloaded!', path + '/' + number + '.jpg') if option == 'kodi': - shutil.copy(path + '/Backdrop.jpg', path + '/' + number + '-fanart.jpg') - print('[+]Image Downloaded!', path + '/' + number + '-fanart.jpg') + print('跳过分集图片下载') def get_part(filepath): try: if re.search('-CD\d+', filepath): @@ -566,6 +568,8 @@ if __name__ == '__main__': if part == '-CD1' or multi_part == 0: smallCoverCheck() imageDownload(filepath) # creatFoder会返回番号路径 + if multi_part == 1 and option != 'kodi': + number += part PrintFiles(filepath) # 打印文件 cutImage() # 裁剪图 renameJpgToBackdrop_copy() From e082cf336e8521d16d71c786d131991558949750 Mon Sep 17 00:00:00 2001 From: lhiqwj173 Date: Sat, 19 Oct 2019 23:49:52 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0kodi=E9=80=89=E9=A1=B9?= =?UTF-8?q?=EF=BC=8C=E5=AE=8C=E5=96=84kodi=E5=9B=BE=E7=89=87=E6=98=BE?= =?UTF-8?q?=E7=A4=BA,=E5=AE=8C=E5=96=84kodi=E5=88=86=E9=9B=86=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.ini b/config.ini index 95e7e8e..401dfb6 100644 --- a/config.ini +++ b/config.ini @@ -4,12 +4,12 @@ failed_output_folder=failed success_output_folder=JAV_output [proxy] -proxy= +proxy=127.0.0.1:1080 timeout=10 retry=3 [Name_Rule] -location_rule=number +location_rule=actor+'/'+number naming_rule=number+'-'+title [update] From 021830b31b5a63a1a8e6639bf7b8b6339ec251dc Mon Sep 17 00:00:00 2001 From: lhiqwj173 Date: Sat, 19 Oct 2019 23:50:13 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0kodi=E9=80=89=E9=A1=B9?= =?UTF-8?q?=EF=BC=8C=E5=AE=8C=E5=96=84kodi=E5=9B=BE=E7=89=87=E6=98=BE?= =?UTF-8?q?=E7=A4=BA,=E5=AE=8C=E5=96=84kodi=E5=88=86=E9=9B=86=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.ini b/config.ini index 401dfb6..402ac2d 100644 --- a/config.ini +++ b/config.ini @@ -16,7 +16,7 @@ naming_rule=number+'-'+title update_check=1 [media] -media_warehouse=kodi +media_warehouse=emby #emby or plex or kodi [directory_capture]