From a20bfc08b082951e9097e25cae501bfd28469592 Mon Sep 17 00:00:00 2001 From: lededev Date: Tue, 28 Sep 2021 17:32:31 +0800 Subject: [PATCH 1/5] small optimization of log feature --- AV_Data_Capture.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/AV_Data_Capture.py b/AV_Data_Capture.py index b6b65b6..c960959 100755 --- a/AV_Data_Capture.py +++ b/AV_Data_Capture.py @@ -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()) From ef1c816483e7c32773b66551b35ed5d98830dc2c Mon Sep 17 00:00:00 2001 From: lededev Date: Tue, 28 Sep 2021 17:55:06 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E8=AE=A1=E6=97=B6=E4=B8=BA=E6=97=B6=E5=88=86=E7=A7=92=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8F=AF=E8=AF=BB=E6=80=A7=EF=BC=8C=E5=B0=8F=E6=95=B0?= =?UTF-8?q?=E7=82=B9=E4=BF=9D=E7=95=993=E4=BD=8D=E4=BB=A5=E4=BE=BF?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E5=AE=9A=E4=BD=8D=E5=88=B0=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AV_Data_Capture.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AV_Data_Capture.py b/AV_Data_Capture.py index c960959..b7ab406 100755 --- a/AV_Data_Capture.py +++ b/AV_Data_Capture.py @@ -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 @@ -343,8 +343,8 @@ 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]) print("[+]All finished!!!") if not (conf.auto_exit() or auto_exit): From b5d6c7fe4f35b4b9dedb4dc6b9dfcfd97136bc8e Mon Sep 17 00:00:00 2001 From: lededev Date: Tue, 28 Sep 2021 18:30:50 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=86=85=E5=89=8D?= =?UTF-8?q?=E5=90=8E=E5=A2=9E=E5=8A=A0=E5=AE=8C=E6=95=B4=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=88=B3=E4=BB=A5=E4=BE=BF=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AV_Data_Capture.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AV_Data_Capture.py b/AV_Data_Capture.py index b7ab406..8ac0d9c 100755 --- a/AV_Data_Capture.py +++ b/AV_Data_Capture.py @@ -317,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: @@ -344,7 +344,8 @@ f'[!]运行模式:**维护模式**,本程序将在处理{count_all}个视频 end_time = time.time() total_time = str(timedelta(seconds=end_time - start_time)) - print("[+]Running time", total_time[:len(total_time) if total_time.rfind('.') < 0 else -3]) + 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): From b5b2e7f0d803522f77249ad225577d8208f9905a Mon Sep 17 00:00:00 2001 From: lededev Date: Tue, 28 Sep 2021 18:31:20 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=94=B1=E4=BA=8E=E7=9B=AE=E5=89=8D?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=9C=AA=E5=AE=9E=E7=8E=B0=E6=BC=94=E5=91=98?= =?UTF-8?q?=E7=85=A7=E7=89=87=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=9A=82=E6=97=B6?= =?UTF-8?q?=E5=B1=8F=E8=94=BD=E4=BB=A5=E6=8F=90=E5=8D=87=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebCrawler/carib.py | 2 +- WebCrawler/xcity.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WebCrawler/carib.py b/WebCrawler/carib.py index f4fa9c0..8eee1af 100755 --- a/WebCrawler/carib.py +++ b/WebCrawler/carib.py @@ -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), diff --git a/WebCrawler/xcity.py b/WebCrawler/xcity.py index f531470..01de367 100644 --- a/WebCrawler/xcity.py +++ b/WebCrawler/xcity.py @@ -217,7 +217,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), From 3e1d951af8bdcf2dbdf4512b7c9475eba87b9a8a Mon Sep 17 00:00:00 2001 From: lededev Date: Tue, 28 Sep 2021 18:36:20 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E4=B8=BA=E7=A9=BA=E7=9A=84tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebCrawler/xcity.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WebCrawler/xcity.py b/WebCrawler/xcity.py index 01de367..a7b4cff 100644 --- a/WebCrawler/xcity.py +++ b/WebCrawler/xcity.py @@ -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