This commit is contained in:
caiwx86 2023-04-07 10:26:46 +08:00
parent ab6ea5b476
commit da76a2ce17
4 changed files with 28 additions and 4 deletions

View File

@ -11,6 +11,7 @@ from common.ComicInfo import ComicInfo as ci
from common.Comic import Comic
from common.Comic import ListComic
from common.Constant import ComicPath
from utils.FileUtils import fileUtils
#中心框架
class baseComic:
@ -68,6 +69,11 @@ class baseComic:
#存在完成配置文件 但文件不存在 将清空完成配置文件
#if ciUtils.isProgressDone() and fu.notExists(ComicPath.getNewCBZComicChapter("file")):
# ciUtils.setProgressFail()
cbz_path = ComicPath.getPathCBZComicChapter()
if fileUtils.getModificationDateYMD(cbz_path,not_exists="20101010") > 20230405:
os.remove(cbz_path)
print(f"已删除CBZ, {cbz_path}")
ciUtils.setProgressFail()
#不存在完成配置文件 则允许下载
if not ciUtils.isProgressDone():
#if fu.exists(ComicPath.getNewCBZComicChapter("file")): ciUtils.setProgressDone()

View File

@ -140,6 +140,8 @@ class ComicPath:
def getPathOldOriginCBZComicChapter(cls): return cls.setDirOld([Comic.getOriginComicName(),Comic.getOriginChapterName()],suffix="CBZ")
@classmethod
def getPathOldCBZComicChapter(cls): return cls.setDirOld([Comic.getComicName(),Comic.getChapterName()],suffix="CBZ")
@classmethod
def getPathCBZComicChapter(cls): return cls.setDirCBZ([Comic.getComicName(),Comic.getChapterName()],suffix="CBZ")
#排序
@classmethod
def getSortDirCBZComicChapter(cls): return cls.setDirCBZ([Comic.getComicName()],str(Comic.getNumber())+" "+Comic.getChapterName())

View File

@ -2,6 +2,7 @@ import os,skip
from common.Constant import pathStr
from domain.BaoZi import comicEntity as baoziEntity
from domain.RouMan import comicEntity as roumanEntity
from utils.FileUtils import fileUtils
def rouman():
pathStr.setComicMainAndPath(pathStr.comic_rm)
@ -18,5 +19,7 @@ def proxy():
os.environ["https_proxy"] = "http://127.0.0.1:7890"
if __name__ == '__main__':
rouman()
# baozi()
# rouman()
# baozi()
result = fileUtils.getModificationDateYMD("D:\mnt\Comics\RM\CBZ\把妹鬼达人\第1话-色鬼授予的爱爱超能力.CBZ")
print(result)

View File

@ -1,5 +1,5 @@
import base64,hashlib,os,shutil
import math,time,json
import math,time,json,datetime
from PIL import Image
from tinydb import TinyDB, Query
from common.Constant import ComicPath
@ -155,7 +155,7 @@ class imageUtils:
#10_29.jpg
base_fn = file_str[-1].split("_")
blocks = int(base_fn[0])
save_path = ComicPath.getFileScrambleImageSave(imgpath)
save_path = os.path.join(ComicPath.getDirComicChapter(),ComicPath.getFileScrambleImageSave(imgpath))
# print(type(aid),type(img_name))
if blocks:
s = blocks # 随机值
@ -195,6 +195,19 @@ class imageUtils:
print("remove=",imgpath)
class fileUtils:
@classmethod
def getModificationDate(cls,file_path):
return os.path.getmtime(file_path)
@classmethod
def getModificationDateYMD(cls,file_path,not_exists="9999"):
if cls.notExists(file_path): return not_exists
file_date = cls.getModificationDate(file_path)
s = time.localtime(file_date)
ymd = time.strftime("%Y%m%d",s)
print(f"file={file_path} {ymd}")
return int(ymd)
@classmethod
def exists(cls,path):
return os.path.exists(path)