Version fallback to Beta 11.6

This commit is contained in:
Yoshiko
2019-08-09 00:32:04 +08:00
committed by GitHub
parent 54437236f0
commit 446e1bf7d0
7 changed files with 68 additions and 84 deletions

View File

@@ -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")
total = a2 + b2 + c2 + d2 + e2 + f2 + g2 + h2
return total
def CreatFolder(folder_path):
if not os.path.exists(folder_path): # 新建文件夹
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
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('[*] 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("[*]=====================================")
CEF(input_dir)
print("[!]Making Data for [" + i + "], the number is [" + getNumber(i) + "]")
RunCore()
print("[*]=====================================")
CEF('JAV_output')
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[+][+]按回车键结束,你可以在结束之前查看和错误信息。")