Skip to content

Commit

Permalink
3.95
Browse files Browse the repository at this point in the history
  • Loading branch information
moyy996 committed May 11, 2020
1 parent 88ba5aa commit be2cf18
Show file tree
Hide file tree
Showing 14 changed files with 712 additions and 131 deletions.
309 changes: 220 additions & 89 deletions AVDC_Main.py

Large diffs are not rendered by default.

60 changes: 46 additions & 14 deletions Function/Function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import re
import os
import json
from PIL import Image
from configparser import ConfigParser
from Getter import avsox, javbus, javdb, fc2fans_club, mgstage, dmm, jav321
from Getter import avsox, javbus, javdb, fc2fans_club, mgstage, dmm, jav321, xcity


# ========================================================================获取config
Expand Down Expand Up @@ -65,7 +66,11 @@ def movie_lists(escape_folder, movie_type, movie_path):
if flag_escape == 1:
continue
for f in files:
if os.path.splitext(f)[1] in file_type:
file_type_current = os.path.splitext(f)[1]
file_name = os.path.splitext(f)[0]
if re.search(r'^\..+', file_name):
continue
if file_type_current in file_type:
path = root + '/' + f
# path = path.replace(file_root, '.')
path = path.replace("\\\\", "/").replace("\\", "/")
Expand All @@ -89,23 +94,26 @@ def getNumber(filepath, escape_string):
filename = filename.replace(part, '')
filename = str(re.sub("-\d{4}-\d{1,2}-\d{1,2}", "", filename)) # 去除文件名中时间
filename = str(re.sub("\d{4}-\d{1,2}-\d{1,2}-", "", filename)) # 去除文件名中时间
if re.search('^\D+.\d{2}.\d{2}.\d{2}', filename): # 提取欧美番号 sexart.11.11.11
if re.search('^\D+\.\d{2}\.\d{2}\.\d{2}', filename): # 提取欧美番号 sexart.11.11.11
try:
file_number = re.search('\D+.\d{2}.\d{2}.\d{2}', filename).group()
file_number = re.search('\D+\.\d{2}\.\d{2}\.\d{2}', filename).group()
return file_number
except:
return os.path.splitext(filepath.split('/')[-1])[0]
elif re.search('XXX-AV-\d{4,}', filename.upper()): # 提取xxx-av-11111
file_number = re.search('XXX-AV-\d{4,}', filename.upper()).group()
return file_number
elif '-' in filename or '_' in filename: # 普通提取番号 主要处理包含减号-和_的番号
if 'FC2' or 'fc2' in filename:
filename = filename.upper().replace('PPV', '').replace('--', '-')
if re.search('\w+-\d+', filename): # 提取类似mkbd-120番号
if re.search('[a-zA-Z]+-\d+', filename): # 提取类似mkbd-120番号
file_number = re.search('\w+-\d+', filename).group()
elif re.search('\d+[a-zA-Z]+-\d+', filename): # 提取类似259luxu-1111番号
file_number = re.search('\d+[a-zA-Z]+-\d+', filename).group()
elif re.search('\w+-\w\d+', filename): # 提取类似mkbd-s120番号
file_number = re.search('\w+-\w\d+', filename).group()
elif re.search('\d+-\w+', filename): # 提取类似 111111-MMMM 番号
file_number = re.search('\d+-\w+', filename).group()
elif re.search('[a-zA-Z]+-[a-zA-Z]\d+', filename): # 提取类似mkbd-s120番号
file_number = re.search('[a-zA-Z]+-[a-zA-Z]\d+', filename).group()
elif re.search('\d+-[a-zA-Z]+', filename): # 提取类似 111111-MMMM 番号
file_number = re.search('\d+-[a-zA-Z]+', filename).group()
elif re.search('\d+-\d+', filename): # 提取类似 111111-000 番号
file_number = re.search('\d+-\d+', filename).group()
elif re.search('\d+_\d+', filename): # 提取类似 111111_000 番号
Expand Down Expand Up @@ -159,7 +167,7 @@ def getDataFromJSON(file_number, config, mode): # 从JSON返回元数据
elif re.match('\D{2,}00\d{3,}', file_number) and '-' not in file_number and '_' not in file_number:
json_data = json.loads(dmm.main(file_number))
# =======================================================================sexart.15.06.14
elif re.search('[a-zA-Z]+.\d{2}.\d{2}.\d{2}', file_number):
elif re.search('\D+\.\d{2}\.\d{2}\.\d{2}', file_number):
json_data = json.loads(javdb.main_us(file_number))
if getDataState(json_data) == 0:
json_data = json.loads(javbus.main_us(file_number))
Expand All @@ -168,6 +176,8 @@ def getDataFromJSON(file_number, config, mode): # 从JSON返回元数据
json_data = json.loads(javbus.main(file_number))
if getDataState(json_data) == 0:
json_data = json.loads(jav321.main(file_number))
if getDataState(json_data) == 0:
json_data = json.loads(xcity.main(file_number))
if getDataState(json_data) == 0:
json_data = json.loads(javdb.main(file_number))
if getDataState(json_data) == 0:
Expand All @@ -185,20 +195,22 @@ def getDataFromJSON(file_number, config, mode): # 从JSON返回元数据
elif mode == 4: # 仅从javbus
if isuncensored:
json_data = json.loads(javbus.main_uncensored(file_number))
elif re.search('\D+.\d{2}.\d{2}.\d{2}', file_number):
elif re.search('\D+\.\d{2}\.\d{2}\.\d{2}', file_number):
json_data = json.loads(javbus.main_us(file_number))
else:
json_data = json.loads(javbus.main(file_number))
elif mode == 5: # 仅从jav321
json_data = json.loads(jav321.main(file_number, isuncensored))
elif mode == 6: # 仅从javdb
if re.search('\D+.\d{2}.\d{2}.\d{2}', file_number):
if re.search('\D+\.\d{2}\.\d{2}\.\d{2}', file_number):
json_data = json.loads(javdb.main_us(file_number))
else:
json_data = json.loads(javdb.main(file_number, isuncensored))
elif mode == 7: # 仅从avsox
json_data = json.loads(avsox.main(file_number))
elif mode == 8: # 仅从dmm
elif mode == 8: # 仅从xcity
json_data = json.loads(xcity.main(file_number))
elif mode == 9: # 仅从dmm
json_data = json.loads(dmm.main(file_number))

