更新内容
1.从DB读取的path里有escape文字时自动替换成空。config.ini里追加escape文字列
2.封面下载成功,但无法读取时使用dummy封面分类
3.生产文件夹时去除中文文字列
This commit is contained in:
ninjadogz 2019-10-22 20:08:28 +09:00
parent 9fb813ae97
commit 72fafef059
4 changed files with 22 additions and 4 deletions

BIN
1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

BIN
1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

View File

@ -4,7 +4,8 @@ failed_output_folder=failed
success_output_folder=JAV_output
[proxy]
proxy=127.0.0.1:1080
proxy=10.168.1.254:3128
#proxy=127.0.0.1:1080
timeout=10
retry=3
@ -21,3 +22,6 @@ media_warehouse=emby
[directory_capture]
directory=
[escape]
literals=\()

20
core.py
View File

@ -54,6 +54,12 @@ failed_folder = Config['common']['failed_output_folder']
success_folder = Config['common']['success_output_folder']
#=====================本地文件处理===========================
def escapePath(path): # Remove escape literals
escapeLiterals = Config['escape']['literals']
backslash = '\\'
for literal in escapeLiterals:
path = path.replace(backslash+literal,'')
return path
def moveFailedFolder():
global filepath
print('[-]Move to Failed output folder')
@ -180,7 +186,10 @@ def smallCoverCheck():
if imagecut == 3:
if option == 'emby':
DownloadFileWithFilename(cover_small, '1.jpg', path)
img = Image.open(path + '/1.jpg')
try:
img = Image.open(path + '/1.jpg')
except Exception:
img = Image.open('1.jpg')
w = img.width
h = img.height
img.save(path + '/' + number + '.png')
@ -188,7 +197,10 @@ def smallCoverCheck():
os.remove(path + '/1.jpg')
if option == 'plex':
DownloadFileWithFilename(cover_small, '1.jpg', path)
img = Image.open(path + '/1.jpg')
try:
img = Image.open(path + '/1.jpg')
except Exception:
img = Image.open('1.jpg')
w = img.width
h = img.height
img.save(path + '/poster.png')
@ -197,15 +209,17 @@ def creatFolder(): #创建文件夹
global actor
global path
if len(os.getcwd()+path) > 240: #新建成功输出文件夹
path = success_folder+'/'+location_rule.replace("'actor'","'超多人'",3).replace("actor","'超多人'",3) #path为影片+元数据所在目录
path = success_folder+'/'+location_rule.replace("'actor'","'manypeople'",3).replace("actor","'manypeople'",3) #path为影片+元数据所在目录
else:
path = success_folder+'/'+location_rule
#print(path)
if not os.path.exists(path):
path = escapePath(path)
try:
os.makedirs(path)
except:
path = success_folder+'/'+location_rule.replace('/['+number+']-'+title,"/number")
path = escapePath(path)
#print(path)
os.makedirs(path)
#=====================资源下载部分===========================