Skip to content

Commit

Permalink
3.61
Browse files Browse the repository at this point in the history
  • Loading branch information
moyy996 committed Feb 12, 2020
1 parent f912172 commit 6b06140
Show file tree
Hide file tree
Showing 15 changed files with 107 additions and 93 deletions.
4 changes: 2 additions & 2 deletions AVDC.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def setupUi(self, AVDV):
self.pushButton_start_cap.setGeometry(QtCore.QRect(650, 10, 121, 41))
self.pushButton_start_cap.setObjectName("pushButton_start_cap")
self.textBrowser_warning = QtWidgets.QTextBrowser(self.page_avdc)
self.textBrowser_warning.setGeometry(QtCore.QRect(120, 10, 391, 41))
self.textBrowser_warning.setGeometry(QtCore.QRect(100, 10, 471, 41))
self.textBrowser_warning.setObjectName("textBrowser_warning")
self.horizontalLayoutWidget = QtWidgets.QWidget(self.page_avdc)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(0, 680, 791, 41))
Expand Down Expand Up @@ -461,7 +461,7 @@ def setupUi(self, AVDV):
AVDV.setCentralWidget(self.centralwidget)

self.retranslateUi(AVDV)
self.stackedWidget.setCurrentIndex(3)
self.stackedWidget.setCurrentIndex(4)
QtCore.QMetaObject.connectSlotsByName(AVDV)