# ================================================网站规则添加结束================================================
Expand Down Expand Up @@ -301,7 +313,7 @@ def save_config(json_config):
print("soft_link = " + str(json_config['soft_link']), file=code)
print("show_poster = " + str(json_config['show_poster']), file=code)
print("website = " + json_config['website'], file=code)
print("# all or mgstage or fc2club or javbus or jav321 or javdb or avsox or dmm", file=code)
print("# all or mgstage or fc2club or javbus or jav321 or javdb or avsox or xcity or dmm", file=code)
print("", file=code)
print("[proxy]", file=code)
print("proxy = " + json_config['proxy'], file=code)
Expand Down Expand Up @@ -350,5 +362,25 @@ def save_config(json_config):
print("uncensored_prefix = " + str(json_config['uncensored_prefix']), file=code)
print("uncensored_poster = " + str(json_config['uncensored_poster']), file=code)
print("# 0 : official, 1 : cut", file=code)
print("", file=code)
print("[file_download]", file=code)
print("nfo = " + str(json_config['nfo_download']), file=code)
print("poster = " + str(json_config['poster_download']), file=code)
print("fanart = " + str(json_config['fanart_download']), file=code)
print("thumb = " + str(json_config['thumb_download']), file=code)
print("", file=code)
print("[extrafanart]", file=code)
print("extrafanart_download = " + str(json_config['extrafanart_download']), file=code)
print("extrafanart_folder = " + str(json_config['extrafanart_folder']), file=code)

code.close()


def check_pic(path_pic):
try:
img = Image.open(path_pic)
img.load()
return True
except (FileNotFoundError, OSError):
# print('文件损坏')
return False
1 change: 1 addition & 0 deletions Getter/avsox.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def main(number):
'actor_photo': getActorPhoto(web),
'cover': getCover(web),
'cover_small': getCover_small(response, count),
'extrafanart': '',
'imagecut': 3,
'director': '',
'publisher': '',
Expand Down
13 changes: 12 additions & 1 deletion Getter/dmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ def getCover(htmlcode, number):
return result


def getExtraFanart(htmlcode):
html = etree.fromstring(htmlcode, etree.HTMLParser())
old_list = html.xpath("//div[@id='sample-image-block']/a[@name='sample-image']/img/@src")
new_list = []
for extrafanart in old_list:
new_list.append(extrafanart.replace('-', 'jp-'))
return new_list


def getDirector(a):
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
try:
Expand Down Expand Up @@ -149,9 +158,10 @@ def main(number):
'number': getNum(htmlcode),
'tag': getTag(htmlcode),
'series': getSeries(htmlcode).replace('-', ''),
'year': getYear(getRelease(htmlcode)), # str(re.search('\d{4}',getRelease(a)).group()),
'year': getYear(getRelease(htmlcode)),
'actor_photo': getActorPhoto(actor),
'cover': getCover(htmlcode, number),
'extrafanart': getExtraFanart(htmlcode),
'imagecut': 1,
'website': url,
'source': 'dmm.py',
Expand All @@ -172,3 +182,4 @@ def main(number):

