Update .gitignore, DataClass.py, and 19 more files...
오랜만에 서버 정리하고 커밋. 파일 위치를 정리했다. 캘리버 DB 를 열고 정보를 열람. Pupil 을 통해 다운받은 정보를 관리하기 위해 새로운 클래스 추가
This commit is contained in:
164
DataClass.py
164
DataClass.py
@@ -1,81 +1,8 @@
|
||||
class CBZInfo:
|
||||
def __init__(self, title, url):
|
||||
self.title = title
|
||||
self.url = url
|
||||
self.series = ""
|
||||
self.type = ""
|
||||
self.filename = ""
|
||||
self.torrent = ""
|
||||
self.language = ""
|
||||
self.gallery_id = 0
|
||||
# 중복을 허용하지 않는 집합으로 초기화
|
||||
self.related_galID = set()
|
||||
self.artists = set()
|
||||
self.tags = set()
|
||||
|
||||
def __str__(self):
|
||||
strArtists = ", ".join(self.artists)
|
||||
strTags = ", ".join(self.tags)
|
||||
|
||||
return f"ID : {self.gallery_id} - {self.title} by {strArtists} - #{strTags}"
|
||||
|
||||
def SaveToText(self):
|
||||
retText = "\{"
|
||||
retText += f"Title : {self.title}\r\n"
|
||||
retText += f"URL : {self.url}\r\n"
|
||||
retText += f"Series : {self.series}\r\n"
|
||||
retText += f"Type : {self.type}\r\n"
|
||||
retText += f"Filename : {self.filename}\r\n"
|
||||
retText += f"Torrent : {self.torrent}\r\n"
|
||||
retText += f"Language : {self.language}\r\n"
|
||||
retText += f"Gallery ID : {self.gallery_id}\r\n"
|
||||
retText += self.SaveToTextArtists() + f"\r\n"
|
||||
retText += self.SavetToTextRelatedGalleryID() + f"\r\n"
|
||||
retText += self.SavetToTextTags() + f"\r\n"
|
||||
retText += "\}"
|
||||
|
||||
def SaveToTextTagList(self, listTags):
|
||||
RetText = "\{"
|
||||
for tag in listTags:
|
||||
RetText += (f"\"{tag.name}\" ")
|
||||
|
||||
RetText += "\}"
|
||||
|
||||
return RetText
|
||||
|
||||
def SaveToTextArtists(self):
|
||||
retText = f"Artists : "
|
||||
retText += self.SaveToTextTagList(self.artists)
|
||||
|
||||
return retText
|
||||
|
||||
def SavetToTextRelatedGalleryID(self):
|
||||
retText = f"Gallery_ID : "
|
||||
retText += self.SaveToTextTagList(self.related_galID)
|
||||
|
||||
return retText
|
||||
|
||||
def SavetToTextTags(self):
|
||||
retText = f"Tags : "
|
||||
retText += self.SaveToTextTagList(self.tags)
|
||||
|
||||
return retText
|
||||
|
||||
def AddTag(self, name):
|
||||
self.tags.add(name)
|
||||
|
||||
def RmvTag(self, name):
|
||||
self.tags.discard(name)
|
||||
|
||||
def AddArtist(self, name):
|
||||
self.artists.add(name)
|
||||
|
||||
def RmvArtist(self, name):
|
||||
self.artists.discard(name)
|
||||
|
||||
from typing import Set
|
||||
import UtilPack as util
|
||||
|
||||
class TagInfo:
|
||||
def __init__(self, name, url):
|
||||
def __init__(self, name: str, url: str):
|
||||
self.name = name
|
||||
self.url = url
|
||||
|
||||
@@ -84,11 +11,92 @@ class TagInfo:
|
||||
|
||||
|
||||
class ImageFileInfo:
|
||||
def __init__(self, name, height, width, hashValue, bWebp):
|
||||
self.name = name
|
||||
def __init__(self, path: str, height: int, width: int, hashValue: str, bWebp: bool):
|
||||
self.path = path
|
||||
self.height = height
|
||||
self.width = width
|
||||
self.hashValue = hashValue
|
||||
self.bWebp = bWebp
|
||||
|
||||
def CehckHash(self) -> bool:
|
||||
return util.VerifyIsValidFile(self.path, self.hashValue)
|
||||
|
||||
|
||||
class CBZInfo:
|
||||
def __init__(self, title: str, url: str):
|
||||
self.title = title
|
||||
self.url = url
|
||||
self.series = ""
|
||||
self.type = ""
|
||||
self.Arcfilename = ""
|
||||
self.torrent = ""
|
||||
self.language = ""
|
||||
self.gallery_id = 0
|
||||
# 중복을 허용하지 않는 집합으로 초기화
|
||||
self.related_galID = set[str]()
|
||||
self.artists = set[str]()
|
||||
self.tags = set[str]()
|
||||
self.files = list[ImageFileInfo]()
|
||||
|
||||
def __str__(self):
|
||||
strArtists = ", ".join(self.artists)
|
||||
strTags = ", ".join(self.tags)
|
||||
|
||||
return f"ID : {self.gallery_id} - {self.title} by {strArtists} - #{strTags}"
|
||||
|
||||
def SaveToText(self):
|
||||
retText = "{"
|
||||
retText += f"Title : {self.title}\r\n"
|
||||
retText += f"URL : {self.url}\r\n"
|
||||
retText += f"Series : {self.series}\r\n"
|
||||
retText += f"Type : {self.type}\r\n"
|
||||
retText += f"Filename : {self.Arcfilename}\r\n"
|
||||
retText += f"Torrent : {self.torrent}\r\n"
|
||||
retText += f"Language : {self.language}\r\n"
|
||||
retText += f"Gallery ID : {self.gallery_id}\r\n"
|
||||
retText += self.ArtistsSaveToText() + f"\r\n"
|
||||
retText += self.RelatedGalleryIDsSaveToText() + f"\r\n"
|
||||
retText += self.TagsSaveToText() + f"\r\n"
|
||||
retText += "}"
|
||||
|
||||
def TagListSaveToText(self, setTags: Set[str])-> str:
|
||||
RetText = "{"
|
||||
for tag in setTags:
|
||||
RetText += (f"\"{tag}\" ")
|
||||
|
||||
RetText += "}"
|
||||
|
||||
return RetText
|
||||
|
||||
def ArtistsSaveToText(self)-> str:
|
||||
retText = f"Artists : "
|
||||
retText += self.TagListSaveToText(self.artists)
|
||||
|
||||
return retText
|
||||
|
||||
def RelatedGalleryIDsSaveToText(self)-> str:
|
||||
retText = f"Gallery_ID : "
|
||||
retText += self.TagListSaveToText(self.related_galID)
|
||||
|
||||
return retText
|
||||
|
||||
def TagsSaveToText(self)-> str:
|
||||
retText = f"Tags : "
|
||||
retText += self.TagListSaveToText(self.tags)
|
||||
|
||||
return retText
|
||||
|
||||
def AddTag(self, strTag: str):
|
||||
self.tags.add(strTag)
|
||||
|
||||
def RmvTag(self, strTag: str):
|
||||
self.tags.discard(strTag)
|
||||
|
||||
def AddArtist(self, strName: str):
|
||||
self.artists.add(strName)
|
||||
|
||||
def RmvArtist(self, strName: str):
|
||||
self.artists.discard(strName)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user