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()