diff --git a/ADC_function.py b/ADC_function.py
index 348be2b8e..2b7695856 100755
--- a/ADC_function.py
+++ b/ADC_function.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
@@ -18,18 +19,13 @@
else:
print('[+]config.ini: not found, creating...')
with open("config.ini", "wt", encoding='UTF-8') as code:
- print("[common]", file=code)
- print("main_mode=1", file=code)
- print("failed_output_folder=failed", file=code)
- print("success_output_folder=JAV_output", file=code)
- print("", file=code)
print("[proxy]",file=code)
print("proxy=127.0.0.1:1080",file=code)
print("timeout=10", file=code)
print("retry=3", file=code)
print("", file=code)
print("[Name_Rule]", file=code)
- print("location_rule=actor+'/'+number",file=code)
+ print("location_rule='JAV_output/'+actor+'/'+number",file=code)
print("naming_rule=number+'-'+title",file=code)
print("", file=code)
print("[update]",file=code)
@@ -41,8 +37,10 @@
print("#plex only test!", file=code)
print("", file=code)
print("[directory_capture]", file=code)
+ print("switch=0", file=code)
print("directory=", file=code)
print("", file=code)
+ print("everyone switch:1=on, 0=off", file=code)
time.sleep(2)
print('[+]config.ini: created!')
try:
diff --git a/AV_Data_Capture.py b/AV_Data_Capture.py
index 885a5ea48..987adc722 100755
--- a/AV_Data_Capture.py
+++ b/AV_Data_Capture.py
@@ -14,7 +14,7 @@
# ============global var===========
-version='1.1'
+version='1.2'
config = ConfigParser()
config.read(config_file, encoding='UTF-8')
@@ -36,36 +36,26 @@ def UpdateCheck():
else:
print('[+]Update Check disabled!')
def movie_lists():
+ global exclude_directory_1
+ global exclude_directory_2
directory = config['directory_capture']['directory']
- mp4=[]
- avi=[]
- rmvb=[]
- wmv=[]
- mov=[]
- mkv=[]
- flv=[]
- ts=[]
+ total=[]
+ file_type = ['mp4','avi','rmvb','wmv','mov','mkv','flv','ts']
+ exclude_directory_1 = config['common']['failed_output_folder']
+ exclude_directory_2 = config['common']['success_output_folder']
if directory=='*':
+ remove_total = []
+ for o in file_type:
+ remove_total += glob.glob(r"./" + exclude_directory_1 + "/*." + o)
+ remove_total += glob.glob(r"./" + exclude_directory_2 + "/*." + o)
for i in os.listdir(os.getcwd()):
- mp4 += glob.glob(r"./" + i + "/*.mp4")
- avi += glob.glob(r"./" + i + "/*.avi")
- rmvb += glob.glob(r"./" + i + "/*.rmvb")
- wmv += glob.glob(r"./" + i + "/*.wmv")
- mov += glob.glob(r"./" + i + "/*.mov")
- mkv += glob.glob(r"./" + i + "/*.mkv")
- flv += glob.glob(r"./" + i + "/*.flv")
- ts += glob.glob(r"./" + i + "/*.ts")
- total = mp4 + avi + rmvb + wmv + mov + mkv + flv + ts
+ for a in file_type:
+ total += glob.glob(r"./" + i + "/*." + a)
+ for b in remove_total:
+ total.remove(b)
return total
- mp4 = glob.glob(r"./" + directory + "/*.mp4")
- avi = glob.glob(r"./" + directory + "/*.avi")
- rmvb = glob.glob(r"./" + directory + "/*.rmvb")
- wmv = glob.glob(r"./" + directory + "/*.wmv")
- mov = glob.glob(r"./" + directory + "/*.mov")
- mkv = glob.glob(r"./" + directory + "/*.mkv")
- flv = glob.glob(r"./" + directory + "/*.flv")
- ts = glob.glob(r"./" + directory + "/*.ts")
- total = mp4 + avi + rmvb + wmv + mov + mkv + flv + ts
+ for a in file_type:
+ total += glob.glob(r"./" + directory + "/*." + a)
return total
def CreatFailedFolder():
if not os.path.exists('failed/'): # 新建failed文件夹
@@ -160,7 +150,7 @@ def RunCore():
shutil.move(i, str(os.getcwd()) + '/' + 'failed/')
continue
-
- CEF('JAV_output')
+ CEF(exclude_directory_1)
+ CEF(exclude_directory_2)
print("[+]All finished!!!")
input("[+][+]Press enter key exit, you can check the error messge before you exit.\n[+][+]按回车键结束,你可以在结束之前查看和错误信息。")
\ No newline at end of file
diff --git a/core.py b/core.py
index 9d26f7842..8ae8509de 100755
--- a/core.py
+++ b/core.py
@@ -18,14 +18,13 @@
import javdb
#=========website========
+#初始化全局变量
Config = ConfigParser()
Config.read(config_file, encoding='UTF-8')
try:
option = ReadMediaWarehouse()
except:
print('[-]Config media_warehouse read failed!')
-
-#初始化全局变量
title=''
studio=''
year=''
@@ -54,6 +53,7 @@
failed_folder= Config['common']['failed_output_folder']
success_folder=Config['common']['success_output_folder']
#=====================本地文件处理===========================
+
def moveFailedFolder():
global filepath
print('[-]Move to Failed output folder')
@@ -100,37 +100,36 @@ def getDataFromJSON(file_number): #从JSON返回元数据
global naming_rule
global location_rule
-
# ================================================网站规则添加开始================================================
- try: # 添加 需要 正则表达式的规则
- if re.search('^\d{5,}', file_number).group() in file_number:
- json_data = json.loads(avsox.main(file_number))
- if getDataState(json_data) == 0: #如果元数据获取失败,请求番号至其他网站抓取
- json_data = json.loads(javdb.main(file_number))
-
- elif re.search('\d+\D+', file_number).group() in file_number:
- json_data = json.loads(siro.main(file_number))
- if getDataState(json_data) == 0: #如果元数据获取失败,请求番号至其他网站抓取
- json_data = json.loads(javbus.main(file_number))
- elif getDataState(json_data) == 0: #如果元数据获取失败,请求番号至其他网站抓取
- json_data = json.loads(javdb.main(file_number))
-
- except: # 添加 无需 正则表达式的规则
- if 'fc2' in file_number:
- 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-')))
- elif 'FC2' in file_number:
- 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-')))
- elif 'HEYZO' in number or 'heyzo' in number or 'Heyzo' in number:
- json_data = json.loads(avsox.main(file_number))
- elif 'siro' in file_number or 'SIRO' in file_number or 'Siro' in file_number:
- json_data = json.loads(siro.main(file_number))
- else:
+ if re.match('^\d{5,}', file_number):
+ json_data = json.loads(avsox.main(file_number))
+ if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
+ json_data = json.loads(javdb.main(file_number))
+ #==
+ elif re.match('\d+\D+', file_number):
+ json_data = json.loads(siro.main(file_number))
+ if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
json_data = json.loads(javbus.main(file_number))
- if getDataState(json_data) == 0: #如果元数据获取失败,请求番号至其他网站抓取
- json_data = json.loads(avsox.main(file_number))
- elif getDataState(json_data) == 0: #如果元数据获取失败,请求番号至其他网站抓取
- json_data = json.loads(javdb.main(file_number))
+ elif getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
+ json_data = json.loads(javdb.main(file_number))
+ # ==
+ elif 'fc2' in file_number or 'FC2' in file_number:
+ json_data = json.loads(fc2fans_club.main(
+ file_number))
+ # ==
+ elif 'HEYZO' in number or 'heyzo' in number or 'Heyzo' in number:
+ json_data = json.loads(avsox.main(file_number))
+ # ==
+ elif 'siro' in file_number or 'SIRO' in file_number or 'Siro' in file_number:
+ json_data = json.loads(siro.main(file_number))
+ # ==
+ else:
+ json_data = json.loads(javbus.main(file_number))
+ if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
+ json_data = json.loads(avsox.main(file_number))
+ elif getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
+ json_data = json.loads(javdb.main(file_number))
# ================================================网站规则添加结束================================================
@@ -147,9 +146,9 @@ def getDataFromJSON(file_number): #从JSON返回元数据
try:
cover_small = json_data['cover_small']
except:
- aaaaaaa=''
+ cover_small=''
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_photo = json_data['actor_photo']
website = json_data['website']
@@ -324,12 +323,12 @@ def PrintFiles(filepath):
if cn_sub == '1':
print(" 中文字幕", file=code)
try:
- for i in tag:
+ for i in str(json_data['tag']).strip("[ ]").replace("'", '').replace(" ", '').split(','):
print(" " + i + "", file=code)
except:
aaaaa = ''
try:
- for i in tag:
+ for i in str(json_data['tag']).strip("[ ]").replace("'", '').replace(" ", '').split(','):
print(" " + i + "", file=code)
except:
aaaaaaaa = ''
diff --git a/fc2fans_club.py b/fc2fans_club.py
index e5d62df88..c246a293f 100755
--- a/fc2fans_club.py
+++ b/fc2fans_club.py
@@ -6,21 +6,23 @@
def getTitle(htmlcode): #获取厂商
#print(htmlcode)
html = etree.fromstring(htmlcode,etree.HTMLParser())
- result = str(html.xpath('/html/body/div[2]/div/div[1]/h3/text()')).strip(" ['']")
- result2 = str(re.sub('\D{2}2-\d+','',result)).replace(' ','',1)
+ result = str(html.xpath('//*[@id="container"]/div[1]/div/article/section[1]/h2/text()')).strip(" ['']")
#print(result2)
- return result2
+ return result
def getActor(htmlcode):
try:
html = etree.fromstring(htmlcode, etree.HTMLParser())
- result = str(html.xpath('/html/body/div[2]/div/div[1]/h5[5]/a/text()')).strip(" ['']")
+ result = str(html.xpath('//*[@id="container"]/div[1]/div/article/section[1]/div/div[2]/dl/dd[5]/a/text()')).strip(" ['']")
return result
except:
return ''
def getStudio(htmlcode): #获取厂商
- html = etree.fromstring(htmlcode,etree.HTMLParser())
- result = str(html.xpath('/html/body/div[2]/div/div[1]/h5[3]/a[1]/text()')).strip(" ['']")
- return result
+ try:
+ html = etree.fromstring(htmlcode, etree.HTMLParser())
+ result = str(html.xpath('//*[@id="container"]/div[1]/div/article/section[1]/div/div[2]/dl/dd[5]/a/text()')).strip(" ['']")
+ return result
+ except:
+ return ''
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(" ['']")
@@ -31,24 +33,23 @@ def getRelease(htmlcode2): #
html=etree.fromstring(htmlcode2,etree.HTMLParser())
result = str(html.xpath('//*[@id="container"]/div[1]/div/article/section[1]/div/div[2]/dl/dd[4]/text()')).strip(" ['']")
return result
-def getCover(htmlcode,number,htmlcode2): #获取厂商 #
+def getCover(htmlcode2): #获取厂商 #
#a = ADC_function.get_html('http://adult.contents.fc2.com/article_search.php?id=' + str(number).lstrip("FC2-").lstrip("fc2-").lstrip("fc2_").lstrip("fc2-") + '&utm_source=aff_php&utm_medium=source_code&utm_campaign=from_aff_php')
html = etree.fromstring(htmlcode2, etree.HTMLParser())
result = str(html.xpath('//*[@id="container"]/div[1]/div/article/section[1]/div/div[1]/a/img/@src')).strip(" ['']")
- if result == '':
- html = etree.fromstring(htmlcode, etree.HTMLParser())
- result2 = str(html.xpath('//*[@id="slider"]/ul[1]/li[1]/img/@src')).strip(" ['']")
- return 'http://fc2fans.club' + result2
+ # if result == '':
+ # html = etree.fromstring(htmlcode, etree.HTMLParser())
+ # result2 = str(html.xpath('//*[@id="slider"]/ul[1]/li[1]/img/@src')).strip(" ['']")
+ # return result2
return 'http:' + result
-def getOutline(htmlcode2,number): #获取番号 #
- #a = ADC_function.get_html('http://adult.contents.fc2.com/article_search.php?id=' + str(number).lstrip("FC2-").lstrip("fc2-").lstrip("fc2_").lstrip("fc2-") + '&utm_source=aff_php&utm_medium=source_code&utm_campaign=from_aff_php')
+def getOutline(htmlcode2): #获取番号 #
html = etree.fromstring(htmlcode2, etree.HTMLParser())
- result = str(html.xpath('//*[@id="container"]/div[1]/div/article/section[4]/p/text()')).replace("\\n",'',10000).strip(" ['']").replace("'",'',10000)
+ result = str(html.xpath('//*[@id="container"]/div[1]/div/article/section[4]/p/text()')).strip(" ['']").replace("\\n",'',10000).replace("'",'',10000).replace(', ,','').strip(' ').replace('。,',',')
return result
def getTag(htmlcode): #获取番号
html = etree.fromstring(htmlcode, etree.HTMLParser())
- result = str(html.xpath('/html/body/div[2]/div/div[1]/h5[4]/a/text()'))
- return result.strip(" ['']").replace("'",'').replace(' ','')
+ result = html.xpath('//*[@id="container"]/div[1]/div/article/section[6]/ul/li/a/text()')
+ return result
def getYear(release):
try:
result = re.search('\d{4}',release).group()
@@ -56,30 +57,28 @@ def getYear(release):
except:
return ''
-def main(number2):
- number=number2.replace('PPV','').replace('ppv','')
- htmlcode2 = ADC_function.get_html('http://adult.contents.fc2.com/article_search.php?id='+str(number).lstrip("FC2-").lstrip("fc2-").lstrip("fc2_").lstrip("fc2-")+'&utm_source=aff_php&utm_medium=source_code&utm_campaign=from_aff_php')
- htmlcode = ADC_function.get_html('http://fc2fans.club/html/FC2-' + number + '.html')
+def main(number):
+ number=number.replace('PPV','').replace('ppv','').strip('fc2_').strip('fc2-').strip('ppv-').strip('PPV-').strip('FC2_').strip('FC2-').strip('ppv-').strip('PPV-')
+ htmlcode2 = ADC_function.get_html('http://adult.contents.fc2.com/article_search.php?id='+str(number).lstrip("FC2-").lstrip("fc2-").lstrip("fc2_").lstrip("fc2-")+'')
+ #htmlcode = ADC_function.get_html('http://fc2fans.club/html/FC2-' + number + '.html')
dic = {
- 'title': getTitle(htmlcode),
- 'studio': getStudio(htmlcode),
- 'year': '',#str(re.search('\d{4}',getRelease(number)).group()),
- 'outline': getOutline(htmlcode,number),
- 'runtime': getYear(getRelease(htmlcode)),
- 'director': getStudio(htmlcode),
- 'actor': getActor(htmlcode),
- 'release': getRelease(number),
+ 'title': getTitle(htmlcode2),
+ 'studio': getStudio(htmlcode2),
+ 'year': getYear(getRelease(htmlcode2)),
+ 'outline': getOutline(htmlcode2),
+ 'runtime': getYear(getRelease(htmlcode2)),
+ 'director': getStudio(htmlcode2),
+ 'actor': getStudio(htmlcode2),
+ 'release': getRelease(htmlcode2),
'number': 'FC2-'+number,
- 'cover': getCover(htmlcode,number,htmlcode2),
+ 'cover': getCover(htmlcode2),
'imagecut': 0,
- 'tag': getTag(htmlcode),
+ 'tag': getTag(htmlcode2),
'actor_photo':'',
- 'website': 'http://fc2fans.club/html/FC2-' + number + '.html',
+ 'website': 'http://adult.contents.fc2.com/article_search.php?id=' + number,
'source': 'fc2fans_club.py',
}
- #print(getTitle(htmlcode))
- #print(getNum(htmlcode))
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'),)#.encode('UTF-8')
return js
-#print(main('1051725'))
\ No newline at end of file
+#print(main('1145465'))
\ No newline at end of file