diff --git a/utils/HtmlUtils.py b/utils/HtmlUtils.py index 26f7008..536f2f4 100644 --- a/utils/HtmlUtils.py +++ b/utils/HtmlUtils.py @@ -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): diff --git a/utils/comic/PathStr.py b/utils/comic/PathStr.py index acbaa0a..5567547 100644 --- a/utils/comic/PathStr.py +++ b/utils/comic/PathStr.py @@ -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)) \ No newline at end of file + @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 \ No newline at end of file