66 lines
2.1 KiB
Python
66 lines
2.1 KiB
Python
import os,datetime
|
|
from time import strftime
|
|
class pathStr:
|
|
|
|
comic_name = None
|
|
comic_jm="JM"
|
|
comic_bz="BZ"
|
|
comic_rm="RM"
|
|
|
|
comic_url_main = None
|
|
base_comic_out = os.path.join("/mnt", "Comics")
|
|
old_cbz_path = os.path.join("/mnt","OldComics")
|
|
@classmethod
|
|
def base_cbz(cls): return cls.getBaseComicPath("CBZ")
|
|
@classmethod
|
|
def base_comic_img(cls): return cls.getBaseComicPath("outputComic")
|
|
@classmethod
|
|
def base_conf_path(cls): return cls.getBaseComicPath(".conf")
|
|
@classmethod
|
|
def base_html_cache(cls): return cls.getBaseComicPath("html_cache")
|
|
@classmethod
|
|
def base_html_chapter(cls): return cls.getBaseComicPath("html_updated")
|
|
@classmethod
|
|
def base_comic_update(cls): return cls.getBaseComicPath("comic_update")
|
|
@classmethod
|
|
def base_db(cls): return cls.getBaseComicPath("db")
|
|
|
|
@classmethod
|
|
def getBaseComicPath(cls,join_path): return os.path.join(cls.base_comic_out,join_path)
|
|
|
|
@classmethod
|
|
def setComicMainAndPath(cls,value):
|
|
cls.setComicMain(value)
|
|
cls.setComicMainPath(value)
|
|
|
|
@classmethod
|
|
def setComicMain(cls,value): cls.comic_name = value
|
|
|
|
@classmethod
|
|
def getComicMain(cls): return cls.comic_name
|
|
|
|
@classmethod
|
|
def setComicMainPath(cls,value):
|
|
#if value != cls.comic_rm: cls.base_comic_out = os.path.join(cls.base_comic_out, value)
|
|
cls.base_comic_out = os.path.join(cls.base_comic_out, value)
|
|
|
|
@classmethod
|
|
def base_html_week(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 |