Compare commits
101 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c66a53ade1 | ||
|
|
7aec4c4b84 | ||
|
|
cfb3511360 | ||
|
|
2adcfacf27 | ||
|
|
09dc684ff6 | ||
|
|
1bc924a6ac | ||
|
|
00db4741bc | ||
|
|
1086447369 | ||
|
|
642c8103c7 | ||
|
|
b053ae614c | ||
|
|
b7583afc9b | ||
|
|
731b08f843 | ||
|
|
64f235aaff | ||
|
|
f0d5a2a45d | ||
|
|
01521fe390 | ||
|
|
a33b882592 | ||
|
|
150b81453c | ||
|
|
a6df479b78 | ||
|
|
dd6445b2ba | ||
|
|
41051a915b | ||
|
|
32ce390939 | ||
|
|
8deec6a6c0 | ||
|
|
0fab70ff3d | ||
|
|
53bbb99a64 | ||
|
|
0e712de805 | ||
|
|
6f74254e96 | ||
|
|
4220bd708b | ||
|
|
3802d88972 | ||
|
|
8cddbf1e1b | ||
|
|
332326e5f6 | ||
|
|
27f64a81d0 | ||
|
|
7e3fa5ade8 | ||
|
|
cc362a2a26 | ||
|
|
dde6167b05 | ||
|
|
fe69f42f92 | ||
|
|
6b050cef43 | ||
|
|
c721c3c769 | ||
|
|
9f8702ca12 | ||
|
|
153b3a35b8 | ||
|
|
88e543a16f | ||
|
|
5906af6d95 | ||
|
|
39953f1870 | ||
|
|
047618a0df | ||
|
|
2da51a51d0 | ||
|
|
8c0e0a296d | ||
|
|
ce0ac607c2 | ||
|
|
f0437cf6af | ||
|
|
32bfc57eed | ||
|
|
909ca96915 | ||
|
|
341ab5b2bf | ||
|
|
d899a19419 | ||
|
|
61b0bc40de | ||
|
|
6fde3f98dd | ||
|
|
838eb9c8db | ||
|
|
687bbfce10 | ||
|
|
4b35113932 | ||
|
|
d672d4d0d7 | ||
|
|
1d3845bb91 | ||
|
|
e5effca854 | ||
|
|
bae82898da | ||
|
|
2e8e7151e3 | ||
|
|
8db74bc34d | ||
|
|
e18392d7d3 | ||
|
|
e4e32c06df | ||
|
|
09802c5632 | ||
|
|
584db78fd0 | ||
|
|
56a41604cb | ||
|
|
8228084a1d | ||
|
|
f16def5f3a | ||
|
|
c0303a57a1 | ||
|
|
07c8a7fb0e | ||
|
|
71691e1fe9 | ||
|
|
e2569e4541 | ||
|
|
51385491de | ||
|
|
bb049714cf | ||
|
|
5dcaa20a6c | ||
|
|
26652bf2ed | ||
|
|
352d2fa28a | ||
|
|
ff5ac0d599 | ||
|
|
f34888d2e7 | ||
|
|
f609e647b5 | ||
|
|
ffc280a01c | ||
|
|
fee0ae95b3 | ||
|
|
cd7e254d2e | ||
|
|
ce2995123d | ||
|
|
46e676b592 | ||
|
|
a435d645e4 | ||
|
|
76eecd1e6f | ||
|
|
3c296db204 | ||
|
|
7d6408fe29 | ||
|
|
337c84fd1c | ||
|
|
ad220c1ca6 | ||
|
|
37df711cdc | ||
|
|
92dd9cb734 | ||
|
|
64445b5105 | ||
|
|
bfdb094ee3 | ||
|
|
b38942a326 | ||
|
|
7d03a1f7f9 | ||
|
|
f9c0df7e06 | ||
|
|
b1783d8c75 | ||
|
|
908da6d006 |
117
ADC_function.py
Normal file → Executable file
117
ADC_function.py
Normal file → Executable file
@@ -1,42 +1,97 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from configparser import RawConfigParser
|
from configparser import ConfigParser
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
|
||||||
# content = open('proxy.ini').read()
|
config_file='config.ini'
|
||||||
# content = re.sub(r"\xfe\xff","", content)
|
config = ConfigParser()
|
||||||
# content = re.sub(r"\xff\xfe","", content)
|
|
||||||
# content = re.sub(r"\xef\xbb\xbf","", content)
|
|
||||||
# open('BaseConfig.cfg', 'w').write(content)
|
|
||||||
|
|
||||||
config = RawConfigParser()
|
if os.path.exists(config_file):
|
||||||
if os.path.exists('proxy.ini'):
|
try:
|
||||||
config.read('proxy.ini', encoding='UTF-8')
|
config.read(config_file, encoding='UTF-8')
|
||||||
|
except:
|
||||||
|
print('[-]Config.ini read failed! Please use the offical file!')
|
||||||
else:
|
else:
|
||||||
with open("proxy.ini", "wt", encoding='UTF-8') as code:
|
print('[+]config.ini: not found, creating...')
|
||||||
|
with open("config.ini", "wt", encoding='UTF-8') as code:
|
||||||
print("[proxy]",file=code)
|
print("[proxy]",file=code)
|
||||||
print("proxy=127.0.0.1:1080",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='JAV_output/'+actor+'/'+number",file=code)
|
||||||
|
print("naming_rule=number+'-'+title",file=code)
|
||||||
|
print("", file=code)
|
||||||
|
print("[update]",file=code)
|
||||||
|
print("update_check=1",file=code)
|
||||||
|
print("", file=code)
|
||||||
|
print("[media]", file=code)
|
||||||
|
print("media_warehouse=emby", file=code)
|
||||||
|
print("#emby or plex", file=code)
|
||||||
|
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:
|
||||||
|
config.read(config_file, encoding='UTF-8')
|
||||||
|
except:
|
||||||
|
print('[-]Config.ini read failed! Please use the offical file!')
|
||||||
|
|
||||||
|
def ReadMediaWarehouse():
|
||||||
|
return config['media']['media_warehouse']
|
||||||
|
|
||||||
|
def UpdateCheckSwitch():
|
||||||
|
check=str(config['update']['update_check'])
|
||||||
|
if check == '1':
|
||||||
|
return '1'
|
||||||
|
elif check == '0':
|
||||||
|
return '0'
|
||||||
|
elif check == '':
|
||||||
|
return '0'
|
||||||
def get_html(url,cookies = None):#网页请求核心
|
def get_html(url,cookies = None):#网页请求核心
|
||||||
if not str(config['proxy']['proxy']) == '':
|
try:
|
||||||
proxies = {
|
proxy = config['proxy']['proxy']
|
||||||
"http" : "http://" + str(config['proxy']['proxy']),
|
timeout = int(config['proxy']['timeout'])
|
||||||
"https": "https://" + str(config['proxy']['proxy'])
|
retry_count = int(config['proxy']['retry'])
|
||||||
}
|
except:
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3100.0 Safari/537.36'}
|
print('[-]Proxy config error! Please check the config.')
|
||||||
getweb = requests.get(str(url), headers=headers, proxies=proxies,cookies=cookies)
|
i = 0
|
||||||
getweb.encoding = 'utf-8'
|
while i < retry_count:
|
||||||
# print(getweb.text)
|
|
||||||
try:
|
try:
|
||||||
return getweb.text
|
if not str(config['proxy']['proxy']) == '':
|
||||||
except:
|
proxies = {"http": "http://" + proxy,"https": "https://" + proxy}
|
||||||
print('[-]Connected failed!:Proxy error')
|
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3100.0 Safari/537.36'}
|
||||||
else:
|
getweb = requests.get(str(url), headers=headers, timeout=timeout,proxies=proxies, cookies=cookies)
|
||||||
headers = {
|
getweb.encoding = 'utf-8'
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
|
return getweb.text
|
||||||
getweb = requests.get(str(url), headers=headers,cookies=cookies)
|
else:
|
||||||
getweb.encoding = 'utf-8'
|
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
|
||||||
try:
|
getweb = requests.get(str(url), headers=headers, timeout=timeout, cookies=cookies)
|
||||||
return getweb.text
|
getweb.encoding = 'utf-8'
|
||||||
except:
|
return getweb.text
|
||||||
print("[-]Connect Failed.")
|
except requests.exceptions.RequestException:
|
||||||
|
i += 1
|
||||||
|
print('[-]Connect retry '+str(i)+'/'+str(retry_count))
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
i += 1
|
||||||
|
print('[-]Connect retry '+str(i)+'/'+str(retry_count))
|
||||||
|
except requests.exceptions.ProxyError:
|
||||||
|
i += 1
|
||||||
|
print('[-]Connect retry '+str(i)+'/'+str(retry_count))
|
||||||
|
except requests.exceptions.ConnectTimeout:
|
||||||
|
i += 1
|
||||||
|
print('[-]Connect retry '+str(i)+'/'+str(retry_count))
|
||||||
|
print('[-]Connect Failed! Please check your Proxy or Network!')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
177
AV_Data_Capture.py
Normal file → Executable file
177
AV_Data_Capture.py
Normal file → Executable file
@@ -1,3 +1,6 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
@@ -5,46 +8,71 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
from ADC_function import *
|
from ADC_function import *
|
||||||
import json
|
import json
|
||||||
|
import subprocess
|
||||||
|
import shutil
|
||||||
|
from configparser import ConfigParser
|
||||||
|
|
||||||
version='0.10.6'
|
version='0.11.7'
|
||||||
|
os.chdir(os.getcwd())
|
||||||
|
|
||||||
|
input_dir='.' # 电影的读取与输出路径, 默认为当前路径
|
||||||
|
|
||||||
|
config = ConfigParser()
|
||||||
|
config.read(config_file, encoding='UTF-8')
|
||||||
|
|
||||||
def UpdateCheck():
|
def UpdateCheck():
|
||||||
html2 = get_html('https://raw.githubusercontent.com/wenead99/AV_Data_Capture/master/update_check.json')
|
if UpdateCheckSwitch() == '1':
|
||||||
html = json.loads(str(html2))
|
html = json.loads(get_html('https://raw.githubusercontent.com/wenead99/AV_Data_Capture/master/update_check.json'))
|
||||||
|
if not version == html['version']:
|
||||||
|
print('[*] * New update ' + html['version'] + ' *')
|
||||||
|
print('[*] * Download *')
|
||||||
|
print('[*] ' + html['download'])
|
||||||
|
print('[*]=====================================')
|
||||||
|
else:
|
||||||
|
print('[+]Update Check disabled!')
|
||||||
|
|
||||||
|
def set_directory(): # 设置读取与存放路径
|
||||||
|
global input_dir
|
||||||
|
# 配置项switch为1且定义了新的路径时, 更改默认存取路径
|
||||||
|
if config['directory_capture']['switch'] == '1':
|
||||||
|
custom_input = config['directory_capture']['input_directory']
|
||||||
|
if custom_input != '': # 自定义了输入路径
|
||||||
|
input_dir = format_path(custom_input)
|
||||||
|
# 若自定义了输入路径, 输出路径默认在输入路径下
|
||||||
|
CreatFolder(input_dir)
|
||||||
|
#print('[+]Working directory is "' + os.getcwd() + '".')
|
||||||
|
#print('[+]Using "' + input_dir + '" as input directory.')
|
||||||
|
|
||||||
|
def format_path(path): # 使路径兼容Linux与MacOS
|
||||||
|
if path.find('\\'): # 是仅兼容Windows的路径格式
|
||||||
|
path_list=path.split('\\')
|
||||||
|
path='/'.join(path_list) # 转换为可移植的路径格式
|
||||||
|
return path
|
||||||
|
|
||||||
if not version == html['version']:
|
|
||||||
print('[*] * New update '+html['version']+' *')
|
|
||||||
print('[*] * Download *')
|
|
||||||
print('[*] '+html['download'])
|
|
||||||
print('[*]=====================================')
|
|
||||||
|
|
||||||
def movie_lists():
|
def movie_lists():
|
||||||
#MP4
|
a2 = glob.glob( input_dir + "/*.mp4")
|
||||||
a2 = glob.glob(os.getcwd() + r"\*.mp4")
|
b2 = glob.glob( input_dir + "/*.avi")
|
||||||
# AVI
|
c2 = glob.glob( input_dir + "/*.rmvb")
|
||||||
b2 = glob.glob(os.getcwd() + r"\*.avi")
|
d2 = glob.glob( input_dir + "/*.wmv")
|
||||||
# RMVB
|
e2 = glob.glob( input_dir + "/*.mov")
|
||||||
c2 = glob.glob(os.getcwd() + r"\*.rmvb")
|
f2 = glob.glob( input_dir + "/*.mkv")
|
||||||
# WMV
|
g2 = glob.glob( input_dir + "/*.flv")
|
||||||
d2 = glob.glob(os.getcwd() + r"\*.wmv")
|
h2 = glob.glob( input_dir + "/*.ts")
|
||||||
# MOV
|
total = a2 + b2 + c2 + d2 + e2 + f2 + g2 + h2
|
||||||
e2 = glob.glob(os.getcwd() + r"\*.mov")
|
|
||||||
# MKV
|
|
||||||
f2 = glob.glob(os.getcwd() + r"\*.mkv")
|
|
||||||
# FLV
|
|
||||||
g2 = glob.glob(os.getcwd() + r"\*.flv")
|
|
||||||
# TS
|
|
||||||
h2 = glob.glob(os.getcwd() + r"\*.ts")
|
|
||||||
|
|
||||||
total = a2+b2+c2+d2+e2+f2+g2+h2
|
|
||||||
return total
|
return total
|
||||||
|
def CreatFolder(folder_path):
|
||||||
|
if not os.path.exists(folder_path): # 新建文件夹
|
||||||
|
try:
|
||||||
|
print('[+]Creating ' + folder_path)
|
||||||
|
os.makedirs(folder_path)
|
||||||
|
except:
|
||||||
|
print("[-]failed!can not be make folder '"+folder_path+"'\n[-](Please run as Administrator)")
|
||||||
|
os._exit(0)
|
||||||
def lists_from_test(custom_nuber): #电影列表
|
def lists_from_test(custom_nuber): #电影列表
|
||||||
|
|
||||||
a=[]
|
a=[]
|
||||||
a.append(custom_nuber)
|
a.append(custom_nuber)
|
||||||
return a
|
return a
|
||||||
|
|
||||||
def CEF(path):
|
def CEF(path):
|
||||||
files = os.listdir(path) # 获取路径下的子文件(夹)列表
|
files = os.listdir(path) # 获取路径下的子文件(夹)列表
|
||||||
for file in files:
|
for file in files:
|
||||||
@@ -53,29 +81,96 @@ def CEF(path):
|
|||||||
print('[+]Deleting empty folder',path + '/' + file)
|
print('[+]Deleting empty folder',path + '/' + file)
|
||||||
except:
|
except:
|
||||||
a=''
|
a=''
|
||||||
|
|
||||||
def rreplace(self, old, new, *max):
|
def rreplace(self, old, new, *max):
|
||||||
#从右开始替换文件名中内容,源字符串,将被替换的子字符串, 新字符串,用于替换old子字符串,可选字符串, 替换不超过 max 次
|
#从右开始替换文件名中内容,源字符串,将被替换的子字符串, 新字符串,用于替换old子字符串,可选字符串, 替换不超过 max 次
|
||||||
count = len(self)
|
count = len(self)
|
||||||
if max and str(max[0]).isdigit():
|
if max and str(max[0]).isdigit():
|
||||||
count = max[0]
|
count = max[0]
|
||||||
return new.join(self.rsplit(old, count))
|
return new.join(self.rsplit(old, count))
|
||||||
|
def getNumber(filepath):
|
||||||
|
try: # 试图提取番号
|
||||||
|
# ====番号获取主程序====
|
||||||
|
try: # 普通提取番号 主要处理包含减号-的番号
|
||||||
|
filepath1 = filepath.replace("_", "-")
|
||||||
|
filepath1.strip('22-sht.me').strip('-HD').strip('-hd')
|
||||||
|
filename = str(re.sub("\[\d{4}-\d{1,2}-\d{1,2}\] - ", "", filepath1)) # 去除文件名中时间
|
||||||
|
file_number = re.search('\w+-\d+', filename).group()
|
||||||
|
return file_number
|
||||||
|
except: # 提取不含减号-的番号
|
||||||
|
try: # 提取东京热番号格式 n1087
|
||||||
|
filename1 = str(re.sub("h26\d", "", filepath)).strip('Tokyo-hot').strip('tokyo-hot')
|
||||||
|
filename0 = str(re.sub(".*?\.com-\d+", "", filename1)).strip('_')
|
||||||
|
if '-C.' in filepath or '-c.' in filepath:
|
||||||
|
cn_sub = '1'
|
||||||
|
file_number = str(re.search('n\d{4}', filename0).group(0))
|
||||||
|
return file_number
|
||||||
|
except: # 提取无减号番号
|
||||||
|
filename1 = str(re.sub("h26\d", "", filepath)) # 去除h264/265
|
||||||
|
filename0 = str(re.sub(".*?\.com-\d+", "", filename1))
|
||||||
|
file_number2 = str(re.match('\w+', filename0).group())
|
||||||
|
if '-C.' in filepath or '-c.' in filepath:
|
||||||
|
cn_sub = '1'
|
||||||
|
file_number = str(file_number2.replace(re.match("^[A-Za-z]+", file_number2).group(),
|
||||||
|
re.match("^[A-Za-z]+", file_number2).group() + '-'))
|
||||||
|
return file_number
|
||||||
|
# if not re.search('\w-', file_number).group() == 'None':
|
||||||
|
# file_number = re.search('\w+-\w+', filename).group()
|
||||||
|
# 上面是插入减号-到番号中
|
||||||
|
# ====番号获取主程序=结束===
|
||||||
|
except Exception as e: # 番号提取异常
|
||||||
|
print('[-]' + str(os.path.basename(filepath)) + ' Cannot catch the number :')
|
||||||
|
print('[-]' + str(os.path.basename(filepath)) + ' :', e)
|
||||||
|
print('[-]Move ' + os.path.basename(filepath) + ' to failed folder')
|
||||||
|
#print('[-]' + filepath + ' -> ' + output_dir + '/failed/')
|
||||||
|
#shutil.move(filepath, output_dir + '/failed/')
|
||||||
|
except IOError as e2:
|
||||||
|
print('[-]' + str(os.path.basename(filepath)) + ' Cannot catch the number :')
|
||||||
|
print('[-]' + str(os.path.basename(filepath)) + ' :', e2)
|
||||||
|
#print('[-]' + filepath + ' -> ' + output_dir + '/failed/')
|
||||||
|
#shutil.move(filepath, output_dir + '/failed/')
|
||||||
|
|
||||||
|
def RunCore(movie):
|
||||||
|
# 异步调用core.py, core.py作为子线程执行, 本程序继续执行.
|
||||||
|
if os.path.exists('core.py'):
|
||||||
|
cmd_arg=[sys.executable,'core.py',movie,'--number',getNumber(movie)] #从py文件启动(用于源码py)
|
||||||
|
elif os.path.exists('core.exe'):
|
||||||
|
cmd_arg=['core.exe',movie,'--number',getNumber(movie)] #从exe启动(用于EXE版程序)
|
||||||
|
elif os.path.exists('core.py') and os.path.exists('core.exe'):
|
||||||
|
cmd_arg=[sys.executable,'core.py',movie,'--number',getNumber(movie)] #从py文件启动(用于源码py)
|
||||||
|
process=subprocess.Popen(cmd_arg)
|
||||||
|
return process
|
||||||
|
|
||||||
if __name__ =='__main__':
|
if __name__ =='__main__':
|
||||||
print('[*]===========AV Data Capture===========')
|
print('[*]===========AV Data Capture===========')
|
||||||
print('[*] Version '+version)
|
print('[*] Version '+version)
|
||||||
print('[*]=====================================')
|
print('[*]=====================================')
|
||||||
UpdateCheck()
|
UpdateCheck()
|
||||||
os.chdir(os.getcwd())
|
os.chdir(os.getcwd())
|
||||||
for i in movie_lists(): #遍历电影列表 交给core处理
|
set_directory()
|
||||||
if '_' in i:
|
|
||||||
os.rename(re.search(r'[^\\/:*?"<>|\r\n]+$', i).group(), rreplace(re.search(r'[^\\/:*?"<>|\r\n]+$', i).group(), '_', '-', 1))
|
|
||||||
i = rreplace(re.search(r'[^\\/:*?"<>|\r\n]+$', i).group(), '_', '-', 1)
|
|
||||||
os.system('python core.py' + ' "' + i + '"') #选择从py文件启动 (用于源码py)
|
|
||||||
#os.system('core.exe' + ' "' + i + '"') #选择从exe文件启动(用于EXE版程序)
|
|
||||||
print("[*]=====================================")
|
|
||||||
|
|
||||||
print("[!]Cleaning empty folders")
|
|
||||||
CEF('JAV_output')
|
count = 0
|
||||||
|
movies = movie_lists()
|
||||||
|
count_all = str(len(movies))
|
||||||
|
print('[+]Find ' + str(len(movies)) + ' movies.')
|
||||||
|
process_list=[]
|
||||||
|
for movie in movies: #遍历电影列表 交给core处理
|
||||||
|
num=getNumber(movie) # 获取番号
|
||||||
|
if num is None:
|
||||||
|
movies.remove(movie) # 未获取到番号, 则将影片从列表移除
|
||||||
|
count_all=count_all-1
|
||||||
|
continue
|
||||||
|
print("[!]Making Data for [" + movie + "], the number is [" + num + "]")
|
||||||
|
process=RunCore(movie)
|
||||||
|
process_list.append(process)
|
||||||
|
print("[*]=====================================")
|
||||||
|
for i in range(len(movies)):
|
||||||
|
process_list[i].communicate()
|
||||||
|
percentage = str((i+1)/int(count_all)*100)[:4]+'%'
|
||||||
|
print('[!] - '+percentage+' ['+str(count)+'/'+count_all+'] -')
|
||||||
|
print("[!]The [" + getNumber(movies[i]) + "] process is done.")
|
||||||
|
print("[*]=====================================")
|
||||||
|
|
||||||
|
CEF(input_dir)
|
||||||
print("[+]All finished!!!")
|
print("[+]All finished!!!")
|
||||||
input("[+][+]Press enter key exit, you can check the error messge before you exit.\n[+][+]按回车键结束,你可以在结束之前查看错误信息。")
|
input("[+][+]Press enter key exit, you can check the error messge before you exit.\n[+][+]按回车键结束,你可以在结束之前查看和错误信息。")
|
||||||
|
|||||||
364
README.md
364
README.md
@@ -1,154 +1,210 @@
|
|||||||
# AV Data Capture 日本AV元数据刮削器
|
# AV Data Capture
|
||||||
# 目录
|
|
||||||
* [前言](#前言)
|
|
||||||
* [捐助二维码](#捐助二维码)
|
<a title="Hits" target="_blank" href="https://github.com/yoshiko2/AV_Data_Capture"><img src="https://hits.b3log.org/yoshiko2/AV_Data_Capture.svg"></a>
|
||||||
* [效果图](#效果图)
|

|
||||||
* [免责声明](#免责声明)
|
<br>
|
||||||
* [如何使用](#如何使用)
|

|
||||||
* [下载](#下载)
|
<br>
|
||||||
* [简明教程](#简要教程)
|
|
||||||
* [模块安装](#1请安装模块在cmd终端逐条输入以下命令安装)
|
|
||||||
* [配置](#2配置proxyini)
|
**日本电影元数据 抓取工具 | 刮削器**,配合本地影片管理软件EMBY,KODI管理本地影片,该软件起到分类与元数据抓取作用,利用元数据信息来分类,供本地影片分类整理使用。
|
||||||
* [运行软件](#4运行-av_data_capturepyexe)
|
|
||||||
* [异常处理(重要)](#5异常处理重要)
|
# 目录
|
||||||
* [导入至EMBY](#7把jav_output文件夹导入到embykodi中根据封面选片子享受手冲乐趣)
|
* [免责声明](#免责声明)
|
||||||
* [输出文件示例](#8输出的文件如下)
|
* [注意](#注意)
|
||||||
* [写在后面](#9写在后面)
|
* [你问我答 FAQ](#你问我答-faq)
|
||||||
* [软件流程图](#10软件流程图)
|
* [效果图](#效果图)
|
||||||
* []()
|
* [如何使用](#如何使用)
|
||||||
# 前言
|
* [下载](#下载)
|
||||||
  目前,我下的AV越来越多,也意味着AV要**集中地管理**,形成本地媒体库。现在有两款主流的AV元数据获取器,"EverAver"和"Javhelper"。前者的优点是元数据获取比较全,缺点是不能批量处理;后者优点是可以批量处理,但是元数据不够全。<br>
|
* [简明教程](#简要教程)
|
||||||
  为此,综合上述软件特点,我写出了本软件,为了方便的管理本地AV,和更好的手冲体验。<br>
|
* [模块安装](#1请安装模块在cmd终端逐条输入以下命令安装)
|
||||||
  希望大家可以认真耐心地看完本文档,你的耐心换来的是完美的管理方式。<br>
|
* [配置](#2配置configini)
|
||||||
  本软件更新可能比较**频繁**,麻烦诸位用户**积极更新新版本**以获得**最佳体验**。
|
* [运行软件](#4运行-av_data_capturepyexe)
|
||||||
|
* [异常处理(重要)](#5异常处理重要)
|
||||||
**可以结合pockies大神的[ 打造本地AV(毛片)媒体库 ](https://pockies.github.io/2019/03/25/everaver-emby-kodi/)看本文档**<br>
|
* [导入至媒体库](#7把jav_output文件夹导入到embykodi中根据封面选片子享受手冲乐趣)
|
||||||
**tg官方电报群:[ 点击进群](https://t.me/AV_Data_Capture_Official)**<br>
|
* [写在后面](#8写在后面)
|
||||||
**推荐用法: 使用该软件后,对于不能正常获取元数据的电影可以用[ Everaver ](http://everaver.blogspot.com/)来补救**<br>
|
|
||||||
暂不支持多P电影<br>
|
# 免责声明
|
||||||
[回到目录](#目录)
|
1.本软件仅供**技术交流,学术交流**使用,本项目旨在学习 Python3<br>
|
||||||
|
2.本软件禁止用于任何非法用途<br>
|
||||||
|
3.使用者使用该软件产生的一切法律后果由使用者承担<br>
|
||||||
# 效果图
|
4.不可使用于商业和个人其他意图<br>
|
||||||
**由于法律因素,图片必须经马赛克处理**<br>
|
|
||||||

|
# 注意
|
||||||
<br>
|
**推荐用法: 使用该软件后,对于不能正常获取元数据的电影可以用 Everaver 来补救**<br>
|
||||||
[回到目录](#目录)
|
暂不支持多P电影<br>
|
||||||
|
|
||||||
# 捐助二维码
|
# 你问我答 FAQ
|
||||||
如果你觉得本软件好用,可以考虑捐助作者,多少钱无所谓,不强求,你的支持就是我的动力,非常感谢您的捐助
|
### F:这软件能下片吗?
|
||||||
<br>
|
**Q**:该软件不提供任何影片下载地址,仅供本地影片分类整理使用。
|
||||||
[回到目录](#目录)
|
### F:什么是元数据?
|
||||||
|
**Q**:元数据包括了影片的:封面,导演,演员,简介,类型......
|
||||||
# 免责声明
|
### F:软件收费吗?
|
||||||
1.本软件仅供技术交流,学术交流使用<br>
|
**Q**:软件永久免费。除了 **作者** 钦点以外,给那些 **利用本软件牟利** 的人送上 **骨灰盒-全家族 | 崭新出厂**
|
||||||
2.本软件不提供任何有关淫秽色情的影视下载方式<br>
|
### F:软件运行异常怎么办?
|
||||||
3.使用者使用该软件产生的一切法律后果由使用者承担<br>
|
**Q**:认真看 [异常处理(重要)](#5异常处理重要)
|
||||||
4.该软件禁止任何商用行为<br>
|
|
||||||
[回到目录](#目录)
|
# 效果图
|
||||||
|
**图片来自网络**,由于相关法律法规,具体效果请自行联想
|
||||||
# 如何使用
|

|
||||||
### 下载
|
<br>
|
||||||
* release的程序可脱离python环境运行,可跳过 [模块安装](#1请安装模块在cmd终端逐条输入以下命令安装)<br>下载地址(**仅限Windows**):https://github.com/wenead99/AV_Data_Capture/releases
|
|
||||||
* Linux,MacOS请下载源码包运行
|
# 如何使用
|
||||||
### 简要教程:<br>
|
### 下载
|
||||||
**1.把软件拉到和电影的同一目录<br>2.设置ini文件的代理(路由器拥有自动代理功能的可以把proxy=后面内容去掉)<br>3.运行软件等待完成<br>4.把JAV_output导入至KODI,EMBY中。<br>详细请看以下教程**<br>
|
* release的程序可脱离**python环境**运行,可跳过 [模块安装](#1请安装模块在cmd终端逐条输入以下命令安装)<br>Release 下载地址(**仅限Windows**):<br>[](https://github.com/yoshiko2/AV_Data_Capture/releases/download/0.11.6/Beta11.6.zip)<br>
|
||||||
[回到目录](#目录)
|
* Linux,MacOS请下载源码包运行
|
||||||
|
|
||||||
## 1.请安装模块,在CMD/终端逐条输入以下命令安装
|
* Windows Python环境:[点击前往](https://www.python.org/downloads/windows/) 选中executable installer下载
|
||||||
```python
|
* MacOS Python环境:[点击前往](https://www.python.org/downloads/mac-osx/)
|
||||||
pip install requests
|
* Linux Python环境:Linux用户懂的吧,不解释下载地址
|
||||||
```
|
### 简要教程:<br>
|
||||||
###
|
**1.把软件拉到和电影的同一目录<br>2.设置ini文件的代理(路由器拥有自动代理功能的可以把proxy=后面内容去掉)<br>3.运行软件等待完成<br>4.把JAV_output导入至KODI,EMBY中。<br>详细请看以下教程**<br>
|
||||||
```python
|
|
||||||
pip install pyquery
|
## 1.请安装模块,在CMD/终端逐条输入以下命令安装
|
||||||
```
|
```python
|
||||||
###
|
pip install requests
|
||||||
```python
|
```
|
||||||
pip install lxml
|
###
|
||||||
```
|
```python
|
||||||
###
|
pip install pyquery
|
||||||
```python
|
```
|
||||||
pip install Beautifulsoup4
|
###
|
||||||
```
|
```python
|
||||||
###
|
pip install lxml
|
||||||
```python
|
```
|
||||||
pip install pillow
|
###
|
||||||
```
|
```python
|
||||||
###
|
pip install Beautifulsoup4
|
||||||
|
```
|
||||||
|
###
|
||||||
[回到目录](#目录)
|
```python
|
||||||
|
pip install pillow
|
||||||
## 2.配置proxy.ini
|
```
|
||||||
#### 1.针对网络审查国家或地区的代理设置
|
###
|
||||||
打开```proxy.ini```,在```[proxy]```下的```proxy```行设置本地代理地址和端口,支持Shadowsocks/R,V2RAY本地代理端口:<br>
|
|
||||||
例子:```proxy=127.0.0.1:1080```<br>
|
## 2.配置config.ini
|
||||||
**(路由器拥有自动代理功能的可以把proxy=后面内容去掉)**<br>
|
config.ini
|
||||||
**如果遇到tineout错误,可以把文件的proxy=后面的地址和端口删除,并开启vpn全局模式,或者重启电脑,vpn,网卡**<br>
|
>[proxy]<br>
|
||||||
[回到目录](#目录)
|
>proxy=127.0.0.1:1080<br>
|
||||||
|
>timeout=10<br>
|
||||||
#### 2.(可选)设置自定义目录和影片重命名规则
|
>retry=3<br>
|
||||||
**已有默认配置**<br>
|
>
|
||||||
##### 命名参数<br>
|
>[Name_Rule]<br>
|
||||||
>title = 片名<br>
|
>location_rule='JAV_output/'+actor+'/['+number+']-'+title<br>
|
||||||
>actor = 演员<br>
|
>naming_rule=number+'-'+title<br>
|
||||||
>studio = 公司<br>
|
>
|
||||||
>director = 导演<br>
|
>[update]<br>
|
||||||
>release = 发售日<br>
|
>update_check=1<br>
|
||||||
>year = 发行年份<br>
|
>
|
||||||
>number = 番号<br>
|
>[media]<br>
|
||||||
>cover = 封面链接<br>
|
>media_warehouse=emby<br>
|
||||||
>tag = 类型<br>
|
>#emby or plex<br>
|
||||||
>outline = 简介<br>
|
>#plex only test!<br>
|
||||||
>runtime = 时长<br>
|
>
|
||||||
##### **例子**:<br>
|
>[directory_capture]<br>
|
||||||
>目录结构规则:location_rule='JAV_output/'+actor+'/'+number **不推荐修改目录结构规则,抓取数据时新建文件夹容易出错**<br>
|
>switch=0<br>
|
||||||
>影片命名规则:naming_rule='['+number+']-'+title<br> **在EMBY,KODI等本地媒体库显示的标题**
|
>directory=<br>
|
||||||
[回到目录](#目录)
|
>
|
||||||
## 3.把软件拷贝和AV的统一目录下
|
>#everyone switch:1=on, 0=off<br>
|
||||||
## 4.运行 ```AV_Data_capture.py/.exe```
|
|
||||||
你也可以把单个影片拖动到core程序<br>
|
### 1.网络设置
|
||||||
<br>
|
#### * 针对“某些地区”的代理设置
|
||||||
[回到目录](#目录)
|
打开```config.ini```,在```[proxy]```下的```proxy```行设置本地代理地址和端口,支持Shadowxxxx/X,V2XXX本地代理端口:<br>
|
||||||
## 5.异常处理(重要)
|
例子:```proxy=127.0.0.1:1080```<br>素人系列抓取建议使用日本代理<br>
|
||||||
### 关于连接拒绝的错误
|
**路由器拥有自动代理功能的可以把proxy=后面内容去掉**<br>
|
||||||
请设置好[代理](#1针对网络审查国家或地区的代理设置)<br>
|
**本地代理软件开全局模式的同志同上**<br>
|
||||||
|
**如果遇到tineout错误,可以把文件的proxy=后面的地址和端口删除,并开启vpn全局模式,或者重启电脑,vpn,网卡**<br>
|
||||||
|
#### 连接超时重试设置
|
||||||
[回到目录](#目录)
|
>[proxy]<br>
|
||||||
### 关于番号提取失败或者异常
|
>timeout=10<br>
|
||||||
**目前可以提取元素的影片:JAVBUS上有元数据的电影,素人系列:300Maan,259luxu,siro等,FC2系列**<br>
|
|
||||||
>下一张图片来自Pockies的blog:https://pockies.github.io/2019/03/25/everaver-emby-kodi/ 原作者已授权<br>
|
10为超时重试时间 单位:秒
|
||||||
|
#### 连接重试次数设置
|
||||||

|
>[proxy]<br>
|
||||||
|
>retry=3<br>
|
||||||
目前作者已经完善了番号提取机制,功能较为强大,可提取上述文件名的的番号,如果出现提取失败或者异常的情况,请用以下规则命名<br>
|
3即为重试次数
|
||||||
**妈蛋不要喂软件那么多野鸡片子,不让软件好好活了,操**
|
|
||||||
```
|
#### 检查更新开关
|
||||||
COSQ-004.mp4
|
>[update]<br>
|
||||||
```
|
>update_check=1<br>
|
||||||
|
0为关闭,1为开启,不建议关闭
|
||||||
文件名中间要有下划线或者减号"_","-",没有多余的内容只有番号为最佳,可以让软件更好获取元数据
|
PLEX请安装插件:```XBMCnfoMoviesImporter```
|
||||||
对于多影片重命名,可以用[ReNamer](http://www.den4b.com/products/renamer)来批量重命名<br>
|
|
||||||
[回到目录](#目录)
|
##### 媒体库选择
|
||||||
|
>[media]<br>
|
||||||
|
>media_warehouse=emby<br>
|
||||||
## 6.软件会自动把元数据获取成功的电影移动到JAV_output文件夹中,根据女优分类,失败的电影移动到failed文件夹中。
|
>#emby or plex<br>
|
||||||
## 7.把JAV_output文件夹导入到EMBY,KODI中,根据封面选片子,享受手冲乐趣
|
>#plex only test!<br>
|
||||||
cookies大神的EMBY教程:[链接](https://pockies.github.io/2019/03/25/everaver-emby-kodi/#%E5%AE%89%E8%A3%85emby%E5%B9%B6%E6%B7%BB%E5%8A%A0%E5%AA%92%E4%BD%93%E5%BA%93)<br>
|
建议选择emby, plex不完善
|
||||||
[回到目录](#目录)
|
|
||||||
## 8.输出的文件如下
|
#### 抓取目录选择
|
||||||

|
>[directory_capture]<br>
|
||||||

|
>switch=0<br>
|
||||||
<br>
|
>input_directory=<br>
|
||||||
[回到目录](#目录)
|
>output_directory=<br>
|
||||||
## 9.写在后面
|
switch为1时,目录自定义才会被触发,此时可以指定抓取任意目录下的影片, 并指定存放的目录;如果为0则不触发,抓取和程序同一目录下的影片,directory不生效. 如果仅指定input_directory, output_directory默认与input_directory相同.
|
||||||
怎么样,看着自己的AV被这样完美地管理,是不是感觉成就感爆棚呢?<br>
|
|
||||||
[回到目录](#目录)
|
### (可选)设置自定义目录和影片重命名规则
|
||||||
## 10.软件流程图
|
**已有默认配置**<br>
|
||||||
<br>
|
##### 命名参数<br>
|
||||||
[回到目录](#目录)
|
>title = 片名<br>
|
||||||
|
>actor = 演员<br>
|
||||||
|
>studio = 公司<br>
|
||||||
|
>director = 导演<br>
|
||||||
|
>release = 发售日<br>
|
||||||
|
>year = 发行年份<br>
|
||||||
|
>number = 番号<br>
|
||||||
|
>cover = 封面链接<br>
|
||||||
|
>tag = 类型<br>
|
||||||
|
>outline = 简介<br>
|
||||||
|
>runtime = 时长<br>
|
||||||
|
##### **例子**:<br>
|
||||||
|
目录结构规则:```location_rule='JAV_output/'+actor+'/'+number```<br> **不推荐修改时在这里添加title**,有时title过长,因为Windows API问题,抓取数据时新建文件夹容易出错。<br>
|
||||||
|
影片命名规则:```naming_rule='['+number+']-'+title```<br> **在EMBY,KODI等本地媒体库显示的标题,不影响目录结构下影片文件的命名**,依旧是 番号+后缀。
|
||||||
|
### 3.更新开关
|
||||||
|
>[update]<br>update_check=1<br>
|
||||||
|
1为开,0为关
|
||||||
|
## 3.把软件拷贝和电影的统一目录下
|
||||||
|
## 4.运行 ```AV_Data_capture.py/.exe```
|
||||||
|
当文件名包含:<br>
|
||||||
|
中文,字幕,-c., -C., 处理元数据时会加上**中文字幕**标签
|
||||||
|
## 5.异常处理(重要)
|
||||||
|
### 请确保软件是完整地!确保ini文件内容是和下载提供ini文件内容的一致的!
|
||||||
|
### 关于软件打开就闪退
|
||||||
|
可以打开cmd命令提示符,把 ```AV_Data_capture.py/.exe```拖进cmd窗口回车运行,查看错误,出现的错误信息**依据以下条目解决**
|
||||||
|
### 关于 ```Updata_check``` 和 ```JSON``` 相关的错误
|
||||||
|
跳转 [网络设置](#1网络设置)
|
||||||
|
### 关于```FileNotFoundError: [WinError 3] 系统找不到指定的路径。: 'JAV_output''```
|
||||||
|
在软件所在文件夹下新建 JAV_output 文件夹,可能是你没有把软件拉到和电影的同一目录
|
||||||
|
### 关于连接拒绝的错误
|
||||||
|
请设置好[代理](#1针对某些地区的代理设置)<br>
|
||||||
|
### 关于Nonetype,xpath报错
|
||||||
|
同上<br>
|
||||||
|
### 关于番号提取失败或者异常
|
||||||
|
**目前可以提取元素的影片:JAVBUS上有元数据的电影,素人系列:300Maan,259luxu,siro等,FC2系列**<br>
|
||||||
|
>下一张图片来自Pockies的blog 原作者已授权<br>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
目前作者已经完善了番号提取机制,功能较为强大,可提取上述文件名的的番号,如果出现提取失败或者异常的情况,请用以下规则命名<br>
|
||||||
|
**妈蛋不要喂软件那么多野鸡片子,不让软件好好活了,操**
|
||||||
|
```
|
||||||
|
COSQ-004.mp4
|
||||||
|
```
|
||||||
|
|
||||||
|
针对 **野鸡番号** ,你需要把文件名命名为与抓取网站提供的番号一致(文件拓展名除外),然后把文件拖拽至core.exe/.py<br>
|
||||||
|
**野鸡番号**:比如 ```XXX-XXX-1```, ```1301XX-MINA_YUKA``` 这种**野鸡**番号,在javbus等资料库存在的作品。<br>**重要**:除了 **影片文件名** ```XXXX-XXX-C```,后面这种-C的是指电影有中文字幕!<br>
|
||||||
|
条件:文件名中间要有下划线或者减号"_","-",没有多余的内容只有番号为最佳,可以让软件更好获取元数据
|
||||||
|
对于多影片重命名,可以用[ReNamer](http://www.den4b.com/products/renamer)来批量重命名<br>
|
||||||
|
### 关于PIL/image.py
|
||||||
|
暂时无解,可能是网络问题或者pillow模块打包问题,你可以用源码运行(要安装好第一步的模块)
|
||||||
|
|
||||||
|
|
||||||
|
## 6.软件会自动把元数据获取成功的电影移动到JAV_output文件夹中,根据演员分类,失败的电影移动到failed文件夹中。
|
||||||
|
## 7.把JAV_output文件夹导入到EMBY,KODI中,等待元数据刷新,完成
|
||||||
|
## 8.写在后面
|
||||||
|
怎么样,看着自己的日本电影被这样完美地管理,是不是感觉成就感爆棚呢?<br>
|
||||||
|
**tg官方电报群:[ 点击进群](https://t.me/AV_Data_Capture_Official)**<br>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
21
config.ini
Normal file
21
config.ini
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
[proxy]
|
||||||
|
proxy=127.0.0.1:1080
|
||||||
|
timeout=10
|
||||||
|
retry=3
|
||||||
|
|
||||||
|
[Name_Rule]
|
||||||
|
location_rule='JAV_output/'+actor+'/'+number
|
||||||
|
naming_rule=number+'-'+title
|
||||||
|
|
||||||
|
[update]
|
||||||
|
update_check=1
|
||||||
|
|
||||||
|
[media]
|
||||||
|
media_warehouse=emby
|
||||||
|
#emby or plex
|
||||||
|
#plex only test!
|
||||||
|
|
||||||
|
[directory_capture]
|
||||||
|
input_directory=
|
||||||
|
|
||||||
|
#everyone switch:1=on, 0=off
|
||||||
526
core.py
Normal file → Executable file
526
core.py
Normal file → Executable file
@@ -1,3 +1,6 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
@@ -10,6 +13,8 @@ import fc2fans_club
|
|||||||
import siro
|
import siro
|
||||||
from ADC_function import *
|
from ADC_function import *
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
import argparse
|
||||||
|
import javdb
|
||||||
|
|
||||||
#初始化全局变量
|
#初始化全局变量
|
||||||
title=''
|
title=''
|
||||||
@@ -25,23 +30,43 @@ number=''
|
|||||||
cover=''
|
cover=''
|
||||||
imagecut=''
|
imagecut=''
|
||||||
tag=[]
|
tag=[]
|
||||||
|
cn_sub=''
|
||||||
|
path=''
|
||||||
|
houzhui=''
|
||||||
|
website=''
|
||||||
|
json_data={}
|
||||||
|
actor_photo={}
|
||||||
naming_rule =''#eval(config['Name_Rule']['naming_rule'])
|
naming_rule =''#eval(config['Name_Rule']['naming_rule'])
|
||||||
location_rule=''#eval(config['Name_Rule']['location_rule'])
|
location_rule=''#eval(config['Name_Rule']['location_rule'])
|
||||||
|
|
||||||
|
Config = ConfigParser()
|
||||||
|
Config.read(config_file, encoding='UTF-8')
|
||||||
|
try:
|
||||||
|
option = ReadMediaWarehouse()
|
||||||
|
except:
|
||||||
|
print('[-]Config media_warehouse read failed!')
|
||||||
|
|
||||||
#=====================本地文件处理===========================
|
#=====================本地文件处理===========================
|
||||||
|
def moveFailedFolder():
|
||||||
|
global filepath
|
||||||
|
print('[-]Move to "failed"')
|
||||||
|
#print('[-]' + filepath + ' -> ' + output_dir + '/failed/')
|
||||||
|
#os.rename(filepath, output_dir + '/failed/')
|
||||||
|
os._exit(0)
|
||||||
def argparse_get_file():
|
def argparse_get_file():
|
||||||
import argparse
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("file", help="Write the file path on here")
|
parser.add_argument("file", help="Write the file path on here")
|
||||||
|
parser.add_argument("--number", help="Enter Number on here", default='')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
return args.file
|
return (args.file, args.number)
|
||||||
def CreatFailedFolder():
|
def CreatFailedFolder():
|
||||||
if not os.path.exists('failed/'): # 新建failed文件夹
|
if not os.path.exists('/failed/'): # 新建failed文件夹
|
||||||
try:
|
try:
|
||||||
os.makedirs('failed/')
|
os.makedirs('/failed/')
|
||||||
except:
|
except:
|
||||||
print("[-]failed!can not be make folder 'failed'\n[-](Please run as Administrator)")
|
print("[-]failed!can not be make folder 'failed'\n[-](Please run as Administrator)")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
def getNumberFromFilename(filepath):
|
def getDataFromJSON(file_number): #从JSON返回元数据
|
||||||
global title
|
global title
|
||||||
global studio
|
global studio
|
||||||
global year
|
global year
|
||||||
@@ -56,106 +81,81 @@ def getNumberFromFilename(filepath):
|
|||||||
global imagecut
|
global imagecut
|
||||||
global tag
|
global tag
|
||||||
global image_main
|
global image_main
|
||||||
|
global cn_sub
|
||||||
|
global website
|
||||||
|
global actor_photo
|
||||||
|
|
||||||
global naming_rule
|
global naming_rule
|
||||||
global location_rule
|
global location_rule
|
||||||
|
|
||||||
#================================================获取文件番号================================================
|
|
||||||
try: #试图提取番号
|
|
||||||
# ====番号获取主程序====
|
|
||||||
try: # 普通提取番号 主要处理包含减号-的番号
|
|
||||||
filepath.strip('22-sht.me').strip('-HD').strip('-hd')
|
|
||||||
filename = str(re.sub("\[\d{4}-\d{1,2}-\d{1,2}\] - ", "", filepath)) # 去除文件名中文件名
|
|
||||||
file_number = re.search('\w+-\d+', filename).group()
|
|
||||||
except: # 提取不含减号-的番号
|
|
||||||
try: # 提取东京热番号格式 n1087
|
|
||||||
filename1 = str(re.sub("h26\d", "", filepath)).strip('Tokyo-hot').strip('tokyo-hot')
|
|
||||||
filename0 = str(re.sub(".*?\.com-\d+", "", filename1)).strip('_')
|
|
||||||
file_number = str(re.search('n\d{4}', filename0).group(0))
|
|
||||||
except: # 提取无减号番号
|
|
||||||
filename1 = str(re.sub("h26\d", "", filepath)) # 去除h264/265
|
|
||||||
filename0 = str(re.sub(".*?\.com-\d+", "", filename1))
|
|
||||||
file_number2 = str(re.match('\w+', filename0).group())
|
|
||||||
file_number = str(file_number2.replace(re.match("^[A-Za-z]+", file_number2).group(),re.match("^[A-Za-z]+", file_number2).group() + '-'))
|
|
||||||
#if not re.search('\w-', file_number).group() == 'None':
|
|
||||||
#file_number = re.search('\w+-\w+', filename).group()
|
|
||||||
#上面是插入减号-到番号中
|
|
||||||
print("[!]Making Data for [" + filename + "],the number is [" + file_number + "]")
|
|
||||||
# ====番号获取主程序=结束===
|
|
||||||
except Exception as e: #番号提取异常
|
|
||||||
print('[-]'+str(os.path.basename(filepath))+' Cannot catch the number :')
|
|
||||||
print('[-]' + str(os.path.basename(filepath)) + ' :', e)
|
|
||||||
print('[-]Move ' + os.path.basename(filepath) + ' to failed folder')
|
|
||||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
|
||||||
os._exit(0)
|
|
||||||
except IOError as e2:
|
|
||||||
print('[-]' + str(os.path.basename(filepath)) + ' Cannot catch the number :')
|
|
||||||
print('[-]' + str(os.path.basename(filepath)) + ' :',e2)
|
|
||||||
print('[-]Move ' + os.path.basename(filepath) + ' to failed folder')
|
|
||||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
|
||||||
os._exit(0)
|
|
||||||
try:
|
|
||||||
|
|
||||||
|
# ================================================网站规则添加开始================================================
|
||||||
|
|
||||||
|
try: # 添加 需要 正则表达式的规则
|
||||||
|
# =======================javdb.py=======================
|
||||||
|
if re.search('^\d{5,}', file_number).group() in file_number:
|
||||||
|
json_data = json.loads(javbus.main_uncensored(file_number))
|
||||||
|
except: # 添加 无需 正则表达式的规则
|
||||||
|
# ====================fc2fans_club.py====================
|
||||||
|
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 'siro' in number or 'SIRO' in number or 'Siro' in number:
|
||||||
|
json_data = json.loads(siro.main(file_number))
|
||||||
|
# =======================javbus.py=======================
|
||||||
|
else:
|
||||||
|
json_data = json.loads(javbus.main(file_number))
|
||||||
|
|
||||||
|
# ================================================网站规则添加结束================================================
|
||||||
|
|
||||||
# ================================================网站规则添加开始================================================
|
title = str(json_data['title']).replace(' ','')
|
||||||
|
studio = json_data['studio']
|
||||||
|
year = json_data['year']
|
||||||
|
outline = json_data['outline']
|
||||||
|
runtime = json_data['runtime']
|
||||||
|
director = json_data['director']
|
||||||
|
actor_list = str(json_data['actor']).strip("[ ]").replace("'", '').split(',') # 字符串转列表
|
||||||
|
release = json_data['release']
|
||||||
|
number = json_data['number']
|
||||||
|
cover = json_data['cover']
|
||||||
|
imagecut = json_data['imagecut']
|
||||||
|
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']
|
||||||
|
|
||||||
try: #添加 需要 正则表达式的规则
|
if title == '' or number == '':
|
||||||
#=======================javbus.py=======================
|
print('[-]Movie Data not found!')
|
||||||
if re.search('^\d{5,}', file_number).group() in filename:
|
moveFailedFolder()
|
||||||
json_data = json.loads(javbus.main_uncensored(file_number))
|
|
||||||
except: #添加 无需 正则表达式的规则
|
|
||||||
# ====================fc2fans_club.py===================
|
|
||||||
if 'fc2' in filename:
|
|
||||||
json_data = json.loads(fc2fans_club.main(file_number.strip('fc2_').strip('fc2-').strip('ppv-').strip('PPV-')))
|
|
||||||
elif 'FC2' in filename:
|
|
||||||
json_data = json.loads(fc2fans_club.main(file_number.strip('FC2_').strip('FC2-').strip('ppv-').strip('PPV-')))
|
|
||||||
#print(file_number.strip('FC2_').strip('FC2-').strip('ppv-').strip('PPV-'))
|
|
||||||
#=======================javbus.py=======================
|
|
||||||
else:
|
|
||||||
json_data = json.loads(javbus.main(file_number))
|
|
||||||
|
|
||||||
|
# ====================处理异常字符====================== #\/:*?"<>|
|
||||||
|
if '\\' in title:
|
||||||
|
title=title.replace('\\', ' ')
|
||||||
|
elif '/' in title:
|
||||||
|
title=title.replace('/', '')
|
||||||
|
elif ':' in title:
|
||||||
|
title=title.replace('/', '')
|
||||||
|
elif '*' in title:
|
||||||
|
title=title.replace('*', '')
|
||||||
|
elif '?' in title:
|
||||||
|
title=title.replace('?', '')
|
||||||
|
elif '"' in title:
|
||||||
|
title=title.replace('"', '')
|
||||||
|
elif '<' in title:
|
||||||
|
title=title.replace('<', '')
|
||||||
|
elif '>' in title:
|
||||||
|
title=title.replace('>', '')
|
||||||
|
elif '|' in title:
|
||||||
|
title=title.replace('|', '')
|
||||||
|
# ====================处理异常字符 END================== #\/:*?"<>|
|
||||||
|
|
||||||
|
naming_rule = eval(config['Name_Rule']['naming_rule'])
|
||||||
#================================================网站规则添加结束================================================
|
location_rule = eval(config['Name_Rule']['location_rule'])
|
||||||
|
def creatFolder(): #创建文件夹
|
||||||
|
global actor
|
||||||
|
|
||||||
|
|
||||||
title = json_data['title']
|
|
||||||
studio = json_data['studio']
|
|
||||||
year = json_data['year']
|
|
||||||
outline = json_data['outline']
|
|
||||||
runtime = json_data['runtime']
|
|
||||||
director = json_data['director']
|
|
||||||
actor_list = str(json_data['actor']).strip("[ ]").replace("'",'').replace(" ",'').split(',') #字符串转列表
|
|
||||||
release = json_data['release']
|
|
||||||
number = json_data['number']
|
|
||||||
cover = json_data['cover']
|
|
||||||
imagecut = json_data['imagecut']
|
|
||||||
tag = str(json_data['tag']).strip("[ ]").replace("'",'').replace(" ",'').split(',') #字符串转列表
|
|
||||||
actor = str(actor_list).strip("[ ]").replace("'",'').replace(" ",'')
|
|
||||||
|
|
||||||
#====================处理异常字符====================== #\/:*?"<>|
|
|
||||||
#if "\\" in title or "/" in title or ":" in title or "*" in title or "?" in title or '"' in title or '<' in title or ">" in title or "|" in title or len(title) > 200:
|
|
||||||
# title = title.
|
|
||||||
|
|
||||||
naming_rule = eval(config['Name_Rule']['naming_rule'])
|
|
||||||
location_rule =eval(config['Name_Rule']['location_rule'])
|
|
||||||
except IOError as e:
|
|
||||||
print('[-]'+str(e))
|
|
||||||
print('[-]Move ' + filename + ' to failed folder')
|
|
||||||
shutil.move(filepath, str(os.getcwd())+'/'+'failed/')
|
|
||||||
os._exit(0)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print('[-]'+str(e))
|
|
||||||
print('[-]Move ' + filename + ' to failed folder')
|
|
||||||
shutil.move(filepath, str(os.getcwd())+'/'+'failed/')
|
|
||||||
os._exit(0)
|
|
||||||
path = '' #设置path为全局变量,后面移动文件要用
|
|
||||||
def creatFolder():
|
|
||||||
global path
|
global path
|
||||||
if len(actor) > 240: #新建成功输出文件夹
|
if len(actor) > 240: #新建成功输出文件夹
|
||||||
path = location_rule.replace("'actor'","'超多人'",3).replace("actor","'超多人'",3) #path为影片+元数据所在目录
|
path = location_rule.replace("'actor'","'超多人'",3).replace("actor","'超多人'",3) #path为影片+元数据所在目录
|
||||||
@@ -164,135 +164,253 @@ def creatFolder():
|
|||||||
path = location_rule
|
path = location_rule
|
||||||
#print(path)
|
#print(path)
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
os.makedirs(path)
|
try:
|
||||||
|
os.makedirs(path)
|
||||||
|
except:
|
||||||
|
path = location_rule.replace('/['+number+']-'+title,"/number")
|
||||||
|
#print(path)
|
||||||
|
os.makedirs(path)
|
||||||
#=====================资源下载部分===========================
|
#=====================资源下载部分===========================
|
||||||
def DownloadFileWithFilename(url,filename,path): #path = examle:photo , video.in the Project Folder!
|
def DownloadFileWithFilename(url,filename,path): #path = examle:photo , video.in the Project Folder!
|
||||||
config = ConfigParser()
|
try:
|
||||||
config.read('proxy.ini', encoding='UTF-8')
|
proxy = Config['proxy']['proxy']
|
||||||
proxy = str(config['proxy']['proxy'])
|
timeout = int(Config['proxy']['timeout'])
|
||||||
if not str(config['proxy']['proxy']) == '':
|
retry_count = int(Config['proxy']['retry'])
|
||||||
|
except:
|
||||||
|
print('[-]Proxy config error! Please check the config.')
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
while i < retry_count:
|
||||||
try:
|
try:
|
||||||
if not os.path.exists(path):
|
if not proxy == '':
|
||||||
os.makedirs(path)
|
if not os.path.exists(path):
|
||||||
headers = {
|
os.makedirs(path)
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
|
headers = {
|
||||||
r = requests.get(url, headers=headers,proxies={"http": "http://" + str(proxy), "https": "https://" + str(proxy)})
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
|
||||||
with open(str(path) + "/" + filename, "wb") as code:
|
r = requests.get(url, headers=headers, timeout=timeout,proxies={"http": "http://" + str(proxy), "https": "https://" + str(proxy)})
|
||||||
code.write(r.content)
|
if r == '':
|
||||||
# print(bytes(r),file=code)
|
print('[-]Movie Data not found!')
|
||||||
except IOError as e:
|
os._exit(0)
|
||||||
print("[-]Movie not found in All website!")
|
with open(str(path) + "/" + filename, "wb") as code:
|
||||||
print("[-]" + filename, e)
|
code.write(r.content)
|
||||||
# print("[*]=====================================")
|
return
|
||||||
return "failed"
|
else:
|
||||||
except Exception as e1:
|
if not os.path.exists(path):
|
||||||
print(e1)
|
os.makedirs(path)
|
||||||
print("[-]Download Failed2!")
|
headers = {
|
||||||
time.sleep(3)
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
|
||||||
os._exit(0)
|
r = requests.get(url, timeout=timeout, headers=headers)
|
||||||
else:
|
if r == '':
|
||||||
try:
|
print('[-]Movie Data not found!')
|
||||||
if not os.path.exists(path):
|
os._exit(0)
|
||||||
os.makedirs(path)
|
with open(str(path) + "/" + filename, "wb") as code:
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
|
code.write(r.content)
|
||||||
r = requests.get(url, headers=headers)
|
return
|
||||||
with open(str(path) + "/" + filename, "wb") as code:
|
except requests.exceptions.RequestException:
|
||||||
code.write(r.content)
|
i += 1
|
||||||
# print(bytes(r),file=code)
|
print('[-]Image Download : Connect retry '+str(i)+'/'+str(retry_count))
|
||||||
except IOError as e:
|
except requests.exceptions.ConnectionError:
|
||||||
print("[-]Movie not found in All website!")
|
i += 1
|
||||||
print("[-]" + filename, e)
|
print('[-]Image Download : Connect retry '+str(i)+'/'+str(retry_count))
|
||||||
# print("[*]=====================================")
|
except requests.exceptions.ProxyError:
|
||||||
return "failed"
|
i += 1
|
||||||
except Exception as e1:
|
print('[-]Image Download : Connect retry '+str(i)+'/'+str(retry_count))
|
||||||
print(e1)
|
except requests.exceptions.ConnectTimeout:
|
||||||
print("[-]Download Failed2!")
|
i += 1
|
||||||
time.sleep(3)
|
print('[-]Image Download : Connect retry '+str(i)+'/'+str(retry_count))
|
||||||
os._exit(0)
|
print('[-]Connect Failed! Please check your Proxy or Network!')
|
||||||
def PrintFiles(path,naming_rule):
|
moveFailedFolder()
|
||||||
|
def imageDownload(filepath): #封面是否下载成功,否则移动到failed
|
||||||
|
if option == 'emby':
|
||||||
|
if DownloadFileWithFilename(cover, number + '.jpg', path) == 'failed':
|
||||||
|
moveFailedFolder()
|
||||||
|
DownloadFileWithFilename(cover, number + '.jpg', path)
|
||||||
|
print('[+]Image Downloaded!', path + '/' + number + '.jpg')
|
||||||
|
elif option == 'plex':
|
||||||
|
if DownloadFileWithFilename(cover, 'fanart.jpg', path) == 'failed':
|
||||||
|
moveFailedFolder()
|
||||||
|
DownloadFileWithFilename(cover, 'fanart.jpg', path)
|
||||||
|
print('[+]Image Downloaded!', path + '/fanart.jpg')
|
||||||
|
def PrintFiles(filepath):
|
||||||
|
#global path
|
||||||
global title
|
global title
|
||||||
|
global cn_sub
|
||||||
|
global actor_photo
|
||||||
try:
|
try:
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
with open(path + "/" + number + ".nfo", "wt", encoding='UTF-8') as code:
|
if option == 'plex':
|
||||||
print("<movie>", file=code)
|
with open(path + "/" + number + ".nfo", "wt", encoding='UTF-8') as code:
|
||||||
print(" <title>" + naming_rule + "</title>", file=code)
|
print("<movie>", file=code)
|
||||||
print(" <set>", file=code)
|
print(" <title>" + naming_rule + "</title>", file=code)
|
||||||
print(" </set>", file=code)
|
print(" <set>", file=code)
|
||||||
print(" <studio>" + studio + "+</studio>", file=code)
|
print(" </set>", file=code)
|
||||||
print(" <year>" + year + "</year>", file=code)
|
print(" <studio>" + studio + "+</studio>", file=code)
|
||||||
print(" <outline>"+outline+"</outline>", file=code)
|
print(" <year>" + year + "</year>", file=code)
|
||||||
print(" <plot>"+outline+"</plot>", file=code)
|
print(" <outline>" + outline + "</outline>", file=code)
|
||||||
print(" <runtime>"+str(runtime).replace(" ","")+"</runtime>", file=code)
|
print(" <plot>" + outline + "</plot>", file=code)
|
||||||
print(" <director>" + director + "</director>", file=code)
|
print(" <runtime>" + str(runtime).replace(" ", "") + "</runtime>", file=code)
|
||||||
print(" <poster>" + naming_rule + ".png</poster>", file=code)
|
print(" <director>" + director + "</director>", file=code)
|
||||||
print(" <thumb>" + naming_rule + ".png</thumb>", file=code)
|
print(" <poster>poster.png</poster>", file=code)
|
||||||
print(" <fanart>"+naming_rule + '.jpg'+"</fanart>", file=code)
|
print(" <thumb>thumb.png</thumb>", file=code)
|
||||||
try:
|
print(" <fanart>fanart.jpg</fanart>", file=code)
|
||||||
for u in actor_list:
|
try:
|
||||||
print(" <actor>", file=code)
|
for key, value in actor_photo.items():
|
||||||
print(" <name>" + u + "</name>", file=code)
|
print(" <actor>", file=code)
|
||||||
print(" </actor>", file=code)
|
print(" <name>" + key + "</name>", file=code)
|
||||||
except:
|
if not actor_photo == '': # or actor_photo == []:
|
||||||
aaaa=''
|
print(" <thumb>" + value + "</thumb>", file=code)
|
||||||
print(" <maker>" + studio + "</maker>", file=code)
|
print(" </actor>", file=code)
|
||||||
print(" <label>", file=code)
|
except:
|
||||||
print(" </label>", file=code)
|
aaaa = ''
|
||||||
try:
|
print(" <maker>" + studio + "</maker>", file=code)
|
||||||
for i in tag:
|
print(" <label>", file=code)
|
||||||
print(" <tag>" + i + "</tag>", file=code)
|
print(" </label>", file=code)
|
||||||
except:
|
if cn_sub == '1':
|
||||||
aaaaa=''
|
print(" <tag>中文字幕</tag>", file=code)
|
||||||
try:
|
try:
|
||||||
for i in tag:
|
for i in tag:
|
||||||
print(" <genre>" + i + "</genre>", file=code)
|
print(" <tag>" + i + "</tag>", file=code)
|
||||||
except:
|
except:
|
||||||
aaaaaaaa=''
|
aaaaa = ''
|
||||||
print(" <num>" + number + "</num>", file=code)
|
try:
|
||||||
print(" <release>" + release + "</release>", file=code)
|
for i in tag:
|
||||||
print(" <cover>"+cover+"</cover>", file=code)
|
print(" <genre>" + i + "</genre>", file=code)
|
||||||
print(" <website>" + "https://www.javbus.com/"+number + "</website>", file=code)
|
except:
|
||||||
print("</movie>", file=code)
|
aaaaaaaa = ''
|
||||||
print("[+]Writeed! "+path + "/" + number + ".nfo")
|
if cn_sub == '1':
|
||||||
|
print(" <genre>中文字幕</genre>", file=code)
|
||||||
|
print(" <num>" + number + "</num>", file=code)
|
||||||
|
print(" <release>" + release + "</release>", file=code)
|
||||||
|
print(" <cover>" + cover + "</cover>", file=code)
|
||||||
|
print(" <website>" + website + "</website>", file=code)
|
||||||
|
print("</movie>", file=code)
|
||||||
|
print("[+]Writeed! " + path + "/" + number + ".nfo")
|
||||||
|
elif option == 'emby':
|
||||||
|
with open(path + "/" + number + ".nfo", "wt", encoding='UTF-8') as code:
|
||||||
|
print("<movie>", file=code)
|
||||||
|
print(" <title>" + naming_rule + "</title>", file=code)
|
||||||
|
print(" <set>", file=code)
|
||||||
|
print(" </set>", file=code)
|
||||||
|
print(" <studio>" + studio + "+</studio>", file=code)
|
||||||
|
print(" <year>" + year + "</year>", file=code)
|
||||||
|
print(" <outline>" + outline + "</outline>", file=code)
|
||||||
|
print(" <plot>" + outline + "</plot>", file=code)
|
||||||
|
print(" <runtime>" + str(runtime).replace(" ", "") + "</runtime>", file=code)
|
||||||
|
print(" <director>" + director + "</director>", file=code)
|
||||||
|
print(" <poster>" + number + ".png</poster>", file=code)
|
||||||
|
print(" <thumb>" + number + ".png</thumb>", file=code)
|
||||||
|
print(" <fanart>" + number + '.jpg' + "</fanart>", file=code)
|
||||||
|
try:
|
||||||
|
for key, value in actor_photo.items():
|
||||||
|
print(" <actor>", file=code)
|
||||||
|
print(" <name>" + key + "</name>", file=code)
|
||||||
|
if not actor_photo == '': # or actor_photo == []:
|
||||||
|
print(" <thumb>" + value + "</thumb>", file=code)
|
||||||
|
print(" </actor>", file=code)
|
||||||
|
except:
|
||||||
|
aaaa = ''
|
||||||
|
print(" <maker>" + studio + "</maker>", file=code)
|
||||||
|
print(" <label>", file=code)
|
||||||
|
print(" </label>", file=code)
|
||||||
|
if cn_sub == '1':
|
||||||
|
print(" <tag>中文字幕</tag>", file=code)
|
||||||
|
try:
|
||||||
|
for i in tag:
|
||||||
|
print(" <tag>" + i + "</tag>", file=code)
|
||||||
|
except:
|
||||||
|
aaaaa = ''
|
||||||
|
try:
|
||||||
|
for i in tag:
|
||||||
|
print(" <genre>" + i + "</genre>", file=code)
|
||||||
|
except:
|
||||||
|
aaaaaaaa = ''
|
||||||
|
if cn_sub == '1':
|
||||||
|
print(" <genre>中文字幕</genre>", file=code)
|
||||||
|
print(" <num>" + number + "</num>", file=code)
|
||||||
|
print(" <release>" + release + "</release>", file=code)
|
||||||
|
print(" <cover>" + cover + "</cover>", file=code)
|
||||||
|
print(" <website>" + "https://www.javbus.com/" + number + "</website>", file=code)
|
||||||
|
print("</movie>", file=code)
|
||||||
|
print("[+]Writeed! " + path + "/" + number + ".nfo")
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print("[-]Write Failed!")
|
print("[-]Write Failed!")
|
||||||
print(e)
|
print(e)
|
||||||
|
moveFailedFolder()
|
||||||
except Exception as e1:
|
except Exception as e1:
|
||||||
print(e1)
|
print(e1)
|
||||||
print("[-]Write Failed!")
|
print("[-]Write Failed!")
|
||||||
def imageDownload(filepath): #封面是否下载成功,否则移动到failed
|
moveFailedFolder()
|
||||||
if DownloadFileWithFilename(cover,'Backdrop.jpg', path) == 'failed':
|
|
||||||
shutil.move(filepath, 'failed/')
|
|
||||||
os._exit(0)
|
|
||||||
DownloadFileWithFilename(cover, 'Backdrop.jpg', path)
|
|
||||||
print('[+]Image Downloaded!', path +'/'+'Backdrop.jpg')
|
|
||||||
def cutImage():
|
def cutImage():
|
||||||
if imagecut == 1:
|
if option == 'plex':
|
||||||
try:
|
if imagecut == 1:
|
||||||
img = Image.open(path + '/' + 'Backdrop' + '.jpg')
|
try:
|
||||||
imgSize = img.size
|
img = Image.open(path + '/fanart.jpg')
|
||||||
|
imgSize = img.size
|
||||||
|
w = img.width
|
||||||
|
h = img.height
|
||||||
|
img2 = img.crop((w / 1.9, 0, w, h))
|
||||||
|
img2.save(path + '/poster.png')
|
||||||
|
except:
|
||||||
|
print('[-]Cover cut failed!')
|
||||||
|
else:
|
||||||
|
img = Image.open(path + '/fanart.jpg')
|
||||||
w = img.width
|
w = img.width
|
||||||
h = img.height
|
h = img.height
|
||||||
img2 = img.crop((w / 1.9, 0, w, h))
|
img.save(path + '/poster.png')
|
||||||
img2.save(path + '/' + number + '.png')
|
elif option == 'emby':
|
||||||
except:
|
if imagecut == 1:
|
||||||
print('[-]Cover cut failed!')
|
try:
|
||||||
else:
|
img = Image.open(path + '/' + number + '.jpg')
|
||||||
img = Image.open(path + '/' + 'Backdrop' + '.jpg')
|
imgSize = img.size
|
||||||
w = img.width
|
w = img.width
|
||||||
h = img.height
|
h = img.height
|
||||||
img.save(path + '/' + number + '.png')
|
img2 = img.crop((w / 1.9, 0, w, h))
|
||||||
|
img2.save(path + '/' + number + '.png')
|
||||||
|
except:
|
||||||
|
print('[-]Cover cut failed!')
|
||||||
|
else:
|
||||||
|
img = Image.open(path + '/' + number + '.jpg')
|
||||||
|
w = img.width
|
||||||
|
h = img.height
|
||||||
|
img.save(path + '/' + number + '.png')
|
||||||
def pasteFileToFolder(filepath, path): #文件路径,番号,后缀,要移动至的位置
|
def pasteFileToFolder(filepath, path): #文件路径,番号,后缀,要移动至的位置
|
||||||
|
global houzhui
|
||||||
houzhui = str(re.search('[.](AVI|RMVB|WMV|MOV|MP4|MKV|FLV|TS|avi|rmvb|wmv|mov|mp4|mkv|flv|ts)$', filepath).group())
|
houzhui = str(re.search('[.](AVI|RMVB|WMV|MOV|MP4|MKV|FLV|TS|avi|rmvb|wmv|mov|mp4|mkv|flv|ts)$', filepath).group())
|
||||||
os.rename(filepath, number + houzhui)
|
os.rename(filepath, number + houzhui)
|
||||||
shutil.move(number + houzhui, path)
|
try:
|
||||||
|
shutil.move(number + houzhui, path)
|
||||||
|
except:
|
||||||
|
print('[-]File Exists! Please check your movie!')
|
||||||
|
print('[-]move to the root folder of the program.')
|
||||||
|
os._exit(0)
|
||||||
|
def moveJpgToBackdrop_copy():
|
||||||
|
if option == 'plex':
|
||||||
|
shutil.copy(path + '/fanart.jpg', path + '/Backdrop.jpg')
|
||||||
|
shutil.copy(path + '/poster.png', path + '/thumb.png')
|
||||||
|
if option == 'emby':
|
||||||
|
shutil.copy(path + '/' + number + '.jpg', path + '/Backdrop.jpg')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
filepath=argparse_get_file() #影片的路径
|
filepath=argparse_get_file()[0] #影片的路径
|
||||||
|
|
||||||
|
if '-c.' in filepath or '-C.' in filepath or '中文' in filepath or '字幕' in filepath:
|
||||||
|
cn_sub='1'
|
||||||
|
|
||||||
|
if argparse_get_file()[1] == '': #获取手动拉去影片获取的番号
|
||||||
|
try:
|
||||||
|
number = str(re.findall(r'(.+?)\.',str(re.search('([^<>/\\\\|:""\\*\\?]+)\\.\\w+$',filepath).group()))).strip("['']").replace('_','-')
|
||||||
|
print("[!]Making Data for [" + number + "]")
|
||||||
|
except:
|
||||||
|
print("[-]failed!Please move the filename again!")
|
||||||
|
moveFailedFolder()
|
||||||
|
else:
|
||||||
|
number = argparse_get_file()[1]
|
||||||
CreatFailedFolder()
|
CreatFailedFolder()
|
||||||
getNumberFromFilename(filepath) #定义番号
|
getDataFromJSON(number) # 定义番号
|
||||||
creatFolder() #创建文件夹
|
creatFolder() # 创建文件夹
|
||||||
imageDownload(filepath) #creatFoder会返回番号路径
|
imageDownload(filepath) # creatFoder会返回番号路径
|
||||||
PrintFiles(path,naming_rule)#打印文件
|
PrintFiles(filepath) # 打印文件
|
||||||
cutImage() #裁剪图
|
cutImage() # 裁剪图
|
||||||
pasteFileToFolder(filepath,path) #移动文件
|
pasteFileToFolder(filepath, path) # 移动文件
|
||||||
|
moveJpgToBackdrop_copy()
|
||||||
|
|||||||
25
fc2fans_club.py
Normal file → Executable file
25
fc2fans_club.py
Normal file → Executable file
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
import re
|
import re
|
||||||
from lxml import etree#need install
|
from lxml import etree#need install
|
||||||
import json
|
import json
|
||||||
@@ -17,7 +18,6 @@ def getActor(htmlcode):
|
|||||||
return result
|
return result
|
||||||
except:
|
except:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def getStudio(htmlcode): #获取厂商
|
def getStudio(htmlcode): #获取厂商
|
||||||
html = etree.fromstring(htmlcode,etree.HTMLParser())
|
html = etree.fromstring(htmlcode,etree.HTMLParser())
|
||||||
result = str(html.xpath('/html/body/div[2]/div/div[1]/h5[3]/a[1]/text()')).strip(" ['']")
|
result = str(html.xpath('/html/body/div[2]/div/div[1]/h5[3]/a[1]/text()')).strip(" ['']")
|
||||||
@@ -41,7 +41,6 @@ def getCover(htmlcode,number,htmlcode2): #获取厂商 #
|
|||||||
result2 = str(html.xpath('//*[@id="slider"]/ul[1]/li[1]/img/@src')).strip(" ['']")
|
result2 = str(html.xpath('//*[@id="slider"]/ul[1]/li[1]/img/@src')).strip(" ['']")
|
||||||
return 'http://fc2fans.club' + result2
|
return 'http://fc2fans.club' + result2
|
||||||
return 'http:' + result
|
return 'http:' + result
|
||||||
|
|
||||||
def getOutline(htmlcode2,number): #获取番号 #
|
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')
|
#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())
|
html = etree.fromstring(htmlcode2, etree.HTMLParser())
|
||||||
@@ -63,22 +62,24 @@ def main(number2):
|
|||||||
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')
|
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')
|
htmlcode = ADC_function.get_html('http://fc2fans.club/html/FC2-' + number + '.html')
|
||||||
dic = {
|
dic = {
|
||||||
'title': getTitle(htmlcode),
|
'title': getTitle(htmlcode),
|
||||||
'studio': getStudio(htmlcode),
|
'studio': getStudio(htmlcode),
|
||||||
'year': '',#str(re.search('\d{4}',getRelease(number)).group()),
|
'year': '',#str(re.search('\d{4}',getRelease(number)).group()),
|
||||||
'outline': getOutline(htmlcode,number),
|
'outline': getOutline(htmlcode,number),
|
||||||
'runtime': getYear(getRelease(htmlcode)),
|
'runtime': getYear(getRelease(htmlcode)),
|
||||||
'director': getStudio(htmlcode),
|
'director': getStudio(htmlcode),
|
||||||
'actor': getActor(htmlcode),
|
'actor': getActor(htmlcode),
|
||||||
'release': getRelease(number),
|
'release': getRelease(number),
|
||||||
'number': 'FC2-'+number,
|
'number': 'FC2-'+number,
|
||||||
'cover': getCover(htmlcode,number,htmlcode2),
|
'cover': getCover(htmlcode,number,htmlcode2),
|
||||||
'imagecut': 0,
|
'imagecut': 0,
|
||||||
'tag':getTag(htmlcode),
|
'tag': getTag(htmlcode),
|
||||||
|
'actor_photo':'',
|
||||||
|
'website': 'http://fc2fans.club/html/FC2-' + number + '.html',
|
||||||
}
|
}
|
||||||
#print(getTitle(htmlcode))
|
#print(getTitle(htmlcode))
|
||||||
#print(getNum(htmlcode))
|
#print(getNum(htmlcode))
|
||||||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'),)#.encode('UTF-8')
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'),)#.encode('UTF-8')
|
||||||
return js
|
return js
|
||||||
|
|
||||||
#print(main('1051725'))
|
#print(main('1051725'))
|
||||||
|
|||||||
85
javbus.py
Normal file → Executable file
85
javbus.py
Normal file → Executable file
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
import re
|
import re
|
||||||
import requests #need install
|
import requests #need install
|
||||||
from pyquery import PyQuery as pq#need install
|
from pyquery import PyQuery as pq#need install
|
||||||
@@ -10,8 +11,21 @@ from PIL import Image#need install
|
|||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
from ADC_function import *
|
from ADC_function import *
|
||||||
|
import javdb
|
||||||
import siro
|
import siro
|
||||||
|
|
||||||
|
def getActorPhoto(htmlcode): #//*[@id="star_qdt"]/li/a/img
|
||||||
|
soup = BeautifulSoup(htmlcode, 'lxml')
|
||||||
|
a = soup.find_all(attrs={'class': 'star-name'})
|
||||||
|
d={}
|
||||||
|
for i in a:
|
||||||
|
l=i.a['href']
|
||||||
|
t=i.get_text()
|
||||||
|
html = etree.fromstring(get_html(l), etree.HTMLParser())
|
||||||
|
p=str(html.xpath('//*[@id="waterfall"]/div[1]/div/div[1]/img/@src')).strip(" ['']")
|
||||||
|
p2={t:p}
|
||||||
|
d.update(p2)
|
||||||
|
return d
|
||||||
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(' ','-')
|
||||||
@@ -75,6 +89,13 @@ def getTag(htmlcode): # 获取演员
|
|||||||
|
|
||||||
|
|
||||||
def main(number):
|
def main(number):
|
||||||
|
try:
|
||||||
|
if re.search('\d+\D+', number).group() in number or 'siro' in number or 'SIRO' in number or 'Siro' in number:
|
||||||
|
js = siro.main(number)
|
||||||
|
return js
|
||||||
|
except:
|
||||||
|
aaaa=''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
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("-", ''))
|
||||||
@@ -92,17 +113,18 @@ def main(number):
|
|||||||
'imagecut': 1,
|
'imagecut': 1,
|
||||||
'tag': getTag(htmlcode),
|
'tag': getTag(htmlcode),
|
||||||
'label': getSerise(htmlcode),
|
'label': getSerise(htmlcode),
|
||||||
|
'actor_photo': getActorPhoto(htmlcode),
|
||||||
|
'website': 'https://www.javbus.com/' + number,
|
||||||
}
|
}
|
||||||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
||||||
|
|
||||||
if 'HEYZO' in number or 'heyzo' in number or 'Heyzo' in number:
|
if 'HEYZO' in number or 'heyzo' in number or 'Heyzo' in 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))),
|
||||||
'studio': getStudio(htmlcode),
|
'studio': getStudio(htmlcode),
|
||||||
'year': getYear(htmlcode),
|
'year': getYear(htmlcode),
|
||||||
'outline': getOutline(dww_htmlcode),
|
'outline': '',
|
||||||
'runtime': getRuntime(htmlcode),
|
'runtime': getRuntime(htmlcode),
|
||||||
'director': getDirector(htmlcode),
|
'director': getDirector(htmlcode),
|
||||||
'actor': getActor(htmlcode),
|
'actor': getActor(htmlcode),
|
||||||
@@ -112,18 +134,23 @@ def main(number):
|
|||||||
'imagecut': 1,
|
'imagecut': 1,
|
||||||
'tag': getTag(htmlcode),
|
'tag': getTag(htmlcode),
|
||||||
'label': getSerise(htmlcode),
|
'label': getSerise(htmlcode),
|
||||||
|
'actor_photo': getActorPhoto(htmlcode),
|
||||||
|
'website': 'https://www.javbus.com/' + number,
|
||||||
}
|
}
|
||||||
js2 = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4,
|
js2 = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4,
|
||||||
separators=(',', ':'), ) # .encode('UTF-8')
|
separators=(',', ':'), ) # .encode('UTF-8')
|
||||||
return js2
|
return js2
|
||||||
return js
|
return js
|
||||||
except:
|
except:
|
||||||
a=siro.main(number)
|
a=javdb.main(number)
|
||||||
return a
|
return a
|
||||||
|
|
||||||
def main_uncensored(number):
|
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("-", ''))
|
||||||
|
if getTitle(htmlcode) == '':
|
||||||
|
htmlcode = get_html('https://www.javbus.com/' + 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))).replace(getNum(htmlcode)+'-',''),
|
'title': str(re.sub('\w+-\d+-','',getTitle(htmlcode))).replace(getNum(htmlcode)+'-',''),
|
||||||
'studio': getStudio(htmlcode),
|
'studio': getStudio(htmlcode),
|
||||||
@@ -138,57 +165,13 @@ def main_uncensored(number):
|
|||||||
'tag': getTag(htmlcode),
|
'tag': getTag(htmlcode),
|
||||||
'label': getSerise(htmlcode),
|
'label': getSerise(htmlcode),
|
||||||
'imagecut': 0,
|
'imagecut': 0,
|
||||||
|
'actor_photo': '',
|
||||||
|
'website': 'https://www.javbus.com/' + number,
|
||||||
}
|
}
|
||||||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
||||||
|
|
||||||
if getYear(htmlcode) == '' or getYear(htmlcode) == 'null':
|
if getYear(htmlcode) == '' or getYear(htmlcode) == 'null':
|
||||||
number2 = number.replace('-', '_')
|
js2 = javdb.main(number)
|
||||||
htmlcode = get_html('https://www.javbus.com/' + number2)
|
|
||||||
dic2 = {
|
|
||||||
'title': str(re.sub('\w+-\d+-','',getTitle(htmlcode))).replace(getNum(htmlcode)+'-',''),
|
|
||||||
'studio': getStudio(htmlcode),
|
|
||||||
'year': getYear(htmlcode),
|
|
||||||
'outline': '',
|
|
||||||
'runtime': getRuntime(htmlcode),
|
|
||||||
'director': getDirector(htmlcode),
|
|
||||||
'actor': getActor(htmlcode),
|
|
||||||
'release': getRelease(htmlcode),
|
|
||||||
'number': getNum(htmlcode),
|
|
||||||
'cover': getCover(htmlcode),
|
|
||||||
'tag': getTag(htmlcode),
|
|
||||||
'label':getSerise(htmlcode),
|
|
||||||
'imagecut': 0,
|
|
||||||
}
|
|
||||||
js2 = json.dumps(dic2, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
|
||||||
return js2
|
return js2
|
||||||
|
|
||||||
return js
|
return js
|
||||||
|
|
||||||
|
|
||||||
# def return1():
|
|
||||||
# json_data=json.loads(main('ipx-292'))
|
|
||||||
#
|
|
||||||
# title = str(json_data['title'])
|
|
||||||
# studio = str(json_data['studio'])
|
|
||||||
# year = str(json_data['year'])
|
|
||||||
# outline = str(json_data['outline'])
|
|
||||||
# runtime = str(json_data['runtime'])
|
|
||||||
# director = str(json_data['director'])
|
|
||||||
# actor = str(json_data['actor'])
|
|
||||||
# release = str(json_data['release'])
|
|
||||||
# number = str(json_data['number'])
|
|
||||||
# cover = str(json_data['cover'])
|
|
||||||
# tag = str(json_data['tag'])
|
|
||||||
#
|
|
||||||
# print(title)
|
|
||||||
# print(studio)
|
|
||||||
# print(year)
|
|
||||||
# print(outline)
|
|
||||||
# print(runtime)
|
|
||||||
# print(director)
|
|
||||||
# print(actor)
|
|
||||||
# print(release)
|
|
||||||
# print(number)
|
|
||||||
# print(cover)
|
|
||||||
# print(tag)
|
|
||||||
# return1()
|
|
||||||
141
javdb.py
Executable file
141
javdb.py
Executable file
@@ -0,0 +1,141 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import re
|
||||||
|
from lxml import etree
|
||||||
|
import json
|
||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
from ADC_function import *
|
||||||
|
|
||||||
|
def getTitle(a):
|
||||||
|
try:
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser())
|
||||||
|
result = str(html.xpath('/html/body/section/div/h2/strong/text()')).strip(" ['']")
|
||||||
|
return re.sub('.*\] ','',result.replace('/', ',').replace('\\xa0','').replace(' : ',''))
|
||||||
|
except:
|
||||||
|
return re.sub('.*\] ','',result.replace('/', ',').replace('\\xa0',''))
|
||||||
|
def getActor(a): #//*[@id="center_column"]/div[2]/div[1]/div/table/tbody/tr[1]/td/text()
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) #//table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//strong[contains(text(),"演員")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
|
result2 = str(html.xpath('//strong[contains(text(),"演員")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
|
return str(result1 + result2).strip('+').replace(",\\xa0","").replace("'","").replace(' ','').replace(',,','').lstrip(',').replace(',',', ')
|
||||||
|
def getStudio(a):
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) #//table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//strong[contains(text(),"製作")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
|
result2 = str(html.xpath('//strong[contains(text(),"製作")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
|
return str(result1+result2).strip('+').replace("', '",'').replace('"','')
|
||||||
|
def getRuntime(a):
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//strong[contains(text(),"時長")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
|
result2 = str(html.xpath('//strong[contains(text(),"時長")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
|
return str(result1 + result2).strip('+').rstrip('mi')
|
||||||
|
def getLabel(a):
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//strong[contains(text(),"系列")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
|
result2 = str(html.xpath('//strong[contains(text(),"系列")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
|
return str(result1 + result2).strip('+').replace("', '",'').replace('"','')
|
||||||
|
def getNum(a):
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser())
|
||||||
|
result1 = str(html.xpath('//strong[contains(text(),"番號")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
|
result2 = str(html.xpath('//strong[contains(text(),"番號")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
|
return str(result1 + result2).strip('+')
|
||||||
|
def getYear(getRelease):
|
||||||
|
try:
|
||||||
|
result = str(re.search('\d{4}',getRelease).group())
|
||||||
|
return result
|
||||||
|
except:
|
||||||
|
return getRelease
|
||||||
|
def getRelease(a):
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//strong[contains(text(),"時間")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
|
result2 = str(html.xpath('//strong[contains(text(),"時間")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
|
return str(result1 + result2).strip('+')
|
||||||
|
def getTag(a):
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//strong[contains(text(),"类别")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
|
result2 = str(html.xpath('//strong[contains(text(),"类别")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
|
return str(result1 + result2).strip('+').replace(",\\xa0","").replace("'","").replace(' ','').replace(',,','').lstrip(',')
|
||||||
|
def getCover(htmlcode):
|
||||||
|
html = etree.fromstring(htmlcode, etree.HTMLParser())
|
||||||
|
result = str(html.xpath('/html/body/section/div/div[2]/div[1]/a/img/@src')).strip(" ['']")
|
||||||
|
if result == '':
|
||||||
|
result = str(html.xpath('/html/body/section/div/div[3]/div[1]/a/img/@src')).strip(" ['']")
|
||||||
|
return result
|
||||||
|
def getDirector(a):
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//strong[contains(text(),"導演")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
|
result2 = str(html.xpath('//strong[contains(text(),"導演")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
|
return str(result1 + result2).strip('+').replace("', '",'').replace('"','')
|
||||||
|
def getOutline(htmlcode):
|
||||||
|
html = etree.fromstring(htmlcode, etree.HTMLParser())
|
||||||
|
result = str(html.xpath('//*[@id="introduction"]/dd/p[1]/text()')).strip(" ['']")
|
||||||
|
return result
|
||||||
|
def main(number):
|
||||||
|
try:
|
||||||
|
a = get_html('https://javdb.com/search?q=' + number + '&f=all')
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//*[@id="videos"]/div/div/a/@href')).strip(" ['']")
|
||||||
|
if result1 == '':
|
||||||
|
a = get_html('https://javdb.com/search?q=' + number.replace('-', '_') + '&f=all')
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//*[@id="videos"]/div/div/a/@href')).strip(" ['']")
|
||||||
|
b = get_html('https://javdb1.com' + result1)
|
||||||
|
soup = BeautifulSoup(b, 'lxml')
|
||||||
|
|
||||||
|
a = str(soup.find(attrs={'class': 'panel'}))
|
||||||
|
dic = {
|
||||||
|
'actor': getActor(a),
|
||||||
|
'title': getTitle(b).replace("\\n", '').replace(' ', '').replace(getActor(a), '').replace(getNum(a),
|
||||||
|
'').replace(
|
||||||
|
'无码', '').replace('有码', '').lstrip(' '),
|
||||||
|
'studio': getStudio(a),
|
||||||
|
'outline': getOutline(a),
|
||||||
|
'runtime': getRuntime(a),
|
||||||
|
'director': getDirector(a),
|
||||||
|
'release': getRelease(a),
|
||||||
|
'number': getNum(a),
|
||||||
|
'cover': getCover(b),
|
||||||
|
'imagecut': 0,
|
||||||
|
'tag': getTag(a),
|
||||||
|
'label': getLabel(a),
|
||||||
|
'year': getYear(getRelease(a)), # str(re.search('\d{4}',getRelease(a)).group()),
|
||||||
|
'actor_photo': '',
|
||||||
|
'website': 'https://javdb1.com' + result1,
|
||||||
|
}
|
||||||
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
||||||
|
return js
|
||||||
|
except:
|
||||||
|
a = get_html('https://javdb.com/search?q=' + number + '&f=all')
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//*[@id="videos"]/div/div/a/@href')).strip(" ['']")
|
||||||
|
if result1 == '':
|
||||||
|
a = get_html('https://javdb.com/search?q=' + number.replace('-', '_') + '&f=all')
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
|
result1 = str(html.xpath('//*[@id="videos"]/div/div/a/@href')).strip(" ['']")
|
||||||
|
|
||||||
|
b = get_html('https://javdb.com' + result1)
|
||||||
|
soup = BeautifulSoup(b, 'lxml')
|
||||||
|
|
||||||
|
a = str(soup.find(attrs={'class': 'panel'}))
|
||||||
|
dic = {
|
||||||
|
'actor': getActor(a),
|
||||||
|
'title': getTitle(b).replace("\\n", '').replace(' ', '').replace(getActor(a), '').replace(getNum(a),
|
||||||
|
'').replace(
|
||||||
|
'无码', '').replace('有码', '').lstrip(' '),
|
||||||
|
'studio': getStudio(a),
|
||||||
|
'outline': getOutline(a),
|
||||||
|
'runtime': getRuntime(a),
|
||||||
|
'director': getDirector(a),
|
||||||
|
'release': getRelease(a),
|
||||||
|
'number': getNum(a),
|
||||||
|
'cover': getCover(b),
|
||||||
|
'imagecut': 0,
|
||||||
|
'tag': getTag(a),
|
||||||
|
'label': getLabel(a),
|
||||||
|
'year': getYear(getRelease(a)), # str(re.search('\d{4}',getRelease(a)).group()),
|
||||||
|
'actor_photo': '',
|
||||||
|
'website':'https://javdb.com' + result1,
|
||||||
|
}
|
||||||
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
||||||
|
return js
|
||||||
|
|
||||||
|
#print(main('061519-861'))
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
[proxy]
|
|
||||||
proxy=127.0.0.1:1080
|
|
||||||
|
|
||||||
[Name_Rule]
|
|
||||||
location_rule='JAV_output/'+actor+'/'+number
|
|
||||||
naming_rule=number+'-'+title
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
pyinstaller --onefile AV_Data_Capture.py
|
|
||||||
pyinstaller --onefile core.py --hidden-import ADC_function.py --hidden-import fc2fans_club.py --hidden-import javbus.py --hidden-import siro.py
|
|
||||||
14
siro.py
Normal file → Executable file
14
siro.py
Normal file → Executable file
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
import re
|
import re
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
import json
|
import json
|
||||||
@@ -6,9 +7,12 @@ from bs4 import BeautifulSoup
|
|||||||
from ADC_function import *
|
from ADC_function import *
|
||||||
|
|
||||||
def getTitle(a):
|
def getTitle(a):
|
||||||
html = etree.fromstring(a, etree.HTMLParser())
|
try:
|
||||||
result = str(html.xpath('//*[@id="center_column"]/div[2]/h1/text()')).strip(" ['']")
|
html = etree.fromstring(a, etree.HTMLParser())
|
||||||
return result.replace('/',',')
|
result = str(html.xpath('//*[@id="center_column"]/div[2]/h1/text()')).strip(" ['']")
|
||||||
|
return result.replace('/', ',')
|
||||||
|
except:
|
||||||
|
return ''
|
||||||
def getActor(a): #//*[@id="center_column"]/div[2]/div[1]/div/table/tbody/tr[1]/td/text()
|
def getActor(a): #//*[@id="center_column"]/div[2]/div[1]/div/table/tbody/tr[1]/td/text()
|
||||||
html = etree.fromstring(a, etree.HTMLParser()) #//table/tr[1]/td[1]/text()
|
html = etree.fromstring(a, etree.HTMLParser()) #//table/tr[1]/td[1]/text()
|
||||||
result1=str(html.xpath('//th[contains(text(),"出演:")]/../td/a/text()')).strip(" ['']").strip('\\n ').strip('\\n')
|
result1=str(html.xpath('//th[contains(text(),"出演:")]/../td/a/text()')).strip(" ['']").strip('\\n ').strip('\\n')
|
||||||
@@ -92,8 +96,10 @@ def main(number2):
|
|||||||
'tag': getTag(a),
|
'tag': getTag(a),
|
||||||
'label':getLabel(a),
|
'label':getLabel(a),
|
||||||
'year': getYear(getRelease(a)), # str(re.search('\d{4}',getRelease(a)).group()),
|
'year': getYear(getRelease(a)), # str(re.search('\d{4}',getRelease(a)).group()),
|
||||||
|
'actor_photo': '',
|
||||||
|
'website':'https://www.mgstage.com/product/product_detail/'+str(number)+'/',
|
||||||
}
|
}
|
||||||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'),)#.encode('UTF-8')
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'),)#.encode('UTF-8')
|
||||||
return js
|
return js
|
||||||
|
|
||||||
#print(main('200GANA-1624'))
|
#print(main('300maan-373'))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.10.6",
|
"version": "0.11.7",
|
||||||
"version_show":"Beta 10.6",
|
"version_show":"Beta 11.7",
|
||||||
"download": "https://github.com/wenead99/AV_Data_Capture/releases"
|
"download": "https://github.com/wenead99/AV_Data_Capture/releases"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user