# main('DV-1562')
# print(main('mide00139'))
# print(main('kawd00969'))
1 change: 1 addition & 0 deletions Getter/fc2fans_club.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def main(number):
'tag': getTag(htmlcode),
'actor_photo': getActorPhoto(actor),
'cover': getCover(htmlcode),
'extrafanart': '',
'imagecut': 0,
'director': '',
'series': '',
Expand Down
11 changes: 9 additions & 2 deletions Getter/jav321.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def getActor(response):
return str(re.findall(r'<a href="/heyzo_star/\S+">(\S+)</a> &nbsp;', response)).strip(" [',']").replace('\'',
'')
else:
return str(re.findall(r'<b>女优</b>: (.+) &nbsp; <br>', response)).strip(" [',']").replace('\'', '')
return str(re.findall(r'<b>女优</b>: ([^<]+) &nbsp; <br>', response)).strip(" [',']").replace('\'', '')


def getStudio(response):
Expand Down Expand Up @@ -51,7 +51,7 @@ def getScore(response):
score = re.findall(r'<b>评分</b>: <img data-original="/img/(\d+).gif" />', response)[0]
return str(float(score) / 10.0)
else:
return str(re.findall(r'<b>评分</b>: (.+)<br>', response)).strip(" [',']").replace('\'', '')
return str(re.findall(r'<b>评分</b>: ([^<]+)<br>', response)).strip(" [',']").replace('\'', '')


def getYear(release):
Expand All @@ -75,6 +75,11 @@ def getCover(detail_page):
return cover_url


def getExtraFanart(htmlcode):
extrafanart_list = htmlcode.xpath("/html/body/div[@class='row'][2]/div[@class='col-md-3']/div[@class='col-xs-12 col-md-12']/p/a/img[@class='img-responsive']/@src")
return extrafanart_list


