Beta 11.5 Update
This commit is contained in:
parent
dde6167b05
commit
cc362a2a26
@ -3,27 +3,36 @@ from configparser import RawConfigParser
|
||||
import os
|
||||
import re
|
||||
from retrying import retry
|
||||
import time
|
||||
import sys
|
||||
|
||||
# content = open('config.ini').read()
|
||||
# content = re.sub(r"\xfe\xff","", content)
|
||||
# content = re.sub(r"\xff\xfe","", content)
|
||||
# content = re.sub(r"\xef\xbb\xbf","", content)
|
||||
# open('BaseConfig.cfg', 'w').write(content)
|
||||
|
||||
config = RawConfigParser()
|
||||
if os.path.exists('config.ini'):
|
||||
config.read('config.ini', encoding='UTF-8')
|
||||
try:
|
||||
config.read('config.ini', encoding='UTF-8')
|
||||
except:
|
||||
print('[-]Config.ini read failed! Please use the offical file!')
|
||||
else:
|
||||
print('[+]config.ini: not found, creating...')
|
||||
with open("config.ini", "wt", encoding='UTF-8') as code:
|
||||
print("[proxy]",file=code)
|
||||
print("proxy=127.0.0.1:1080",file=code)
|
||||
print("timeout=10", file=code)
|
||||
print("retry=3", file=code)
|
||||
print("", file=code)
|
||||
print("[Name_Rule]", file=code)
|
||||
print("location_rule='JAV_output/'+actor+'/['+number+']-'+title",file=code)
|
||||
print("location_rule='JAV_output/'+actor+'/'+number",file=code)
|
||||
print("naming_rule=number+'-'+title",file=code)
|
||||
print("", file=code)
|
||||
print("[update]",file=code)
|
||||
print("update_check=1")
|
||||
print("update_check=1",file=code)
|
||||
time.sleep(2)
|
||||
print('[+]config.ini: created!')
|
||||
try:
|
||||
config.read('config.ini', encoding='UTF-8')
|
||||
except:
|
||||
print('[-]Config.ini read failed! Please use the offical file!')
|
||||
|
||||
def UpdateCheckSwitch():
|
||||
check=str(config['update']['update_check'])
|
||||
if check == '1':
|
||||
@ -60,4 +69,3 @@ def get_html(url,cookies = None):#网页请求核心
|
||||
print('[-]Connect retry '+str(i)+'/'+str(retry_count))
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ import ADC_function
|
||||
import json
|
||||
import shutil
|
||||
|
||||
version='0.11.4'
|
||||
version='0.11.5'
|
||||
os.chdir(os.getcwd())
|
||||
|
||||
def UpdateCheck():
|
||||
@ -109,13 +109,14 @@ def getNumber(filepath):
|
||||
print('[-]' + str(os.path.basename(filepath)) + ' :', e2)
|
||||
print('[-]Move ' + os.path.basename(filepath) + ' to failed folder')
|
||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
||||
|
||||
def RunCore():
|
||||
if os.path.exists('core.py'):
|
||||
os.system('python core.py' + ' "' + i + '" --number "'+getNumber(i)+'"') #选择从py文件启动 (用于源码py)
|
||||
os.system('python core.py' + ' "' + i + '" --number "'+getNumber(i)+'"') #从py文件启动(用于源码py)
|
||||
elif os.path.exists('core.exe'):
|
||||
os.system('core.exe' + ' "' + i + '" --number "'+getNumber(i)+'"') #选择从exe文件启动(用于EXE版程序:
|
||||
os.system('core.exe' + ' "' + i + '" --number "'+getNumber(i)+'"') #从exe启动(用于EXE版程序)
|
||||
elif os.path.exists('core.py') and os.path.exists('core.exe'):
|
||||
os.system('python core.py' + ' "' + i + '" --number "' + getNumber(i) + '"') # 选择从py文件启动 (用于源码py)
|
||||
os.system('python core.py' + ' "' + i + '" --number "' + getNumber(i) + '"') #从py文件启动(用于源码py)
|
||||
|
||||
if __name__ =='__main__':
|
||||
print('[*]===========AV Data Capture===========')
|
||||
@ -131,7 +132,7 @@ if __name__ =='__main__':
|
||||
count = count + 1
|
||||
percentage = str(count/int(count_all)*100)[:4]+'%'
|
||||
print('[!] - '+percentage+' ['+str(count)+'/'+count_all+'] -')
|
||||
print("[!]Making Data for [" + i + "],the number is [" + getNumber(i) + "]")
|
||||
print("[!]Making Data for [" + i + "], the number is [" + getNumber(i) + "]")
|
||||
RunCore()
|
||||
print("[*]=====================================")
|
||||
|
||||
|
66
core.py
66
core.py
@ -37,6 +37,11 @@ naming_rule =''#eval(config['Name_Rule']['naming_rule'])
|
||||
location_rule=''#eval(config['Name_Rule']['location_rule'])
|
||||
|
||||
#=====================本地文件处理===========================
|
||||
def moveFailedFolder():
|
||||
global filepath
|
||||
print('[-]Move to "failed"')
|
||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
||||
os._exit(0)
|
||||
def argparse_get_file():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--number", help="Enter Number on here", default='')
|
||||
@ -72,6 +77,9 @@ def getDataFromJSON(file_number): #从JSON返回元数据
|
||||
global naming_rule
|
||||
global location_rule
|
||||
|
||||
|
||||
# ================================================网站规则添加开始================================================
|
||||
|
||||
try: # 添加 需要 正则表达式的规则
|
||||
# =======================javdb.py=======================
|
||||
if re.search('^\d{5,}', file_number).group() in file_number:
|
||||
@ -84,28 +92,31 @@ def getDataFromJSON(file_number): #从JSON返回元数据
|
||||
elif 'FC2' in file_number:
|
||||
json_data = json.loads(fc2fans_club.main(
|
||||
file_number.strip('FC2_').strip('FC2-').strip('ppv-').strip('PPV-').strip('fc2_').strip('fc2-').strip('ppv-').strip('PPV-')))
|
||||
# print(file_number.strip('FC2_').strip('FC2-').strip('ppv-').strip('PPV-'))
|
||||
# =======================javbus.py=======================
|
||||
else:
|
||||
json_data = json.loads(javbus.main(file_number))
|
||||
|
||||
# ================================================网站规则添加结束================================================
|
||||
|
||||
title = str(json_data['title']).replace(' ','')
|
||||
studio = json_data['studio']
|
||||
year = json_data['year']
|
||||
outline = json_data['outline']
|
||||
runtime = json_data['runtime']
|
||||
director = json_data['director']
|
||||
actor_list = str(json_data['actor']).strip("[ ]").replace("'", '').split(',') # 字符串转列表
|
||||
release = json_data['release']
|
||||
number = json_data['number']
|
||||
cover = json_data['cover']
|
||||
imagecut = json_data['imagecut']
|
||||
tag = str(json_data['tag']).strip("[ ]").replace("'", '').replace(" ", '').split(',') # 字符串转列表
|
||||
actor = str(actor_list).strip("[ ]").replace("'", '').replace(" ", '')
|
||||
actor_photo = json_data['actor_photo']
|
||||
website = json_data['website']
|
||||
title = str(json_data['title']).replace(' ','')
|
||||
studio = json_data['studio']
|
||||
year = json_data['year']
|
||||
outline = json_data['outline']
|
||||
runtime = json_data['runtime']
|
||||
director = json_data['director']
|
||||
actor_list = str(json_data['actor']).strip("[ ]").replace("'", '').split(',') # 字符串转列表
|
||||
release = json_data['release']
|
||||
number = json_data['number']
|
||||
cover = json_data['cover']
|
||||
imagecut = json_data['imagecut']
|
||||
tag = str(json_data['tag']).strip("[ ]").replace("'", '').replace(" ", '').split(',') # 字符串转列表
|
||||
actor = str(actor_list).strip("[ ]").replace("'", '').replace(" ", '')
|
||||
actor_photo = json_data['actor_photo']
|
||||
website = json_data['website']
|
||||
|
||||
if title == '' or number == '':
|
||||
print('[-]Movie Data not found!')
|
||||
moveFailedFolder()
|
||||
|
||||
# ====================处理异常字符====================== #\/:*?"<>|
|
||||
if '\\' in title:
|
||||
@ -163,20 +174,24 @@ def DownloadFileWithFilename(url,filename,path): #path = examle:photo , video.in
|
||||
headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
|
||||
r = requests.get(url, headers=headers, timeout=timeout,proxies={"http": "http://" + str(proxy), "https": "https://" + str(proxy)})
|
||||
if r == '':
|
||||
print('[-]Movie Data not found!')
|
||||
os._exit(0)
|
||||
with open(str(path) + "/" + filename, "wb") as code:
|
||||
code.write(r.content)
|
||||
return
|
||||
# print(bytes(r),file=code)
|
||||
else:
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
|
||||
r = requests.get(url, timeout=timeout, headers=headers)
|
||||
if r == '':
|
||||
print('[-]Movie Data not found!')
|
||||
os._exit(0)
|
||||
with open(str(path) + "/" + filename, "wb") as code:
|
||||
code.write(r.content)
|
||||
return
|
||||
# print(bytes(r),file=code)
|
||||
except requests.exceptions.RequestException:
|
||||
i += 1
|
||||
print('[-]Image Download : Connect retry '+str(i)+'/'+str(retry_count))
|
||||
@ -189,11 +204,11 @@ def DownloadFileWithFilename(url,filename,path): #path = examle:photo , video.in
|
||||
except requests.exceptions.ConnectTimeout:
|
||||
i += 1
|
||||
print('[-]Image Download : Connect retry '+str(i)+'/'+str(retry_count))
|
||||
moveFailedFolder()
|
||||
def imageDownload(filepath): #封面是否下载成功,否则移动到failed
|
||||
global path
|
||||
if DownloadFileWithFilename(cover,'fanart.jpg', path) == 'failed':
|
||||
shutil.move(filepath, 'failed/')
|
||||
os._exit(0)
|
||||
moveFailedFolder()
|
||||
DownloadFileWithFilename(cover, 'fanart.jpg', path)
|
||||
print('[+]Image Downloaded!', path +'/fanart.jpg')
|
||||
def PrintFiles(filepath):
|
||||
@ -253,13 +268,11 @@ def PrintFiles(filepath):
|
||||
except IOError as e:
|
||||
print("[-]Write Failed!")
|
||||
print(e)
|
||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
||||
os._exit(0)
|
||||
moveFailedFolder()
|
||||
except Exception as e1:
|
||||
print(e1)
|
||||
print("[-]Write Failed!")
|
||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
||||
os._exit(0)
|
||||
moveFailedFolder()
|
||||
def cutImage():
|
||||
if imagecut == 1:
|
||||
try:
|
||||
@ -282,7 +295,7 @@ def pasteFileToFolder(filepath, path): #文件路径,番号,后缀,要移
|
||||
os.rename(filepath, number + houzhui)
|
||||
shutil.move(number + houzhui, path)
|
||||
def renameJpgToBackdrop_copy():
|
||||
shutil.copy(path+'/fanart.jpg', path+'/Backdrop.jpg')
|
||||
shutil.copy(path + '/fanart.jpg', path + '/Backdrop.jpg')
|
||||
shutil.copy(path + '/poster.png', path + '/thumb.png')
|
||||
|
||||
if __name__ == '__main__':
|
||||
@ -297,7 +310,7 @@ if __name__ == '__main__':
|
||||
print("[!]Making Data for [" + number + "]")
|
||||
except:
|
||||
print("[-]failed!Please rename the filename again!")
|
||||
shutil.move(filepath,'failed/')
|
||||
moveFailedFolder()
|
||||
else:
|
||||
number = argparse_get_file()[1]
|
||||
CreatFailedFolder()
|
||||
@ -308,4 +321,3 @@ if __name__ == '__main__':
|
||||
cutImage() # 裁剪图
|
||||
pasteFileToFolder(filepath, path) # 移动文件
|
||||
renameJpgToBackdrop_copy()
|
||||
# time.sleep(20)
|
||||
|
@ -89,7 +89,7 @@ def getTag(htmlcode): # 获取演员
|
||||
|
||||
def main(number):
|
||||
try:
|
||||
if re.search('\d+\D+', number).group() in number:
|
||||
if re.search('\d+\D+', number).group() in number or 'siro' in number or 'SIRO' in number or 'Siro' in number:
|
||||
js = siro.main(number)
|
||||
return js
|
||||
except:
|
||||
|
Loading…
Reference in New Issue
Block a user