add vercomicinfo.xml
This commit is contained in:
1 parent
760203c182
commit
43a0566b71
1 file changed
+20
-4
@@ -271,13 +271,26 @@ class comicInfo:
|
|||||||
# print("CBZ 文件更新成功")
|
# print("CBZ 文件更新成功")
|
||||||
os.remove(xml_file)
|
os.remove(xml_file)
|
||||||
|
|
||||||
|
def ver_comicinfo_xml(self, cbz_path):
|
||||||
|
try:
|
||||||
|
with ZipFile(cbz_path, 'r') as cbz:
|
||||||
|
# ============================================
|
||||||
|
# 第一部分:读取 ComicInfo.xml 的元数据字段
|
||||||
|
# ============================================
|
||||||
|
xml_files = [f for f in cbz.namelist() if f.lower() == 'comicinfo.xml']
|
||||||
|
if not xml_files:
|
||||||
|
print(f" {cbz_path} 未找到 ComicInfo.xml")
|
||||||
|
#os.remove(cbz_path)
|
||||||
|
except:
|
||||||
|
raise exit(f"ver_comicinfo_xml 错误")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# 清除3KB以下CBZ文件
|
# 清除3KB以下CBZ文件
|
||||||
# comicInfo().update_comicinfo_cbz("")
|
# comicInfo().update_comicinfo_cbz("")
|
||||||
#cbz_path = "/Users/cc/Documents/Dev/WorkSpace/VSCodeProjects/NewComicDownloader/CBZ/rm_comic/福利女姊姊/第1话 福利女姊姊.CBZ"
|
#cbz_path = "/Users/cc/Documents/Dev/WorkSpace/VSCodeProjects/NewComicDownloader/CBZ/rm_comic/福利女姊姊/第1话 福利女姊姊.CBZ"
|
||||||
|
|
||||||
#dir_path = "CBZ/rm_comic"
|
dir_path = "CBZ/rm_comic"
|
||||||
dir_path = "/mnt/Comics/CBZ/rm_comic"
|
#dir_path = "/mnt/Comics/CBZ/rm_comic"
|
||||||
for dir in os.listdir(dir_path):
|
for dir in os.listdir(dir_path):
|
||||||
c_dir = os.path.join(dir_path, dir)
|
c_dir = os.path.join(dir_path, dir)
|
||||||
if os.path.isdir(c_dir):
|
if os.path.isdir(c_dir):
|
||||||
@@ -288,9 +301,12 @@ if __name__ == "__main__":
|
|||||||
create_time = time.localtime(os.utime(file)) # 注意:st_birthtime 在Linux/MacOS中可用,但不是所有系统都支持
|
create_time = time.localtime(os.utime(file)) # 注意:st_birthtime 在Linux/MacOS中可用,但不是所有系统都支持
|
||||||
# 格式化时间
|
# 格式化时间
|
||||||
formatted_time = time.strftime('%Y%m%d%H', create_time)
|
formatted_time = time.strftime('%Y%m%d%H', create_time)
|
||||||
if int(formatted_time) < 2025020401:
|
if int(formatted_time) > 2025020401:
|
||||||
print(f"{file} 文件创建时间:", formatted_time)
|
print(f"{file} 文件创建时间:", formatted_time)
|
||||||
comicInfo().update_comicinfo_cbz(file)
|
# 更新ComicInfoxml
|
||||||
|
# comicInfo().update_comicinfo_cbz(file)
|
||||||
|
# 检查CBZ是否存在ComicInfo.xml
|
||||||
|
comicInfo().ver_comicinfo_xml(file)
|
||||||
#if size < 3000:
|
#if size < 3000:
|
||||||
# os.remove(file)
|
# os.remove(file)
|
||||||
# print(f"已删除{file}")
|
# print(f"已删除{file}")
|
||||||
Reference in new issue
Block a user