Beta 11.5 Update
This commit is contained in:
parent
dde6167b05
commit
cc362a2a26
@ -3,27 +3,36 @@ from configparser import RawConfigParser
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from retrying import retry
|
from retrying import retry
|
||||||
|
import time
|
||||||
import sys
|
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()
|
config = RawConfigParser()
|
||||||
if os.path.exists('config.ini'):
|
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:
|
else:
|
||||||
|
print('[+]config.ini: not found, creating...')
|
||||||
with open("config.ini", "wt", encoding='UTF-8') as code:
|
with open("config.ini", "wt", encoding='UTF-8') as code:
|
||||||
print("[proxy]",file=code)
|
print("[proxy]",file=code)
|
||||||
print("proxy=127.0.0.1:1080",file=code)
|
print("proxy=127.0.0.1:1080",file=code)
|
||||||
print("timeout=10", file=code)
|
print("timeout=10", file=code)
|
||||||
|
print("retry=3", file=code)
|
||||||
|
print("", file=code)
|
||||||
print("[Name_Rule]", 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("naming_rule=number+'-'+title",file=code)
|
||||||
|
print("", file=code)
|
||||||
print("[update]",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():
|
def UpdateCheckSwitch():
|
||||||
check=str(config['update']['update_check'])
|
check=str(config['update']['update_check'])
|
||||||
if check == '1':
|
if check == '1':
|
||||||
@ -60,4 +69,3 @@ def get_html(url,cookies = None):#网页请求核心
|
|||||||
print('[-]Connect retry '+str(i)+'/'+str(retry_count))
|
print('[-]Connect retry '+str(i)+'/'+str(retry_count))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import ADC_function
|
|||||||
import json
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
version='0.11.4'
|
version='0.11.5'
|
||||||
os.chdir(os.getcwd())
|
os.chdir(os.getcwd())
|
||||||
|
|
||||||
def UpdateCheck():
|
def UpdateCheck():
|
||||||
@ -109,13 +109,14 @@ def getNumber(filepath):
|
|||||||
print('[-]' + str(os.path.basename(filepath)) + ' :', e2)
|
print('[-]' + str(os.path.basename(filepath)) + ' :', e2)
|
||||||
print('[-]Move ' + os.path.basename(filepath) + ' to failed folder')
|
print('[-]Move ' + os.path.basename(filepath) + ' to failed folder')
|
||||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
||||||
|
|
||||||
def RunCore():
|
def RunCore():
|
||||||
if os.path.exists('core.py'):
|
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'):
|
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'):
|
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__':
|
if __name__ =='__main__':
|
||||||
print('[*]===========AV Data Capture===========')
|
print('[*]===========AV Data Capture===========')
|
||||||
@ -131,7 +132,7 @@ if __name__ =='__main__':
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
percentage = str(count/int(count_all)*100)[:4]+'%'
|
percentage = str(count/int(count_all)*100)[:4]+'%'
|
||||||
print('[!] - '+percentage+' ['+str(count)+'/'+count_all+'] -')
|
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()
|
RunCore()
|
||||||
print("[*]=====================================")
|
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'])
|
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():
|
def argparse_get_file():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("--number", help="Enter Number on here", default='')
|
parser.add_argument("--number", help="Enter Number on here", default='')
|
||||||
@ -72,6 +77,9 @@ def getDataFromJSON(file_number): #从JSON返回元数据
|
|||||||
global naming_rule
|
global naming_rule
|
||||||
global location_rule
|
global location_rule
|
||||||
|
|
||||||
|
|
||||||
|
# ================================================网站规则添加开始================================================
|
||||||
|
|
||||||
try: # 添加 需要 正则表达式的规则
|
try: # 添加 需要 正则表达式的规则
|
||||||
# =======================javdb.py=======================
|
# =======================javdb.py=======================
|
||||||
if re.search('^\d{5,}', file_number).group() in file_number:
|
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:
|
elif 'FC2' in file_number:
|
||||||
json_data = json.loads(fc2fans_club.main(
|
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-')))
|
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=======================
|
# =======================javbus.py=======================
|
||||||
else:
|
else:
|
||||||
json_data = json.loads(javbus.main(file_number))
|
json_data = json.loads(javbus.main(file_number))
|
||||||
|
|
||||||
# ================================================网站规则添加结束================================================
|
# ================================================网站规则添加结束================================================
|
||||||
|
|
||||||
title = str(json_data['title']).replace(' ','')
|
title = str(json_data['title']).replace(' ','')
|
||||||
studio = json_data['studio']
|
studio = json_data['studio']
|
||||||
year = json_data['year']
|
year = json_data['year']
|
||||||
outline = json_data['outline']
|
outline = json_data['outline']
|
||||||
runtime = json_data['runtime']
|
runtime = json_data['runtime']
|
||||||
director = json_data['director']
|
director = json_data['director']
|
||||||
actor_list = str(json_data['actor']).strip("[ ]").replace("'", '').split(',') # 字符串转列表
|
actor_list = str(json_data['actor']).strip("[ ]").replace("'", '').split(',') # 字符串转列表
|
||||||
release = json_data['release']
|
release = json_data['release']
|
||||||
number = json_data['number']
|
number = json_data['number']
|
||||||
cover = json_data['cover']
|
cover = json_data['cover']
|
||||||
imagecut = json_data['imagecut']
|
imagecut = json_data['imagecut']
|
||||||
tag = str(json_data['tag']).strip("[ ]").replace("'", '').replace(" ", '').split(',') # 字符串转列表
|
tag = str(json_data['tag']).strip("[ ]").replace("'", '').replace(" ", '').split(',') # 字符串转列表
|
||||||
actor = str(actor_list).strip("[ ]").replace("'", '').replace(" ", '')
|
actor = str(actor_list).strip("[ ]").replace("'", '').replace(" ", '')
|
||||||
actor_photo = json_data['actor_photo']
|
actor_photo = json_data['actor_photo']
|
||||||
website = json_data['website']
|
website = json_data['website']
|
||||||
|
|
||||||
|
if title == '' or number == '':
|
||||||
|
print('[-]Movie Data not found!')
|
||||||
|
moveFailedFolder()
|
||||||
|
|
||||||
# ====================处理异常字符====================== #\/:*?"<>|
|
# ====================处理异常字符====================== #\/:*?"<>|
|
||||||
if '\\' in title:
|
if '\\' in title:
|
||||||
@ -163,20 +174,24 @@ def DownloadFileWithFilename(url,filename,path): #path = examle:photo , video.in
|
|||||||
headers = {
|
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'}
|
'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)})
|
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:
|
with open(str(path) + "/" + filename, "wb") as code:
|
||||||
code.write(r.content)
|
code.write(r.content)
|
||||||
return
|
return
|
||||||
# print(bytes(r),file=code)
|
|
||||||
else:
|
else:
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
headers = {
|
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'}
|
'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)
|
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:
|
with open(str(path) + "/" + filename, "wb") as code:
|
||||||
code.write(r.content)
|
code.write(r.content)
|
||||||
return
|
return
|
||||||
# print(bytes(r),file=code)
|
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
i += 1
|
i += 1
|
||||||
print('[-]Image Download : Connect retry '+str(i)+'/'+str(retry_count))
|
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:
|
except requests.exceptions.ConnectTimeout:
|
||||||
i += 1
|
i += 1
|
||||||
print('[-]Image Download : Connect retry '+str(i)+'/'+str(retry_count))
|
print('[-]Image Download : Connect retry '+str(i)+'/'+str(retry_count))
|
||||||
|
moveFailedFolder()
|
||||||
def imageDownload(filepath): #封面是否下载成功,否则移动到failed
|
def imageDownload(filepath): #封面是否下载成功,否则移动到failed
|
||||||
global path
|
global path
|
||||||
if DownloadFileWithFilename(cover,'fanart.jpg', path) == 'failed':
|
if DownloadFileWithFilename(cover,'fanart.jpg', path) == 'failed':
|
||||||
shutil.move(filepath, 'failed/')
|
moveFailedFolder()
|
||||||
os._exit(0)
|
|
||||||
DownloadFileWithFilename(cover, 'fanart.jpg', path)
|
DownloadFileWithFilename(cover, 'fanart.jpg', path)
|
||||||
print('[+]Image Downloaded!', path +'/fanart.jpg')
|
print('[+]Image Downloaded!', path +'/fanart.jpg')
|
||||||
def PrintFiles(filepath):
|
def PrintFiles(filepath):
|
||||||
@ -253,13 +268,11 @@ def PrintFiles(filepath):
|
|||||||
except IOError as e:
|
except IOError as e:
|
||||||
print("[-]Write Failed!")
|
print("[-]Write Failed!")
|
||||||
print(e)
|
print(e)
|
||||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
moveFailedFolder()
|
||||||
os._exit(0)
|
|
||||||
except Exception as e1:
|
except Exception as e1:
|
||||||
print(e1)
|
print(e1)
|
||||||
print("[-]Write Failed!")
|
print("[-]Write Failed!")
|
||||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
moveFailedFolder()
|
||||||
os._exit(0)
|
|
||||||
def cutImage():
|
def cutImage():
|
||||||
if imagecut == 1:
|
if imagecut == 1:
|
||||||
try:
|
try:
|
||||||
@ -282,7 +295,7 @@ def pasteFileToFolder(filepath, path): #文件路径,番号,后缀,要移
|
|||||||
os.rename(filepath, number + houzhui)
|
os.rename(filepath, number + houzhui)
|
||||||
shutil.move(number + houzhui, path)
|
shutil.move(number + houzhui, path)
|
||||||
def renameJpgToBackdrop_copy():
|
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')
|
shutil.copy(path + '/poster.png', path + '/thumb.png')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -297,7 +310,7 @@ if __name__ == '__main__':
|
|||||||
print("[!]Making Data for [" + number + "]")
|
print("[!]Making Data for [" + number + "]")
|
||||||
except:
|
except:
|
||||||
print("[-]failed!Please rename the filename again!")
|
print("[-]failed!Please rename the filename again!")
|
||||||
shutil.move(filepath,'failed/')
|
moveFailedFolder()
|
||||||
else:
|
else:
|
||||||
number = argparse_get_file()[1]
|
number = argparse_get_file()[1]
|
||||||
CreatFailedFolder()
|
CreatFailedFolder()
|
||||||
@ -308,4 +321,3 @@ if __name__ == '__main__':
|
|||||||
cutImage() # 裁剪图
|
cutImage() # 裁剪图
|
||||||
pasteFileToFolder(filepath, path) # 移动文件
|
pasteFileToFolder(filepath, path) # 移动文件
|
||||||
renameJpgToBackdrop_copy()
|
renameJpgToBackdrop_copy()
|
||||||
# time.sleep(20)
|
|
||||||
|
@ -89,7 +89,7 @@ def getTag(htmlcode): # 获取演员
|
|||||||
|
|
||||||
def main(number):
|
def main(number):
|
||||||
try:
|
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)
|
js = siro.main(number)
|
||||||
return js
|
return js
|
||||||
except:
|
except:
|
||||||
|
2
siro.py
2
siro.py
@ -101,4 +101,4 @@ def main(number2):
|
|||||||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'),)#.encode('UTF-8')
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'),)#.encode('UTF-8')
|
||||||
return js
|
return js
|
||||||
|
|
||||||
#print(main('300maan-401'))
|
#print(main('300maan-373'))
|
Loading…
Reference in New Issue
Block a user