update
This commit is contained in:
@@ -113,8 +113,14 @@ class Framework:
|
||||
if os.path.exists(_):
|
||||
plugins = os.listdir(_)
|
||||
|
||||
if self.config['path_dev'] != None and os.path.exists(self.config['path_dev']):
|
||||
plugins += os.listdir(self.config['path_dev'])
|
||||
if self.config['path_dev'] != None:
|
||||
if type(self.config['path_dev']) == type(''):
|
||||
plugin_path_list = [self.config['path_dev']]
|
||||
elif type(self.config['path_dev']) == type([]):
|
||||
plugin_path_list = self.config['path_dev']
|
||||
for __ in plugin_path_list:
|
||||
if os.path.exists(__):
|
||||
plugins += os.listdir(__)
|
||||
|
||||
for package_name in plugins:
|
||||
db_path = os.path.join(self.config['path_data'], 'db', f'{package_name}.db')
|
||||
|
||||
@@ -46,16 +46,23 @@ class PluginManager:
|
||||
try:
|
||||
#plugin_path = F.SystemModelSetting.get('plugin_dev_path')
|
||||
plugin_path = F.config['path_dev']
|
||||
if plugin_path != None and plugin_path != '':
|
||||
if os.path.exists(plugin_path):
|
||||
sys.path.insert(0, plugin_path)
|
||||
tmps = os.listdir(plugin_path)
|
||||
add_plugin_list = []
|
||||
for t in tmps:
|
||||
if not t.startswith('_') and os.path.isdir(os.path.join(plugin_path, t)):
|
||||
add_plugin_list.append(t)
|
||||
cls.all_package_list[t] = {'pos':'dev', 'path':os.path.join(plugin_path, t), 'loading':True}
|
||||
plugins = plugins + add_plugin_list
|
||||
|
||||
if type(plugin_path) == type(''):
|
||||
plugin_path_list = [plugin_path]
|
||||
elif type(plugin_path) == type([]):
|
||||
plugin_path_list = plugin_path
|
||||
|
||||
for __ in plugin_path_list:
|
||||
if __ != None and __ != '':
|
||||
if os.path.exists(__):
|
||||
sys.path.insert(0, __)
|
||||
tmps = os.listdir(__)
|
||||
add_plugin_list = []
|
||||
for t in tmps:
|
||||
if not t.startswith('_') and os.path.isdir(os.path.join(__, t)):
|
||||
add_plugin_list.append(t)
|
||||
cls.all_package_list[t] = {'pos':'dev', 'path':os.path.join(__, t), 'loading':True}
|
||||
plugins = plugins + add_plugin_list
|
||||
except Exception as exception:
|
||||
F.logger.error('Exception:%s', exception)
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
@@ -118,10 +118,12 @@ def videojs():
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@F.app.route("/headers", methods=['GET', 'POST'])
|
||||
def headers():
|
||||
from support import d
|
||||
F.logger.info(d(request.headers))
|
||||
return jsonify(d(request.headers))
|
||||
|
||||
|
||||
# 3.10에서 이거 필수
|
||||
@F.socketio.on('connect', namespace=f'/framework')
|
||||
|
||||
@@ -57,10 +57,6 @@ function j_row_end() {
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function j_hr(margin='5') {
|
||||
var str = '<hr style="width: 100%; margin:'+margin+'px;" />';
|
||||
return str;
|
||||
@@ -73,6 +69,20 @@ function j_hr_black() {
|
||||
|
||||
|
||||
|
||||
// 한줄 왼쪽
|
||||
function j_row_info(left, right, l=2, r=8) {
|
||||
var str =' \
|
||||
<div class="row"> \
|
||||
<div class="col-sm-'+1+'" style="text-align:right;"></div> \
|
||||
<div class="col-sm-'+l+'" style="text-align:right;"> \
|
||||
<strong>'+ left +'</strong> \
|
||||
</div> \
|
||||
<div class="col-sm-'+r+'" style="word-break:break-all;"> \
|
||||
<span class="text-left" style="padding-left:10px; padding-top:3px;">'+right +'</span> \
|
||||
</div> \
|
||||
</div>';
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
VERSION="4.0.28"
|
||||
VERSION="4.0.29"
|
||||
@@ -64,7 +64,7 @@ class PluginBase(object):
|
||||
self.module_list.append(mod_ins)
|
||||
|
||||
except Exception as e:
|
||||
F.logger.error(f'Exception:{str(e)}')
|
||||
F.logger.error(f'[{self.package_name}] Exception:{str(e)}')
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@ import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
|
||||
from support import SupportSubprocess, SupportUtil, logger
|
||||
from support import SupportFile, SupportSubprocess, SupportUtil, logger
|
||||
|
||||
|
||||
class SupportFfmpeg(object):
|
||||
@@ -92,6 +93,7 @@ class SupportFfmpeg(object):
|
||||
try:
|
||||
self.status = SupportFfmpeg.Status.USER_STOP
|
||||
self.kill()
|
||||
logger.warning('stop')
|
||||
except Exception as e:
|
||||
logger.error(f'Exception:{str(e)}')
|
||||
logger.error(traceback.format_exc())
|
||||
@@ -111,22 +113,29 @@ class SupportFfmpeg(object):
|
||||
|
||||
def thread_fuction(self):
|
||||
try:
|
||||
header_count = 0
|
||||
if self.proxy is None:
|
||||
if self.headers is None:
|
||||
command = [self.__ffmpeg_path, '-y', '-i', self.url, '-c', 'copy', '-bsf:a', 'aac_adtstoasc']
|
||||
else:
|
||||
headers_command = []
|
||||
tmp = ""
|
||||
for key, value in self.headers.items():
|
||||
if key.lower() == 'user-agent':
|
||||
headers_command.append('-user_agent')
|
||||
headers_command.append(value)
|
||||
headers_command.append(f"{value}")
|
||||
pass
|
||||
else:
|
||||
headers_command.append('-headers')
|
||||
#headers_command.append('-headers')
|
||||
if platform.system() == 'Windows':
|
||||
headers_command.append('\'%s:%s\''%(key,value))
|
||||
tmp += f'{key}:{value}\r\n'
|
||||
header_count += 1
|
||||
else:
|
||||
headers_command.append(f'{key}:{value}')
|
||||
#tmp.append(f'{key}:{value}')
|
||||
tmp += f'{key}:{value}\r\n'
|
||||
if len(tmp) > 0:
|
||||
headers_command.append('-headers')
|
||||
headers_command.append(f'{tmp}')
|
||||
command = [self.__ffmpeg_path, '-y'] + headers_command + ['-i', self.url, '-c', 'copy', '-bsf:a', 'aac_adtstoasc']
|
||||
else:
|
||||
command = [self.__ffmpeg_path, '-y', '-http_proxy', self.proxy, '-i', self.url, '-c', 'copy', '-bsf:a', 'aac_adtstoasc']
|
||||
@@ -140,8 +149,9 @@ class SupportFfmpeg(object):
|
||||
else:
|
||||
command.append(self.temp_fullpath)
|
||||
|
||||
|
||||
try:
|
||||
logger.debug(' '.join(command))
|
||||
#logger.debug(' '.join(command))
|
||||
if os.path.exists(self.temp_fullpath):
|
||||
for f in SupportFfmpeg.__instance_list:
|
||||
if f.__idx != self.__idx and f.temp_fullpath == self.temp_fullpath and f.status in [SupportFfmpeg.Status.DOWNLOADING, SupportFfmpeg.Status.READY]:
|
||||
@@ -149,8 +159,24 @@ class SupportFfmpeg(object):
|
||||
return
|
||||
except:
|
||||
pass
|
||||
logger.error(' '.join(command))
|
||||
#logger.error(' '.join(command))
|
||||
command = SupportSubprocess.command_for_windows(command)
|
||||
|
||||
if platform.system() == 'Windows' and header_count > 1:
|
||||
if os.environ.get('FF'):
|
||||
from framework import F
|
||||
batfilepath = os.path.join(F.config['path_data'], 'tmp', f"{time.time()}.bat")
|
||||
else:
|
||||
batfilepath = f"{time.time()}.bat"
|
||||
tmp = command.replace('\r\n', '!CRLF!')
|
||||
text = f"""setlocal enabledelayedexpansion
|
||||
SET CRLF=^
|
||||
|
||||
|
||||
{tmp}"""
|
||||
SupportFile.write_file(batfilepath, text)
|
||||
command = batfilepath
|
||||
|
||||
self.process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, encoding='utf8')
|
||||
|
||||
self.status = SupportFfmpeg.Status.READY
|
||||
@@ -320,7 +346,7 @@ class SupportFfmpeg(object):
|
||||
def send_to_listener(self, **arg):
|
||||
if self.total_callback_function != None:
|
||||
self.total_callback_function(**arg)
|
||||
if self.callback_function is not None:
|
||||
if self.callback_function is not None and self.callback_function != self.total_callback_function:
|
||||
arg['callback_id'] = self.callback_id
|
||||
self.callback_function(**arg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user