This commit is contained in:
caiwx86 2022-12-20 18:09:11 +08:00
parent 7dd1a86335
commit e65a1cd79d
2 changed files with 22 additions and 4 deletions

View File

@ -17,7 +17,7 @@ class htmlUtils:
def getPathSaveHtml(cls,url,type=None):
rstr = r"[\/\\\:\*\?\"\<\>\|\.]" #  '/ \ : * ? " < > |'
file_url = re.sub(rstr, "", url)
file_path = os.path.join(pathStr.base_html_data,file_url)
file_path = os.path.join(pathStr.base_html_data(),file_url)
if type == "new":
return file_path
if os.path.exists(file_path):

View File

@ -6,7 +6,25 @@ class pathStr:
base_CBZ = os.path.join(base_comic_out,"CBZ")
base_comic_img = os.path.join(base_comic_out,"outputComic")
base_conf_path = os.path.join(base_comic_out,".conf")
#base_html_data = os.path.join(base_comic_out,"html_"+str(date))
date = datetime.datetime.now()
date = date.strftime("%Y%m%d")
base_html_data = os.path.join(base_comic_out,"html_"+str(date))
@classmethod
def base_html_data(cls):
date_path = cls.getDatePath()
return os.path.join(cls.base_comic_out,"html_"+str(date_path))
@classmethod
def getDatePath(cls):
date = datetime.datetime.now()
year = int(date.strftime("%Y"))
month = int(date.strftime("%m"))
day = int(date.strftime("%d"))
week = cls.get_week_of_month(year, month, day)
return f"{year}{month}{week}"
@classmethod
def get_week_of_month(cls, year, month, day):
begin = int(datetime.date(year, month, 1).strftime("%W"))
end = int(datetime.date(year, month, day).strftime("%W"))
week = "{:0>2d}".format(end - begin + 1)
return week