update 20230806

This commit is contained in:
cwx committed 2023-08-06 19:39:23 +08:00
1 parent 40d484ee4c
commit aeff24daa4
7 files changed
+81 -38

No files matched your search

+29 -1
View File
@@ -1,5 +1,6 @@
import os.path
import re
from Comics import settings
from opencc import OpenCC
class ComicPath:
PREFIX_SCRAMBLE = "scramble="
@@ -45,4 +46,31 @@ class ComicPath:
else:
filename = filename[0:len(filename)+1-count]
break
return filename
return filename
@classmethod
def get_file_path(cls, item, result_type="image", file=None, convert=False):
PROJECT = item[settings.PROJECT_KEY][0]
if not convert:
name = item['name']
chapter = item['chapter']
else:
name = cls.fix_file_name(cls.chinese_convert(item['name']))
chapter = cls.fix_file_name(cls.chinese_convert(item['chapter']))
if result_type == "image":
if os.path.sep not in file:
file = os.path.join(PROJECT, "images", name, chapter, file)
elif result_type == "comic_info":
file = os.path.join(PROJECT, "images", name, chapter)
elif result_type == "cbz_icon":
file = os.path.join(settings.CBZ_EXPORT_PATH, PROJECT, name, chapter+".jpg")
elif result_type == "down_icon":
file = os.path.join(settings.IMAGES_STORE, cls.get_file_path(item=item, result_type="icon"))
elif result_type == "icon":
file = os.path.join(PROJECT, "icons", name+".jpg")
elif result_type == "cbz":
file = os.path.join(settings.CBZ_EXPORT_PATH, PROJECT, name, chapter+".CBZ")
elif result_type == "images_dir":
file = os.path.join(settings.IMAGES_STORE, PROJECT, "images", name, chapter)
return file