Merge pull request #600 from lededev/log-2

国庆节之前最后一点小改动
This commit is contained in:
Yoshiko2
2021-09-29 00:35:44 +08:00
committed by GitHub
3 changed files with 11 additions and 17 deletions

View File

@@ -8,7 +8,7 @@ import typing
import urllib3
import config
from datetime import datetime
from datetime import datetime, timedelta
import time
from pathlib import Path
from ADC_function import file_modification_days, get_html, is_link
@@ -58,7 +58,7 @@ Use --log-dir= to turn off logging feature.""")
class OutLogger(object):
def __init__(self, logfile) -> None:
self.term = sys.stdout
self.log = open(logfile,"w",encoding='utf-8')
self.log = open(logfile,"w",encoding='utf-8',buffering=1)
def __del__(self):
self.close()
def __enter__(self):
@@ -84,7 +84,7 @@ class OutLogger(object):
class ErrLogger(OutLogger):
def __init__(self, logfile) -> None:
self.term = sys.stderr
self.log = open(logfile,"w",encoding='utf-8')
self.log = open(logfile,"w",encoding='utf-8',buffering=1)
def close(self):
if self.term != None:
sys.stderr = self.term
@@ -126,14 +126,6 @@ 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):
escape_folder = re.split("[,]", conf.escape_folder())
@@ -325,7 +317,7 @@ if __name__ == '__main__':
count = 0
count_all = str(len(movie_list))
print('[+]Find', count_all, 'movies')
print('[+]Find', count_all, 'movies. Start at', time.strftime("%Y-%m-%d %H:%M:%S"))
main_mode = conf.main_mode()
stop_count = conf.stop_counter()
if stop_count<1:
@@ -351,8 +343,9 @@ f'[!]运行模式:**维护模式**,本程序将在处理{count_all}个视频
rm_empty_folder(folder_path)
end_time = time.time()
total_time = end_time - start_time
print("[+]Used " + str(round(total_time,2)) + "s")
total_time = str(timedelta(seconds=end_time - start_time))
print("[+]Running time", total_time[:len(total_time) if total_time.rfind('.') < 0 else -3],
" End at", time.strftime("%Y-%m-%d %H:%M:%S"))
print("[+]All finished!!!")
if not (conf.auto_exit() or auto_exit):

View File

@@ -39,7 +39,7 @@ def main(number: str) -> json:
'extrafanart': get_extrafanart(lx),
'label': get_series(lx),
'imagecut': 1,
'actor_photo': get_actor_photo(browser),
# 'actor_photo': get_actor_photo(browser),
'website': 'https://www.caribbeancom.com/moviepages/' + number + '/index.html',
'source': 'carib.py',
'series': get_series(lx),

View File

@@ -109,7 +109,8 @@ def getTag(a):
for i in result1:
i=i.replace(u'\n','')
i=i.replace(u'\t','')
result2.append(i)
if len(i):
result2.append(i)
return result2
@@ -217,7 +218,7 @@ def main(number):
'tag': getTag(detail_page),
'label': getLabel(detail_page),
'year': getYear(getRelease(detail_page)), # str(re.search('\d{4}',getRelease(a)).group()),
'actor_photo': getActorPhoto(browser),
# 'actor_photo': getActorPhoto(browser),
'website': url,
'source': 'xcity.py',
'series': getSeries(detail_page),