由调用flush()改为hook print()
This commit is contained in:
@@ -126,6 +126,13 @@ def close_logfile(logdir: str):
|
||||
pass
|
||||
|
||||
|
||||
_print = print # Hook print
|
||||
_stdout = sys.stdout
|
||||
def print(*args, **kw):
|
||||
_print(*args, **kw)
|
||||
if _stdout != sys.stdout:
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
# 重写视频文件扫描,消除递归,取消全局变量,新增失败文件列表跳过处理
|
||||
def movie_lists(root, conf, regexstr):
|
||||
@@ -333,7 +340,6 @@ f'[!]运行模式:**维护模式**,本程序将在处理{count_all}个视频
|
||||
percentage = str(count / int(count_all) * 100)[:4] + '%'
|
||||
print('[!] - ' + percentage + ' [' + str(count) + '/' + count_all + '] -')
|
||||
create_data_and_move(movie_path, conf, conf.debug())
|
||||
sys.stdout.flush()
|
||||
if count >= stop_count:
|
||||
print("[!]Stop counter triggered!")
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user