update
This commit is contained in:
@@ -13,6 +13,7 @@ if (tmp.length == 2) {
|
||||
var PAGE_NAME = tmp[3];
|
||||
}
|
||||
var current_data = null;
|
||||
var current_page = null;
|
||||
console.log("NAME: [" + PACKAGE_NAME + '] [' + MODULE_NAME + '] [' + PAGE_NAME + ']');
|
||||
|
||||
$(window).on("load resize", function (event) {
|
||||
|
||||
@@ -391,6 +391,7 @@ function make_page_html(data) {
|
||||
for (var i = data.start_page ; i <= data.last_page ; i++) {
|
||||
str += '<button id="gloablSearchPageBtn" data-page="' + i +'" type="button" class="btn btn-secondary" ';
|
||||
if (i == data.current_page) {
|
||||
current_page = i
|
||||
str += 'disabled';
|
||||
}
|
||||
str += '>'+i+'</button>';
|
||||
|
||||
@@ -88,7 +88,7 @@ function j_progress(id, width, label) {
|
||||
var str = '';
|
||||
str += '<div class="progress" style="height: 25px;">'
|
||||
str += '<div id="'+id+'" class="progress-bar" style="background-color:yellow;width:'+width+'%"></div>';
|
||||
str += '<div id="'+id+'_label" class="justify-content-center d-flex w-100 position-absolute" style="margin-top:2px">'+label+'</div>';
|
||||
str += '<div id="'+id+'_label" class="justify-content-center d-flex w-100 " style="margin-top:2px">'+label+'</div>';
|
||||
str += '</div>'
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
VERSION="4.0.33"
|
||||
VERSION="4.0.34"
|
||||
@@ -1,14 +1,17 @@
|
||||
# 순서 바꾸지 말 것
|
||||
import os, sys, traceback, re, threading, time, queue
|
||||
from datetime import datetime, timedelta
|
||||
from flask import Blueprint, render_template, jsonify, redirect, request
|
||||
from sqlalchemy import desc, or_
|
||||
|
||||
from framework import logger
|
||||
from .model_setting import get_model_setting
|
||||
from .logic import Logic
|
||||
from .route import default_route, default_route_socketio_module, default_route_socketio_page, default_route_single_module
|
||||
from .logic_module_base import PluginModuleBase, PluginPageBase
|
||||
from .ffmpeg_queue import FfmpegQueueEntity, FfmpegQueue
|
||||
#from .ffmpeg_queue import FfmpegQueueEntity, FfmpegQueue
|
||||
from .model_base import ModelBase
|
||||
from .create_plugin import create_plugin_instance
|
||||
|
||||
|
||||
import os, sys, traceback, re, threading, time
|
||||
from datetime import datetime, timedelta
|
||||
from flask import Blueprint, render_template, jsonify, redirect, request
|
||||
from framework import *
|
||||
from tool import *
|
||||
|
||||
@@ -2,12 +2,12 @@ import traceback
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from framework import F
|
||||
from sqlalchemy import desc, or_
|
||||
|
||||
|
||||
class ModelBase(F.db.Model):
|
||||
__abstract__ = True
|
||||
__table_args__ = {'mysql_collate': 'utf8_general_ci'}
|
||||
model_setting = None
|
||||
P = None
|
||||
|
||||
def __repr__(self):
|
||||
@@ -96,16 +96,12 @@ class ModelBase(F.db.Model):
|
||||
F.db.session.query(cls).delete()
|
||||
F.db.session.commit()
|
||||
else:
|
||||
now = datetime.datetime.now()
|
||||
ago = now - datetime.timedelta(days=days)
|
||||
|
||||
now = datetime.now()
|
||||
ago = now - timedelta(days=int(days))
|
||||
#ago.hour = 0
|
||||
#ago.minute = 0
|
||||
ret = F.db.session.query(cls).filter(cls.created_time > ago).delete()
|
||||
cls.P.debug(ret)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
cls.P.logger.error(f'Exception:{str(e)}')
|
||||
@@ -131,7 +127,7 @@ class ModelBase(F.db.Model):
|
||||
query = cls.make_query(req, order=order, search=search, option1=option1, option2=option2)
|
||||
count = query.count()
|
||||
query = query.limit(page_size).offset((page-1)*page_size)
|
||||
F.logger.debug('cls count:%s', count)
|
||||
#F.logger.debug('cls count:%s', count)
|
||||
lists = query.all()
|
||||
ret['list'] = [item.as_dict() for item in lists]
|
||||
ret['paging'] = cls.get_paging_info(count, page, page_size)
|
||||
@@ -155,3 +151,23 @@ class ModelBase(F.db.Model):
|
||||
query = F.db.session.query(cls)
|
||||
return query
|
||||
|
||||
|
||||
@classmethod
|
||||
def make_query_search(cls, query, search, field):
|
||||
if search is not None and search != '':
|
||||
if search.find('|') != -1:
|
||||
tmp = search.split('|')
|
||||
conditions = []
|
||||
for tt in tmp:
|
||||
if tt != '':
|
||||
conditions.append(field.like('%'+tt.strip()+'%') )
|
||||
query = query.filter(or_(*conditions))
|
||||
elif search.find(',') != -1:
|
||||
tmp = search.split(',')
|
||||
for tt in tmp:
|
||||
if tt != '':
|
||||
query = query.filter(field.like('%'+tt.strip()+'%'))
|
||||
else:
|
||||
query = query.filter(field.like('%'+search+'%'))
|
||||
#query = query1.union(query2)
|
||||
return query
|
||||
|
||||
@@ -93,7 +93,7 @@ class SupportFfmpeg(object):
|
||||
try:
|
||||
self.status = SupportFfmpeg.Status.USER_STOP
|
||||
self.kill()
|
||||
logger.warning('stop')
|
||||
#logger.warning('stop')
|
||||
except Exception as e:
|
||||
logger.error(f'Exception:{str(e)}')
|
||||
logger.error(traceback.format_exc())
|
||||
@@ -192,6 +192,9 @@ SET CRLF=^
|
||||
self.kill()
|
||||
else:
|
||||
process_ret = self.process.wait(timeout=60*self.timeout_minute)
|
||||
# 2022-10-25
|
||||
time.sleep(3)
|
||||
logger.info(f"{process_ret=}")
|
||||
if process_ret is None: # timeout
|
||||
if self.status != SupportFfmpeg.Status.COMPLETED and self.status != SupportFfmpeg.Status.USER_STOP and self.status != SupportFfmpeg.Status.PF_STOP:
|
||||
self.status = SupportFfmpeg.Status.TIME_OVER
|
||||
@@ -362,6 +365,19 @@ SET CRLF=^
|
||||
logger.error(f'Exception:{str(e)}')
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
@classmethod
|
||||
def stop_by_callback_id(cls, callback_id):
|
||||
try:
|
||||
for __instance in SupportFfmpeg.__instance_list:
|
||||
if __instance.callback_id == callback_id:
|
||||
__instance.stop()
|
||||
break
|
||||
except Exception as e:
|
||||
logger.error(f'Exception:{str(e)}')
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_instance_by_idx(cls, idx):
|
||||
try:
|
||||
|
||||
@@ -81,5 +81,5 @@ try:
|
||||
P.set_module_list([ModuleHome, ModuleRoute, ModuleSetting, ModulePlugin, ModuleTool, ModuleLog])
|
||||
|
||||
except Exception as e:
|
||||
P.logger.error(f'Exception:{str(e)}')
|
||||
P.logger.error(traceback.format_exc())
|
||||
F.logger.error(f'Exception:{str(e)}')
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
@@ -16,3 +16,8 @@ class ToolUtil(object):
|
||||
url += f"apikey={F.SystemModelSetting.get('apikey')}"
|
||||
return url
|
||||
|
||||
@classmethod
|
||||
def make_path(cls, data):
|
||||
from framework import F
|
||||
return data.replace('{PATH_DATA}', F.config['path_data'])
|
||||
|
||||
Reference in New Issue
Block a user