Version fallback to Beta 11.6
This commit is contained in:
parent
54437236f0
commit
446e1bf7d0
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import requests
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import glob
|
||||
@ -8,20 +7,20 @@ import re
|
||||
import sys
|
||||
from ADC_function import *
|
||||
import json
|
||||
import subprocess
|
||||
import shutil
|
||||
from configparser import ConfigParser
|
||||
|
||||
version='0.11.7'
|
||||
version='0.11.6'
|
||||
os.chdir(os.getcwd())
|
||||
|
||||
config = ConfigParser()
|
||||
config.read(config_file, encoding='UTF-8')
|
||||
input_dir=config['directory_capture']['input_directory']
|
||||
|
||||
def UpdateCheck():
|
||||
if UpdateCheckSwitch() == '1':
|
||||
html = json.loads(get_html('https://raw.githubusercontent.com/wenead99/AV_Data_Capture/master/update_check.json'))
|
||||
html2 = get_html('https://raw.githubusercontent.com/wenead99/AV_Data_Capture/master/update_check.json')
|
||||
html = json.loads(str(html2))
|
||||
|
||||
if not version == html['version']:
|
||||
print('[*] * New update ' + html['version'] + ' *')
|
||||
print('[*] * Download *')
|
||||
@ -29,32 +28,36 @@ def UpdateCheck():
|
||||
print('[*]=====================================')
|
||||
else:
|
||||
print('[+]Update Check disabled!')
|
||||
|
||||
def format_path(path): # 使路径兼容Linux与MacOS
|
||||
if path.find('\\'): # 是仅兼容Windows的路径格式
|
||||
path_list=path.split('\\')
|
||||
path='/'.join(path_list) # 转换为可移植的路径格式
|
||||
return path
|
||||
|
||||
|
||||
def movie_lists():
|
||||
a2 = glob.glob( input_dir + "/*.mp4")
|
||||
b2 = glob.glob( input_dir + "/*.avi")
|
||||
c2 = glob.glob( input_dir + "/*.rmvb")
|
||||
d2 = glob.glob( input_dir + "/*.wmv")
|
||||
e2 = glob.glob( input_dir + "/*.mov")
|
||||
f2 = glob.glob( input_dir + "/*.mkv")
|
||||
g2 = glob.glob( input_dir + "/*.flv")
|
||||
h2 = glob.glob( input_dir + "/*.ts")
|
||||
if config['directory_capture']['switch'] == '0' or config['directory_capture']['switch'] == '':
|
||||
a2 = glob.glob(r".\*.mp4")
|
||||
b2 = glob.glob(r".\*.avi")
|
||||
c2 = glob.glob(r".\*.rmvb")
|
||||
d2 = glob.glob(r".\*.wmv")
|
||||
e2 = glob.glob(r".\*.mov")
|
||||
f2 = glob.glob(r".\*.mkv")
|
||||
g2 = glob.glob(r".\*.flv")
|
||||
h2 = glob.glob(r".\*.ts")
|
||||
total = a2 + b2 + c2 + d2 + e2 + f2 + g2 + h2
|
||||
return total
|
||||
def CreatFolder(folder_path):
|
||||
if not os.path.exists(folder_path): # 新建文件夹
|
||||
elif config['directory_capture']['switch'] == '1':
|
||||
directory = config['directory_capture']['directory']
|
||||
a2 = glob.glob(r".\\" + directory + "\*.mp4")
|
||||
b2 = glob.glob(r".\\" + directory + "\*.avi")
|
||||
c2 = glob.glob(r".\\" + directory + "\*.rmvb")
|
||||
d2 = glob.glob(r".\\" + directory + "\*.wmv")
|
||||
e2 = glob.glob(r".\\" + directory + "\*.mov")
|
||||
f2 = glob.glob(r".\\" + directory + "\*.mkv")
|
||||
g2 = glob.glob(r".\\" + directory + "\*.flv")
|
||||
h2 = glob.glob(r".\\" + directory + "\*.ts")
|
||||
total = a2 + b2 + c2 + d2 + e2 + f2 + g2 + h2
|
||||
return total
|
||||
def CreatFailedFolder():
|
||||
if not os.path.exists('failed/'): # 新建failed文件夹
|
||||
try:
|
||||
print('[+]Creating ' + folder_path)
|
||||
os.makedirs(folder_path)
|
||||
os.makedirs('failed/')
|
||||
except:
|
||||
print("[-]failed!can not be make folder '"+folder_path+"'\n[-](Please run as Administrator)")
|
||||
print("[-]failed!can not be make folder 'failed'\n[-](Please run as Administrator)")
|
||||
os._exit(0)
|
||||
def lists_from_test(custom_nuber): #电影列表
|
||||
a=[]
|
||||
@ -108,55 +111,40 @@ def getNumber(filepath):
|
||||
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/')
|
||||
|
||||
shutil.move(filepath, str(os.getcwd()) + '/' + '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/')
|
||||
print('[-]Move ' + os.path.basename(filepath) + ' to failed folder')
|
||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
||||
|
||||
def RunCore(movie):
|
||||
# 异步调用core.py, core.py作为子线程执行, 本程序继续执行.
|
||||
def RunCore():
|
||||
if os.path.exists('core.py'):
|
||||
cmd_arg=[sys.executable,'core.py',movie,'--number',getNumber(movie)] #从py文件启动(用于源码py)
|
||||
os.system('python core.py' + ' "' + i + '" --number "'+getNumber(i)+'"') #从py文件启动(用于源码py)
|
||||
elif os.path.exists('core.exe'):
|
||||
cmd_arg=['core.exe',movie,'--number',getNumber(movie)] #从exe启动(用于EXE版程序)
|
||||
os.system('core.exe' + ' "' + i + '" --number "'+getNumber(i)+'"') #从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
|
||||
os.system('python core.py' + ' "' + i + '" --number "' + getNumber(i) + '"') #从py文件启动(用于源码py)
|
||||
|
||||
if __name__ =='__main__':
|
||||
print('[*]===========AV Data Capture===========')
|
||||
print('[*] Version '+version)
|
||||
print('[*]=====================================')
|
||||
CreatFailedFolder()
|
||||
UpdateCheck()
|
||||
os.chdir(os.getcwd())
|
||||
|
||||
|
||||
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]+'%'
|
||||
count_all = str(len(movie_lists()))
|
||||
for i in movie_lists(): #遍历电影列表 交给core处理
|
||||
count = count + 1
|
||||
percentage = str(count/int(count_all)*100)[:4]+'%'
|
||||
print('[!] - '+percentage+' ['+str(count)+'/'+count_all+'] -')
|
||||
print("[!]The [" + getNumber(movies[i]) + "] process is done.")
|
||||
print("[!]Making Data for [" + i + "], the number is [" + getNumber(i) + "]")
|
||||
RunCore()
|
||||
print("[*]=====================================")
|
||||
|
||||
CEF(input_dir)
|
||||
CEF('JAV_output')
|
||||
print("[+]All finished!!!")
|
||||
input("[+][+]Press enter key exit, you can check the error messge before you exit.\n[+][+]按回车键结束,你可以在结束之前查看和错误信息。")
|
23
core.py
23
core.py
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
@ -50,19 +49,18 @@ except:
|
||||
def moveFailedFolder():
|
||||
global filepath
|
||||
print('[-]Move to "failed"')
|
||||
#print('[-]' + filepath + ' -> ' + output_dir + '/failed/')
|
||||
#os.rename(filepath, output_dir + '/failed/')
|
||||
shutil.move(filepath, str(os.getcwd()) + '/' + 'failed/')
|
||||
os._exit(0)
|
||||
def argparse_get_file():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("file", help="Write the file path on here")
|
||||
parser.add_argument("--number", help="Enter Number on here", default='')
|
||||
parser.add_argument("file", help="Write the file path on here")
|
||||
args = parser.parse_args()
|
||||
return (args.file, args.number)
|
||||
def CreatFailedFolder():
|
||||
if not os.path.exists('/failed/'): # 新建failed文件夹
|
||||
if not os.path.exists('failed/'): # 新建failed文件夹
|
||||
try:
|
||||
os.makedirs('/failed/')
|
||||
os.makedirs('failed/')
|
||||
except:
|
||||
print("[-]failed!can not be make folder 'failed'\n[-](Please run as Administrator)")
|
||||
os._exit(0)
|
||||
@ -103,8 +101,6 @@ def getDataFromJSON(file_number): #从JSON返回元数据
|
||||
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))
|
||||
@ -377,14 +373,19 @@ def cutImage():
|
||||
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())
|
||||
try:
|
||||
os.rename(filepath, number + houzhui)
|
||||
except FileExistsError:
|
||||
print('[-]File Exists! Please check your movie!')
|
||||
print('[-]move to the root folder of the program.')
|
||||
os._exit(0)
|
||||
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():
|
||||
def renameJpgToBackdrop_copy():
|
||||
if option == 'plex':
|
||||
shutil.copy(path + '/fanart.jpg', path + '/Backdrop.jpg')
|
||||
shutil.copy(path + '/poster.png', path + '/thumb.png')
|
||||
@ -402,7 +403,7 @@ if __name__ == '__main__':
|
||||
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!")
|
||||
print("[-]failed!Please rename the filename again!")
|
||||
moveFailedFolder()
|
||||
else:
|
||||
number = argparse_get_file()[1]
|
||||
@ -413,4 +414,4 @@ if __name__ == '__main__':
|
||||
PrintFiles(filepath) # 打印文件
|
||||
cutImage() # 裁剪图
|
||||
pasteFileToFolder(filepath, path) # 移动文件
|
||||
moveJpgToBackdrop_copy()
|
||||
renameJpgToBackdrop_copy()
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
from lxml import etree#need install
|
||||
import json
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
import requests #need install
|
||||
from pyquery import PyQuery as pq#need install
|
||||
|
1
javdb.py
1
javdb.py
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
from lxml import etree
|
||||
import json
|
||||
|
Loading…
Reference in New Issue
Block a user