def retranslateUi(self, AVDV):
Expand Down
6 changes: 3 additions & 3 deletions AVDC.ui
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</rect>
</property>
<property name="currentIndex">
<number>3</number>
<number>4</number>
</property>
<widget class="QWidget" name="page_avdc">
<widget class="QPushButton" name="pushButton_start_cap">
Expand All @@ -43,9 +43,9 @@
<widget class="QTextBrowser" name="textBrowser_warning">
<property name="geometry">
<rect>
<x>120</x>
<x>100</x>
<y>10</y>
<width>391</width>
<width>471</width>
<height>41</height>
</rect>
</property>
Expand Down
41 changes: 24 additions & 17 deletions AVDC_Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, parent=None):
self.Ui.setupUi(self) # 初始化Ui
self.Init_Ui()
# 初始化需要的变量
self.version = '3.6'
self.version = '3.61'
self.m_drag = False
self.m_DragPosition = 0
self.item_succ = self.Ui.treeWidget_number.topLevelItem(0)
Expand Down Expand Up @@ -860,12 +860,14 @@ def PrintFiles(self, option, path, c_word, naming_rule, part, cn_sub, json_data,
print(" <tag>中文字幕</tag>", file=code)
try:
for i in tag:
print(" <tag>" + i + "</tag>", file=code)
if i != '':
print(" <tag>" + i + "</tag>", file=code)
except Exception as error_info:
self.add_text_main('[-]Error in tag: ' + str(error_info))
try:
for i in tag:
print(" <genre>" + i + "</genre>", file=code)
if i != '':
print(" <genre>" + i + "</genre>", file=code)
except Exception as error_info:
self.add_text_main('[-]Error in genre: ' + str(error_info))
print(" <genre>" + label + "</genre>", file=code)
Expand Down Expand Up @@ -1027,6 +1029,8 @@ def debug_mode(self, json_data, config):
def creatFolder(self, success_folder, json_data, config):
title, studio, year, outline, runtime, director, actor_photo, actor, release, tag, number, cover, website, label = get_info(
json_data)
if len(actor.split(',')) >= 15:
actor = actor.split(',')[0] + ',' + actor.split(',')[1] + ',' + actor.split(',')[2] + '等演员'
location_rule = json_data['location_rule']
path = location_rule.replace('title', title).replace('studio', studio).replace('year', year).replace('runtime',
runtime).replace(
Expand All @@ -1035,7 +1039,7 @@ def creatFolder(self, success_folder, json_data, config):
path = path.replace('//', '/')
if len(path) > 200:
self.add_text_main('[-]Error in Length of Path! Repleaced with actor/number')
path = json_data['actor'] + '/' + json_data['number']
path = actor + '/' + json_data['number']
path = success_folder + '/' + path
if not os.path.exists(path):
path = escapePath(path, config)
Expand Down Expand Up @@ -1069,17 +1073,18 @@ def add_label_info(self, json_data):
self.Ui.label_title.setText(json_data['title'])
self.Ui.label_actor.setText(json_data['actor'])
self.Ui.label_outline.setText(json_data['outline'])
self.Ui.label_tag.setText(str(json_data['tag']))
fanart_path = json_data['fanart_path']
poster_path = json_data['poster_path']
if os.path.exists(fanart_path):
pix = QPixmap(fanart_path)
self.Ui.label_fanart.setScaledContents(True)
self.Ui.label_fanart.setPixmap(pix) # 添加图标
if os.path.exists(poster_path):
pix = QPixmap(poster_path)
self.Ui.label_poster.setScaledContents(True)
self.Ui.label_poster.setPixmap(pix) # 添加图标
self.Ui.label_tag.setText(str(json_data['tag']).strip(" [',']").replace('\'', ''))
if self.Ui.checkBox_cover.isChecked():
fanart_path = json_data['fanart_path']
poster_path = json_data['poster_path']
if os.path.exists(fanart_path):
pix = QPixmap(fanart_path)
self.Ui.label_fanart.setScaledContents(True)
self.Ui.label_fanart.setPixmap(pix) # 添加缩略图
if os.path.exists(poster_path):
pix = QPixmap(poster_path)
self.Ui.label_poster.setScaledContents(True)
self.Ui.label_poster.setPixmap(pix) # 添加封面图


def Core_Main(self, file_path, number_th, mode, count):
Expand Down Expand Up @@ -1131,8 +1136,10 @@ def Core_Main(self, file_path, number_th, mode, count):
self.CreatFailedFolder(failed_folder) # 创建输出失败目录
path = self.creatFolder(success_folder, json_data, Config) # 创建文件夹
if path == 'error':
self.add_text_main('[-]Move ' + file_path + ' to failed folder')
shutil.move(file_path, str(os.getcwd()) + '/' + 'failed/')
node = QTreeWidgetItem(self.item_fail)
node.setText(0, str(count) + '.' + os.path.splitext(filepath.split('/')[-1])[0])
self.item_fail.addChild(node)
self.moveFailedFolder(filepath, failed_folder)
return
self.add_text_main('[+]Folder : ' + path)
self.add_text_main('[+]From : ' + json_data['website'])
Expand Down
7 changes: 6 additions & 1 deletion avsox.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ def getCover(htmlcode):

def getCover_small(htmlcode):
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('//*[@id="waterfall"]/div/a/div[1]/img/@src')).strip(" ['']")
result = html.xpath('//*[@id="waterfall"]/div/a/div[1]/img/@src')
if len(result) > 1:
result = result[0]
else:
result = str(result).strip(" ['']")

return result


Expand Down
45 changes: 25 additions & 20 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,40 @@ def getDataFromJSON(file_number, config, mode): # 从JSON返回元数据
# ================================================网站规则添加开始================================================
json_data = {}
if mode == 1: # 从全部网站刮削
if re.match('^\d{5,}', file_number): # 111111-111
# =======================================================================无码抓取:111111-111,n1111,HEYZO-1111
if re.match('^\d{4,}', file_number) or re.match('n\d{4}', file_number) or 'HEYZO' in file_number.upper():
json_data = json.loads(javbus.main_uncensored(file_number))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
if getDataState(json_data) == 0:
json_data = json.loads(javdb.main(file_number))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
if getDataState(json_data) == 0:
json_data = json.loads(avsox.main(file_number))
# ==
elif re.match('\d+\D+', file_number): # 259LUXU-1111
# =======================================================================259LUXU-1111
elif re.match('\d+\D+', file_number):
json_data = json.loads(siro.main(file_number))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
if getDataState(json_data) == 0:
json_data = json.loads(javbus.main(file_number))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
if getDataState(json_data) == 0:
json_data = json.loads(javdb.main(file_number))
# ==
elif 'fc2' in file_number or 'FC2' in file_number: # FC2-111111
# =======================================================================FC2-111111
elif 'FC2' in file_number.upper():
json_data = json.loads(fc2fans_club.main(
file_number.replace('fc2-', '').replace('fc2_', '').replace('FC2-', '').replace('fc2_', '')))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
if getDataState(json_data) == 0:
json_data = json.loads(javdb.main(file_number))
# ==
elif 'HEYZO' in file_number or 'heyzo' in file_number or 'Heyzo' in file_number: # HEYZO-1111
json_data = json.loads(avsox.main(file_number))
# ==
elif 'siro' in file_number or 'SIRO' in file_number or 'Siro' in file_number: # SIRO-111
# =======================================================================SIRO-111
elif 'SIRO' in file_number.upper():
json_data = json.loads(siro.main(file_number))
elif re.match('\D{2,}00\d{3,}', file_number): # ssni00321
if getDataState(json_data) == 0:
json_data = json.loads(javdb.main(file_number))
# =======================================================================ssni00321
elif re.match('\D{2,}00\d{3,}', file_number):
json_data = json.loads(fanza.main(file_number))
else: # MIDE-139, n1111
# =======================================================================MIDE-139
else:
json_data = json.loads(javbus.main(file_number))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
if getDataState(json_data) == 0:
json_data = json.loads(avsox.main(file_number))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
if getDataState(json_data) == 0:
json_data = json.loads(javdb.main(file_number))
elif mode != 6 and re.match('\D{2,}00\d{3,}', file_number):
json_data = {
Expand All @@ -68,7 +70,10 @@ def getDataFromJSON(file_number, config, mode): # 从JSON返回元数据
elif mode == 2: # 仅从javdb
json_data = json.loads(javdb.main(file_number))
elif mode == 3: # 仅从javbus
json_data = json.loads(javbus.main(file_number))
if re.match('^\d{5,}', file_number) or re.match('n\d{4}', file_number) or 'HEYZO' in file_number.upper():
json_data = json.loads(javbus.main_uncensored(file_number))
else:
json_data = json.loads(javbus.main(file_number))
elif mode == 4: # 仅从avsox
json_data = json.loads(avsox.main(file_number))
elif mode == 5: # 仅从fc2club
Expand Down
4 changes: 2 additions & 2 deletions fc2fans_club.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def main(number):
'year': '', # str(re.search('\d{4}',getRelease(number)).group()),
'outline': getOutline(htmlcode2).replace('\n', ''),
'runtime': getYear(getRelease(htmlcode)),
'director': getStudio(htmlcode),
'director': '',
'actor': actor.replace('/', ','),
'release': getRelease(number),
'number': 'FC2-' + number,
Expand All @@ -124,4 +124,4 @@ def main(number):
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
return js

# print(main('1121040'))
# print(main('1251689'))
53 changes: 27 additions & 26 deletions javbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ def getTitle(htmlcode): # 获取标题

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(" ['']")
result = str(html.xpath('//span[contains(text(),"製作商")]/following-sibling::a/text()')).strip(" ['']")
return result


def getYear(htmlcode): # 获取年份
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[2]/text()')).strip(" ['']")
return result
def getYear(getRelease): # 获取年份
try:
result = str(re.search('\d{4}', getRelease).group())
return result
except:
return getRelease


def getCover(htmlcode): # 获取封面链接
Expand All @@ -50,14 +52,14 @@ def getCover(htmlcode): # 获取封面链接

def getRelease(htmlcode): # 获取出版日期
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[2]/text()')).strip(" ['']")
result = str(html.xpath('//span[contains(text(),"發行日期")]/../text()')).strip(" ['']")
return result


def getRuntime(htmlcode): # 获取分钟
soup = BeautifulSoup(htmlcode, 'lxml')
a = soup.find(text=re.compile('分鐘'))
return a
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('//span[contains(text(),"長度")]/../text()')).strip(" ['']")
return result


def getActor(htmlcode): # 获取女优
Expand All @@ -71,35 +73,29 @@ def getActor(htmlcode): # 获取女优

def getNum(htmlcode): # 获取番号
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[1]/span[2]/text()')).strip(" ['']")
result = str(html.xpath('//span[contains(text(),"識別碼")]/following-sibling::span/text()')).strip(" ['']")
return result


def getDirector(htmlcode): # 获取导演
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[4]/a/text()')).strip(" ['']")
result = str(html.xpath('//span[contains(text(),"導演")]/following-sibling::a/text()')).strip(" ['']")
return result


def getOutline(htmlcode): # 获取演员
def getOutline(htmlcode): # 获取简介
doc = pq(htmlcode)
result = str(doc('tr td div.mg-b20.lh4 p.mg-b20').text())
return result


def getSerise(htmlcode):
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[6]/a/text()')).strip(" ['']")
return result


def getSerise_uncensored(htmlcode):
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[5]/a/text()')).strip(" ['']")
result = str(html.xpath('//span[contains(text(),"系列")]/following-sibling::a/text()')).strip(" ['']")
return result


def getCover_small(number):
def getCover_small(number): # 从avsox获取封面图
htmlcode = get_html('https://avsox.host/cn/search/' + number)
html = etree.fromstring(htmlcode, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
result1 = str(html.xpath('//*[@id="waterfall"]/div/a/@href')).strip(" ['']")
Expand All @@ -110,11 +106,15 @@ def getCover_small(number):
if result1 == '' or result1 == 'null' or result1 == 'None':
htmlcode = get_html('https://avsox.host/cn/search/' + number.replace('_', ''))
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('//*[@id="waterfall"]/div/a/div[1]/img/@src')).strip(" ['']")
result = html.xpath('//*[@id="waterfall"]/div/a/div[1]/img/@src')
if len(result) > 1:
result = result[0]
else:
result = str(result).strip(" ['']")
return result


def getTag(htmlcode): # 获取演员
def getTag(htmlcode): # 获取标签
tag = []
soup = BeautifulSoup(htmlcode, 'lxml')
a = soup.find_all(attrs={'class': 'genre'})
Expand All @@ -135,7 +135,7 @@ def main(number):
dic = {
'title': str(re.sub('\w+-\d+-', '', getTitle(htmlcode))),
'studio': getStudio(htmlcode),
'year': str(re.search('\d{4}', getYear(htmlcode)).group()),
'year': getYear(getRelease(htmlcode)),
'outline': getOutline(dww_htmlcode).replace('\n', ''),
'runtime': getRuntime(htmlcode),
'director': getDirector(htmlcode),
Expand Down Expand Up @@ -173,7 +173,7 @@ def main_uncensored(number):
dic = {
'title': str(re.sub('\w+-\d+-', '', getTitle(htmlcode))).replace(getNum(htmlcode) + '-', ''),
'studio': getStudio(htmlcode),
'year': getYear(htmlcode),
'year': getYear(getRelease(htmlcode)),
'outline': '',
'runtime': getRuntime(htmlcode),
'director': getDirector(htmlcode),
Expand All @@ -182,7 +182,7 @@ def main_uncensored(number):
'number': getNum(htmlcode),
'cover': getCover(htmlcode),
'tag': getTag(htmlcode),
'label': getSerise_uncensored(htmlcode),
'label': getSerise(htmlcode),
'imagecut': 3,
'cover_small': getCover_small(number),
'actor_photo': getActorPhoto(htmlcode),
Expand All @@ -206,4 +206,5 @@ def main_uncensored(number):
return js

# print(main('SSNI-658'))
# print(main_uncensored('051119-917'))
# print(main_uncensored('122919-949'))
# print(main_uncensored('012715-793'))
Loading

0 comments on commit 6b06140

Please sign in to comment.