def getCoverSmall(detail_page):
return str(detail_page.xpath("//div[@class='panel-body']/div[@class='row'][1]/div[@class='col-md-3']/img["
"@class='img-responsive']/@src")).strip(" ['']")
Expand Down Expand Up @@ -119,6 +124,7 @@ def main(number, isuncensored=False):
'year': getYear(release),
'actor_photo': getActorPhoto(actor.split(',')),
'cover': getCover(detail_page),
'extrafanart': getExtraFanart(detail_page),
'cover_small': cover_small,
'imagecut': imagecut,
'director': '',
Expand Down Expand Up @@ -149,4 +155,5 @@ def main(number, isuncensored=False):
print(main('ara-415'))
print(main('luxu-1257'))
print(main('heyzo-1031'))
print(main('ABP-905'))
'''
22 changes: 21 additions & 1 deletion Getter/javbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ def getCover(htmlcode): # 获取封面链接
return image.attr('href')


def getExtraFanart(htmlcode): # 获取封面链接
html = etree.fromstring(htmlcode, etree.HTMLParser())
extrafanart_list = html.xpath("//div[@id='sample-waterfall']/a/@href")
return extrafanart_list


def getRelease(htmlcode): # 获取出版日期
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('//span[contains(text(),"發行日期")]/../text()')).strip(" ['']")
Expand Down Expand Up @@ -101,7 +107,18 @@ def getOutlineScore(number): # 获取简介
score = re.findall(r'<b>评分</b>: <img data-original="/img/(\d+).gif" />', response)[0]
score = str(float(score) / 10.0)
else:
score = str(re.findall(r'<b>评分</b>: (.+)<br>', response)).strip(" [',']").replace('\'', '')
score = str(re.findall(r'<b>评分</b>: ([^<]+)<br>', response)).strip(" [',']").replace('\'', '')
if outline == '':
dmm_htmlcode = get_html(
"https://www.dmm.co.jp/search/=/searchstr=" + number.replace('-', '') + "/sort=ranking/")
if 'に一致する商品は見つかりませんでした' not in dmm_htmlcode:
dmm_page = etree.fromstring(dmm_htmlcode, etree.HTMLParser())
url_detail = str(dmm_page.xpath('//*[@id="list"]/li[1]/div/p[2]/a/@href')).split(',', 1)[0].strip(
" ['']")
if url_detail != '':
dmm_detail = get_html(url_detail)
html = etree.fromstring(dmm_detail, etree.HTMLParser())
outline = str(html.xpath('//*[@class="mg-t0 mg-b20"]/text()')).strip(" ['']").replace('\\n', '').replace('\n', '')
except Exception as error_info:
print('Error in javbus.getOutlineScore : ' + str(error_info))
return outline, score
Expand Down Expand Up @@ -200,6 +217,7 @@ def main(number):
'release': getRelease(htmlcode),
'number': number,
'cover': getCover(htmlcode),
'extrafanart': getExtraFanart(htmlcode),
'imagecut': 1,
'tag': getTag(htmlcode),
'series': getSeries(htmlcode),
Expand Down Expand Up @@ -248,6 +266,7 @@ def main_uncensored(number):
'release': getRelease(htmlcode),
'number': getNum(htmlcode),
'cover': getCover(htmlcode),
'extrafanart': getExtraFanart(htmlcode),
'tag': getTag(htmlcode),
'series': getSeries(htmlcode),
'imagecut': 3,
Expand Down Expand Up @@ -312,6 +331,7 @@ def main_us(number):
'tag': getTag(htmlcode),
'series': getSeries(htmlcode),
'cover': getCover(htmlcode),
'extrafanart': getExtraFanart(htmlcode),
'cover_small': cover_small,
'imagecut': 3,
'actor_photo': getActorPhoto(htmlcode),
Expand Down
14 changes: 12 additions & 2 deletions Getter/javdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def getTag(htmlcode):

def getCover_small(htmlcode, count):
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = html.xpath("//div[@class='grid-item column']/a[@class='box']/div/img/@src")[count]
result = html.xpath("//div[@class='grid-item column']/a[@class='box']/div/img/@data-src")[count]
if 'thumbs' not in result:
result = html.xpath("//div[@class='grid-item column']/a[@class='box']/div/img/@src")[count]
if not 'https' in result:
result = 'https:' + result
return result
Expand All @@ -111,6 +113,12 @@ def getCover(htmlcode):
return result


def getExtraFanart(htmlcode): # 获取封面链接
html = etree.fromstring(htmlcode, etree.HTMLParser())
extrafanart_list = html.xpath("//div[@class='message-body']/div[@class='tile-images preview-images']/a/@href")
return extrafanart_list


def getDirector(htmlcode):
html = etree.fromstring(htmlcode, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
result1 = str(html.xpath('//strong[contains(text(),"導演")]/../span/text()')).strip(" ['']")
Expand Down Expand Up @@ -138,7 +146,7 @@ def getOutlineScore(number): # 获取简介
score = re.findall(r'<b>评分</b>: <img data-original="/img/(\d+).gif" />', response)[0]
score = str(float(score) / 10.0)
else:
score = str(re.findall(r'<b>评分</b>: (.+)<br>', response)).strip(" [',']").replace('\'', '')
score = str(re.findall(r'<b>评分</b>: ([^<]+)<br>', response)).strip(" [',']").replace('\'', '')
except Exception as error_info:
print('Error in javdb.getOutlineScore : ' + str(error_info))
return outline, score
Expand Down Expand Up @@ -206,6 +214,7 @@ def main(number, isuncensored=False):
'number': number_get,
'cover': getCover(html_info),
'cover_small': cover_small,
'extrafanart': getExtraFanart(html_info),
'imagecut': imagecut,
'tag': getTag(html_info),
'series': getSeries(html_info),
Expand Down Expand Up @@ -284,6 +293,7 @@ def main_us(number):
'number': number,
'cover': getCover(html_info),
'cover_small': getCover_small(htmlcode, count - 1),
'extrafanart': getExtraFanart(html_info),
'imagecut': 3,
'tag': getTag(html_info),
'series': getSeries(html_info),
Expand Down
7 changes: 7 additions & 0 deletions Getter/mgstage.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ def getCover(htmlcode):
return result


def getExtraFanart(htmlcode): # 获取封面链接
html = etree.fromstring(htmlcode, etree.HTMLParser())
extrafanart_list = html.xpath("//dl[@id='sample-photo']/dd/ul/li/a[@class='sample_image']/@href")
return extrafanart_list


def getOutline(htmlcode):
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('//*[@id="introduction"]/dd/p[1]/text()')).strip(" ['']")
Expand Down Expand Up @@ -122,6 +128,7 @@ def main(number):
'release': getRelease(htmlcode),
'number': getNum(htmlcode),
'cover': getCover(htmlcode),
'extrafanart': getExtraFanart(htmlcode),
'imagecut': 0,
'tag': getTag(htmlcode).strip(','),
'series': getSeries(htmlcode).strip(','),
Expand Down
Loading

0 comments on commit be2cf18

Please sign in to comment.