Beta 10.4

This commit is contained in:
wenead99 2019-06-21 15:40:02 +08:00 committed by GitHub
parent 14ed221152
commit 665d1ffe43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 12 deletions

View File

@ -6,7 +6,7 @@ import sys
from ADC_function import *
import json
version='0.10.3'
version='0.10.4'
def UpdateCheck():
html2 = get_html('https://raw.githubusercontent.com/wenead99/AV_Data_Capture/master/update_check.json')

16
core.py
View File

@ -204,13 +204,13 @@ def DownloadFileWithFilename(url,filename,path): #path = examle:photo , video.in
print("[-]Download Failed2!")
time.sleep(3)
os._exit(0)
def PrintFiles(path):
def PrintFiles(path,naming_rule):
try:
if not os.path.exists(path):
os.makedirs(path)
with open(path + "/" + naming_rule + ".nfo", "wt", encoding='UTF-8') as code:
print("<movie>", file=code)
print(" <title>" + title + "</title>", file=code)
print(" <title>" + naming_rule + "</title>", file=code)
print(" <set>", file=code)
print(" </set>", file=code)
print(" <studio>" + studio + "+</studio>", file=code)
@ -255,15 +255,15 @@ def PrintFiles(path):
print(e1)
print("[-]Write Failed!")
def imageDownload(filepath): #封面是否下载成功否则移动到failed
if DownloadFileWithFilename(cover,naming_rule+ '.jpg', path) == 'failed':
if DownloadFileWithFilename(cover,'Backdrop.jpg', path) == 'failed':
shutil.move(filepath, 'failed/')
os._exit(0)
DownloadFileWithFilename(cover, naming_rule + '.jpg', path)
print('[+]Image Downloaded!', path +'/'+naming_rule+'.jpg')
DownloadFileWithFilename(cover, 'Backdrop.jpg', path)
print('[+]Image Downloaded!', path +'/'+'Backdrop.jpg')
def cutImage():
if imagecut == 1:
try:
img = Image.open(path + '/' + naming_rule + '.jpg')
img = Image.open(path + '/' + 'Backdrop' + '.jpg')
imgSize = img.size
w = img.width
h = img.height
@ -272,7 +272,7 @@ def cutImage():
except:
print('[-]Cover cut failed!')
else:
img = Image.open(path + '/' + naming_rule + '.jpg')
img = Image.open(path + '/' + 'Backdrop' + '.jpg')
w = img.width
h = img.height
img.save(path + '/' + naming_rule + '.png')
@ -287,6 +287,6 @@ if __name__ == '__main__':
getNumberFromFilename(filepath) #定义番号
creatFolder() #创建文件夹
imageDownload(filepath) #creatFoder会返回番号路径
PrintFiles(path)#打印文件
PrintFiles(path,naming_rule)#打印文件
cutImage() #裁剪图
pasteFileToFolder(filepath,path) #移动文件

View File

@ -15,7 +15,11 @@ import siro
def getTitle(htmlcode): #获取标题
doc = pq(htmlcode)
title=str(doc('div.container h3').text()).replace(' ','-')
return title
try:
title2 = re.sub('n\d+-','',title)
return title2
except:
return title
def getStudio(htmlcode): #获取厂商
html = etree.fromstring(htmlcode,etree.HTMLParser())
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[5]/a/text()')).strip(" ['']")
@ -121,7 +125,7 @@ def main_uncensored(number):
htmlcode = get_html('https://www.javbus.com/' + number)
dww_htmlcode = get_html("https://www.dmm.co.jp/mono/dvd/-/detail/=/cid=" + number.replace("-", ''))
dic = {
'title': str(re.sub('\w+-\d+-','',getTitle(htmlcode))),
'title': str(re.sub('\w+-\d+-','',getTitle(htmlcode))).replace(getNum(htmlcode)+'-',''),
'studio': getStudio(htmlcode),
'year': getYear(htmlcode),
'outline': getOutline(dww_htmlcode),
@ -141,7 +145,7 @@ def main_uncensored(number):
number2 = number.replace('-', '_')
htmlcode = get_html('https://www.javbus.com/' + number2)
dic2 = {
'title': str(re.sub('\w+-\d+-','',getTitle(htmlcode))),
'title': str(re.sub('\w+-\d+-','',getTitle(htmlcode))).replace(getNum(htmlcode)+'-',''),
'studio': getStudio(htmlcode),
'year': getYear(htmlcode),
'outline': '',