Update DataClass.py, GetArc_Ehentai.py, and 7 more files...
데이터 클래스 정의, 퍼필 다운로더 json 파서...
This commit is contained in:
233
StoreXLS.py
233
StoreXLS.py
@@ -5,159 +5,112 @@ from openpyxl.utils import xlsUtils
|
||||
import DataClass as stManga
|
||||
import UtilPack as util
|
||||
|
||||
|
||||
xls_name = "mangaDB.xlsx"
|
||||
m_wb = None
|
||||
|
||||
sheetName_Mangainfo = "MangaInfo"
|
||||
sheetName_Artists = "Artists"
|
||||
sheetName_Tags = "Tags"
|
||||
|
||||
strMngSht = "MngInfo"
|
||||
strArtSht = "ArtInfo"
|
||||
strTagSht = "TagInfo"
|
||||
|
||||
#
|
||||
def DBXLSOpen(path):
|
||||
xls_path = GetXLSPath(path)
|
||||
util.DbgOut(xls_path)
|
||||
|
||||
try:
|
||||
wb = opyxl(xls_path)
|
||||
util.DbgOut("xls Open Successed")
|
||||
except FileNotFoundError:
|
||||
wb = opyxl()
|
||||
util.DbgOut("xls Created")
|
||||
|
||||
if wb is None:
|
||||
util.DbgOut("XLS Open Something Wrong...")
|
||||
return
|
||||
|
||||
m_wb = wb
|
||||
|
||||
ws = wb.active
|
||||
# time, title, url, tags (comma)
|
||||
ws['A1'] = "Modified Time"
|
||||
ws['B1'] = int(time.time())
|
||||
|
||||
|
||||
if 'list' not in wb.sheetnames:
|
||||
ws1 = wb.create_sheet(title='list')
|
||||
print('list sheet created')
|
||||
|
||||
wb.save(xls_path)
|
||||
|
||||
ws2 = wb['list']
|
||||
print(str(index) + " searched")
|
||||
|
||||
|
||||
def DBXLSClose():
|
||||
if m_wb is None:
|
||||
return
|
||||
|
||||
m_wb.save(xls_path)
|
||||
m_wb.close()
|
||||
|
||||
class DBXLStorage:
|
||||
xls_name = "mangaDB.xlsx"
|
||||
xls_path = ""
|
||||
m_wb = None
|
||||
|
||||
sheetName_Mangainfo = "MangaInfo"
|
||||
sheetName_Artists = "Artists"
|
||||
sheetName_Tags = "Tags"
|
||||
|
||||
#
|
||||
def WriteMangaInfos(*listInfos):
|
||||
if False == isinstance(listInfos, list):
|
||||
return
|
||||
strMngSht = "MngInfo"
|
||||
strArtSht = "ArtInfo"
|
||||
strTagSht = "TagInfo"
|
||||
|
||||
ws_mng = getSheet(strMngSht)
|
||||
if None == ws_mng:
|
||||
return
|
||||
m_openedXLS = ""
|
||||
|
||||
#for item in listInfos:
|
||||
# 클래스 타잎을 확인해야 하지만만.. 생략.
|
||||
# title, url, artist, group, series(parady), type, tags, hitomi ID, hitomi file, eh ID, eh tor
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
|
||||
def AddTagInfo(tagInfo):
|
||||
pass
|
||||
|
||||
def AddTagInfo(strTag, strUrl):
|
||||
pass
|
||||
|
||||
def AddArtistInfo(artistInfo):
|
||||
pass
|
||||
|
||||
def AddArAddArtistInfo(strArtist, strUrl):
|
||||
pass
|
||||
|
||||
def AddSeriesInfo(SeriesInfo):
|
||||
pass
|
||||
|
||||
def AddSeriesInfo(strSerires, strUrl):
|
||||
pass
|
||||
|
||||
def AddTypeInfo(typeInfo):
|
||||
pass
|
||||
|
||||
def AddTypeInfo(strType, strUrl):
|
||||
pass
|
||||
|
||||
def __enter__(self):
|
||||
self.DBXLSOpen(self.path)
|
||||
|
||||
def getSheet(sheetName):
|
||||
if None == m_wb:
|
||||
return
|
||||
def __exit__(self, ex_type, ex_value, traceback):
|
||||
self.DBXLSClose()
|
||||
|
||||
def DBXLSOpen(self, path):
|
||||
xls_path = self.GetXLSPath(path)
|
||||
util.DbgOut(xls_path)
|
||||
|
||||
try:
|
||||
m_wb = opyxl(xls_path)
|
||||
util.DbgOut("xls Open Successed")
|
||||
except FileNotFoundError:
|
||||
m_wb = opyxl()
|
||||
util.DbgOut("xls Created")
|
||||
|
||||
if m_wb is None:
|
||||
util.DbgOut("XLS Open Something Wrong...")
|
||||
m_openedXLS = ""
|
||||
m_wb = None
|
||||
return
|
||||
|
||||
def DBXLSClose(self):
|
||||
if self.m_wb is None or self.m_openedXLS is None:
|
||||
util.DbgOut("XLS Close something wrong...")
|
||||
return
|
||||
|
||||
self.m_wb.save(self.m_openedXLS)
|
||||
self.m_wb.close()
|
||||
|
||||
self.m_wb = None
|
||||
|
||||
#
|
||||
def WriteMangaInfos(self, *listInfos):
|
||||
if False == isinstance(listInfos, list):
|
||||
return
|
||||
|
||||
ws_mng = self.getSheet(self.strMngSht)
|
||||
if None == ws_mng:
|
||||
return
|
||||
|
||||
#for item in listInfos:
|
||||
# 클래스 타잎을 확인해야 하지만만.. 생략.
|
||||
# ttist, group, series(parady), type, tags, hitomi ID, hitomi file, eh ID, eh tor
|
||||
|
||||
def AddTagInfo(self, tagInfo):
|
||||
pass
|
||||
|
||||
if sheetName in m_wb.sheetnames:
|
||||
return m_wb[sheetName]
|
||||
def AddTagInfo(self, strTag, strUrl):
|
||||
pass
|
||||
|
||||
return m_wb.create_sheet(title=sheetName)
|
||||
|
||||
#
|
||||
def GetXLSPath(path):
|
||||
retPath = path
|
||||
if False == os.path.exists(path):
|
||||
retPath = os.path.abspath(__file__)
|
||||
def AddArtistInfo(self, artistInfo):
|
||||
pass
|
||||
|
||||
return retPath + xls_name
|
||||
|
||||
|
||||
# #
|
||||
# def XLSWriteMangainfo(title, url, *tags):
|
||||
# #
|
||||
# try:
|
||||
# wb = load_workbook(xls_path)
|
||||
# print("Open Successed")
|
||||
# except FileNotFoundError:
|
||||
# wb = Workbook()
|
||||
# print("xls Created")
|
||||
|
||||
# ws = wb.active
|
||||
# # time, title, url, tags (comma)
|
||||
# ws['A1'] = "Modified Time"
|
||||
# ws['B1'] = int(time.time())
|
||||
def AddArAddArtistInfo(self, strArtist, strUrl):
|
||||
pass
|
||||
|
||||
def AddSeriesInfo(self, SeriesInfo):
|
||||
pass
|
||||
|
||||
# if 'list' not in wb.sheetnames:
|
||||
# ws1 = wb.create_sheet(title='list')
|
||||
# print('list sheet created')
|
||||
def AddSeriesInfo(self, strSerires, strUrl):
|
||||
pass
|
||||
|
||||
# wb.save(xls_path)
|
||||
def AddTypeInfo(self, typeInfo):
|
||||
pass
|
||||
|
||||
# ws2 = wb['list']
|
||||
|
||||
# # 폴더 경로
|
||||
# folder_path = '/media/gerd/test/hiyobi_temp/'
|
||||
|
||||
# # 폴더 내의 파일 및 폴더 목록 가져오기
|
||||
# items = os.listdir(folder_path)
|
||||
|
||||
# index = 2
|
||||
# # 파일 및 폴더 목록 출력
|
||||
# for item in items:
|
||||
# pos = 'A' + str(index)
|
||||
# ws2[pos] = item
|
||||
# index += 1
|
||||
# #print(item)
|
||||
|
||||
# print(str(index) + " searched")
|
||||
# wb.save(xls_path)
|
||||
|
||||
# wb.close()
|
||||
def AddTypeInfo(self, strType, strUrl):
|
||||
pass
|
||||
|
||||
# 시트를 가져온다. 엑셀 파일이 안 열려 있으면 None, 있으면 반환하고, 없으면 만들어서.
|
||||
def getSheet(self, sheetName):
|
||||
retSheet = None
|
||||
|
||||
if self.m_wb:
|
||||
if sheetName in self.m_wb.sheetnames:
|
||||
retSheet = self.m_wb[sheetName]
|
||||
else:
|
||||
retSheet = self.m_wb.create_sheet(title=sheetName)
|
||||
|
||||
return retSheet
|
||||
|
||||
# 데이터베이스용 엑셀 파일의 전체 경로를 얻어온다.
|
||||
def GetXLSPath(self, path):
|
||||
retPath = path
|
||||
if False == os.path.exists(path):
|
||||
retPath = os.path.abspath(__file__)
|
||||
|
||||
return os.path.join(retPath, self.xls_name)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user