Update Beta 11.7
This commit is contained in:
parent
2adcfacf27
commit
cfb3511360
@ -12,20 +12,17 @@ import subprocess
|
||||
import shutil
|
||||
from configparser import ConfigParser
|
||||
|
||||
version='0.11.6'
|
||||
version='0.11.7'
|
||||
os.chdir(os.getcwd())
|
||||
|
||||
input_dir='.' # 电影的读取与输出路径, 默认为当前路径
|
||||
output_dir='.'
|
||||
|
||||
config = ConfigParser()
|
||||
config.read(config_file, encoding='UTF-8')
|
||||
|
||||
def UpdateCheck():
|
||||
if UpdateCheckSwitch() == '1':
|
||||
html2 = get_html('https://raw.githubusercontent.com/wenead99/AV_Data_Capture/master/update_check.json')
|
||||
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 *')
|
||||
@ -36,21 +33,15 @@ def UpdateCheck():
|
||||
|
||||
def set_directory(): # 设置读取与存放路径
|
||||
global input_dir
|
||||
global output_dir
|
||||
# 配置项switch为1且定义了新的路径时, 更改默认存取路径
|
||||
if config['directory_capture']['switch'] == '1':
|
||||
custom_input = config['directory_capture']['input_directory']
|
||||
custom_output = config['directory_capture']['output_directory']
|
||||
if custom_input != '': # 自定义了输入路径
|
||||
input_dir = format_path(custom_input)
|
||||
# 若自定义了输入路径, 输出路径默认在输入路径下
|
||||
output_dir = input_dir
|
||||
output_dir = format_path(custom_output) if custom_output != '' else output_dir # 自定义了输出路径
|
||||
CreatFolder(output_dir)
|
||||
CreatFolder(input_dir)
|
||||
print('[+]Working directory is "' + os.getcwd() + '".')
|
||||
print('[+]Using "' + input_dir + '" as input directory.')
|
||||
print('[+]Using "' + output_dir + '" as output directory.')
|
||||
#print('[+]Working directory is "' + os.getcwd() + '".')
|
||||
#print('[+]Using "' + input_dir + '" as input directory.')
|
||||
|
||||
def format_path(path): # 使路径兼容Linux与MacOS
|
||||
if path.find('\\'): # 是仅兼容Windows的路径格式
|
||||
@ -130,33 +121,33 @@ 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/')
|
||||
#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/')
|
||||
#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),'--output',output_dir] #从py文件启动(用于源码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),'--output',output_dir] #从exe启动(用于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),'--output',output_dir] #从py文件启动(用于源码py)
|
||||
cmd_arg=[sys.executable,'core.py',movie,'--number',getNumber(movie)] #从py文件启动(用于源码py)
|
||||
process=subprocess.Popen(cmd_arg)
|
||||
return process
|
||||
|
||||
if __name__ =='__main__':
|
||||
print('[*]===========AV Data Capture===========')
|
||||
print('[*] Version '+version)
|
||||
print('[*] Version '+version)
|
||||
print('[*]=====================================')
|
||||
UpdateCheck()
|
||||
os.chdir(os.getcwd())
|
||||
set_directory()
|
||||
CreatFolder(output_dir+'/failed')
|
||||
|
||||
|
||||
count = 0
|
||||
movies = movie_lists()
|
||||
|
@ -1,5 +1,5 @@
|
||||
[proxy]
|
||||
proxy=127.0.0.1:8001
|
||||
proxy=127.0.0.1:1080
|
||||
timeout=10
|
||||
retry=3
|
||||
|
||||
@ -16,8 +16,6 @@ media_warehouse=emby
|
||||
#plex only test!
|
||||
|
||||
[directory_capture]
|
||||
switch=1
|
||||
input_directory=
|
||||
output_directory=
|
||||
|
||||
#everyone switch:1=on, 0=off
|
||||
|
28
core.py
28
core.py
@ -32,7 +32,6 @@ imagecut=''
|
||||
tag=[]
|
||||
cn_sub=''
|
||||
path=''
|
||||
output_dir=''
|
||||
houzhui=''
|
||||
website=''
|
||||
json_data={}
|
||||
@ -51,20 +50,19 @@ except:
|
||||
def moveFailedFolder():
|
||||
global filepath
|
||||
print('[-]Move to "failed"')
|
||||
print('[-]' + filepath + ' -> ' + output_dir + '/failed/')
|
||||
os.rename(filepath, output_dir + '/failed/')
|
||||
#print('[-]' + filepath + ' -> ' + output_dir + '/failed/')
|
||||
#os.rename(filepath, output_dir + '/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("--output", help="Enter Output directory here", default='')
|
||||
args = parser.parse_args()
|
||||
return (args.file, args.number, args.output)
|
||||
return (args.file, args.number)
|
||||
def CreatFailedFolder():
|
||||
if not os.path.exists(output_dir+'/failed/'): # 新建failed文件夹
|
||||
if not os.path.exists('/failed/'): # 新建failed文件夹
|
||||
try:
|
||||
os.makedirs(output_dir+'/failed/')
|
||||
os.makedirs('/failed/')
|
||||
except:
|
||||
print("[-]failed!can not be make folder 'failed'\n[-](Please run as Administrator)")
|
||||
os._exit(0)
|
||||
@ -158,10 +156,10 @@ def creatFolder(): #创建文件夹
|
||||
global actor
|
||||
global path
|
||||
if len(actor) > 240: #新建成功输出文件夹
|
||||
path = output_dir + '/' + location_rule.replace("'actor'","'超多人'",3).replace("actor","'超多人'",3) #path为影片+元数据所在目录
|
||||
path = location_rule.replace("'actor'","'超多人'",3).replace("actor","'超多人'",3) #path为影片+元数据所在目录
|
||||
#print(path)
|
||||
else:
|
||||
path = output_dir + '/' + location_rule
|
||||
path = location_rule
|
||||
#print(path)
|
||||
if not os.path.exists(path):
|
||||
try:
|
||||
@ -377,16 +375,9 @@ 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())
|
||||
os.rename(filepath, number + houzhui)
|
||||
try:
|
||||
print('[*]' + filepath + ' -> ' + output_dir + number + houzhui)
|
||||
os.rename(filepath, output_dir + '/' + number + houzhui)
|
||||
except FileExistsError:
|
||||
print('[-]File Exists! Please check your movie!')
|
||||
print('[-]move to the root folder of the program.')
|
||||
os._exit(0)
|
||||
try:
|
||||
print('[*]' + output_dir + '/' + number + houzhui + ' -> ' + path)
|
||||
os.rename(output_dir + '/' + number + houzhui, path)
|
||||
shutil.move(number + houzhui, path)
|
||||
except:
|
||||
print('[-]File Exists! Please check your movie!')
|
||||
print('[-]move to the root folder of the program.')
|
||||
@ -413,7 +404,6 @@ if __name__ == '__main__':
|
||||
moveFailedFolder()
|
||||
else:
|
||||
number = argparse_get_file()[1]
|
||||
output_dir = argparse_get_file()[2]
|
||||
CreatFailedFolder()
|
||||
getDataFromJSON(number) # 定义番号
|
||||
creatFolder() # 创建文件夹
|
||||
|
Loading…
Reference in New Issue
Block a user