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 * from ADC_function import *
import json import json
version='0.10.3' version='0.10.4'
def UpdateCheck(): def UpdateCheck():
html2 = get_html('https://raw.githubusercontent.com/wenead99/AV_Data_Capture/master/update_check.json') 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!") print("[-]Download Failed2!")
time.sleep(3) time.sleep(3)
os._exit(0) os._exit(0)
def PrintFiles(path): def PrintFiles(path,naming_rule):
try: try:
if not os.path.exists(path): if not os.path.exists(path):
os.makedirs(path) os.makedirs(path)
with open(path + "/" + naming_rule + ".nfo", "wt", encoding='UTF-8') as code: with open(path + "/" + naming_rule + ".nfo", "wt", encoding='UTF-8') as code:
print("<movie>", file=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(" </set>", file=code) print(" </set>", file=code)
print(" <studio>" + studio + "+</studio>", file=code) print(" <studio>" + studio + "+</studio>", file=code)
@ -255,15 +255,15 @@ def PrintFiles(path):
print(e1) print(e1)
print("[-]Write Failed!") print("[-]Write Failed!")
def imageDownload(filepath): #封面是否下载成功否则移动到failed def imageDownload(filepath): #封面是否下载成功否则移动到failed
if DownloadFileWithFilename(cover,naming_rule+ '.jpg', path) == 'failed': if DownloadFileWithFilename(cover,'Backdrop.jpg', path) == 'failed':
shutil.move(filepath, 'failed/') shutil.move(filepath, 'failed/')
os._exit(0) os._exit(0)
DownloadFileWithFilename(cover, naming_rule + '.jpg', path) DownloadFileWithFilename(cover, 'Backdrop.jpg', path)
print('[+]Image Downloaded!', path +'/'+naming_rule+'.jpg') print('[+]Image Downloaded!', path +'/'+'Backdrop.jpg')
def cutImage(): def cutImage():
if imagecut == 1: if imagecut == 1:
try: try:
img = Image.open(path + '/' + naming_rule + '.jpg') img = Image.open(path + '/' + 'Backdrop' + '.jpg')
imgSize = img.size imgSize = img.size
w = img.width w = img.width
h = img.height h = img.height
@ -272,7 +272,7 @@ def cutImage():
except: except:
print('[-]Cover cut failed!') print('[-]Cover cut failed!')
else: else:
img = Image.open(path + '/' + naming_rule + '.jpg') img = Image.open(path + '/' + 'Backdrop' + '.jpg')
w = img.width w = img.width
h = img.height h = img.height
img.save(path + '/' + naming_rule + '.png') img.save(path + '/' + naming_rule + '.png')
@ -287,6 +287,6 @@ if __name__ == '__main__':
getNumberFromFilename(filepath) #定义番号 getNumberFromFilename(filepath) #定义番号
creatFolder() #创建文件夹 creatFolder() #创建文件夹
imageDownload(filepath) #creatFoder会返回番号路径 imageDownload(filepath) #creatFoder会返回番号路径
PrintFiles(path)#打印文件 PrintFiles(path,naming_rule)#打印文件
cutImage() #裁剪图 cutImage() #裁剪图
pasteFileToFolder(filepath,path) #移动文件 pasteFileToFolder(filepath,path) #移动文件

View File

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