Update DataClass.py, GetArc_Hitomi.py, and 2 more files...
작업한거 일단 커밋. 딱히 기능을 추가한건 없지만, 정리는 조금 했다. 정리 더 해야 하는데, 윈도우에서 작업하려고....커밋!!
This commit is contained in:
66
UI.py
66
UI.py
@@ -4,6 +4,7 @@ import UtilPack as util
|
||||
import MgrCalibreDB as calDB
|
||||
import MgrCalibreLibs as calLib
|
||||
import pupildata as pupil
|
||||
import GetArc_Hitomi as hitomi
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
@@ -131,36 +132,48 @@ class MyApp(QMainWindow):
|
||||
|
||||
|
||||
def on_click_SrcAdd(self):
|
||||
# 폴더 선택 창을 띄움
|
||||
folder_path = QFileDialog.getExistingDirectory(self, '폴더 선택', '')
|
||||
|
||||
if None == folder_path or True == util.IsEmptyStr(folder_path):
|
||||
return
|
||||
|
||||
# 소스 폴더 목록에 추가
|
||||
self.list_SrcPath.addItem(folder_path)
|
||||
self.AddSourceFoldertoList(folder_path)
|
||||
|
||||
#캘리버 서재 폴더인가?
|
||||
|
||||
def AddSourceFoldertoList(self, folder_path):
|
||||
#캘리버 서재 DB 파일을 먼저 확인
|
||||
pathCalDB = os.path.join( folder_path, "metadata.db")
|
||||
if True == os.path.exists(pathCalDB):
|
||||
db = calDB.MgrCalibreDB(pathCalDB)
|
||||
db.init()
|
||||
listBooks = db.GetBookListforUI_ArcList()
|
||||
for book in listBooks:
|
||||
# 이름은 폴더/DB 파일이름
|
||||
FolderName = util.GetParentDirName(folder_path, 0)
|
||||
item = QListWidgetItem(f"{FolderName}/{book[0]}")
|
||||
self.AddSourceCalibreDB(pathCalDB)
|
||||
else:
|
||||
self.AddSourceFolderContents(folder_path)
|
||||
|
||||
bookpath = os.path.join(folder_path, book[1])
|
||||
listfiles = util.FindFileFromExt(bookpath, "cbz")
|
||||
if 0 < len(listfiles):
|
||||
bookpath = os.path.join(bookpath, listfiles[0])
|
||||
|
||||
def AddSourceCalibreDB(self, pathCalDB):
|
||||
db = calDB.MgrCalibreDB(pathCalDB)
|
||||
|
||||
item.setData(Qt.UserRole, bookpath)
|
||||
self.list_ArcList.addItem(item)
|
||||
|
||||
if None == db:
|
||||
return
|
||||
|
||||
db.init()
|
||||
listBooks = db.GetBookListforUI_ArcList()
|
||||
for book in listBooks:
|
||||
# 이름은 폴더/DB 파일이름
|
||||
FolderName = util.GetParentDirName(pathCalDB, 0)
|
||||
item = QListWidgetItem(f"{FolderName}/{book[0]}")
|
||||
|
||||
bookpath = os.path.join(pathCalDB, book[1])
|
||||
listfiles = util.FindFileFromExt(bookpath, "cbz")
|
||||
if 0 < len(listfiles):
|
||||
bookpath = os.path.join(bookpath, listfiles[0])
|
||||
|
||||
item.setData(Qt.UserRole, bookpath)
|
||||
self.list_ArcList.addItem(item)
|
||||
|
||||
return
|
||||
|
||||
def AddSourceFolderContents(self, folder_path):
|
||||
# 폴더 내의 자식 폴더 목록을 가져온다.
|
||||
listFolders = util.ListSubDirectories(folder_path)
|
||||
listFolders.append(folder_path)
|
||||
@@ -197,8 +210,7 @@ class MyApp(QMainWindow):
|
||||
# 폴더 경로를 따로 저장
|
||||
item.setData(Qt.UserRole, folder)
|
||||
self.list_ArcList.addItem(item)
|
||||
|
||||
return
|
||||
|
||||
|
||||
def on_click_SrcDel(self):
|
||||
items = self.list_SrcPath.selectedItems()
|
||||
@@ -214,7 +226,21 @@ class MyApp(QMainWindow):
|
||||
|
||||
|
||||
def on_click_SrcRead(self):
|
||||
pass
|
||||
list_id = []
|
||||
for idx in range(self.list_ArcList.count()):
|
||||
item = self.list_ArcList.item(idx)
|
||||
|
||||
# 일단 파일 이름에 포함된 Hitomi ID 를 추출해 낸다.
|
||||
results = util.GetTextInBrakets(item.text())
|
||||
if 0 >= len(results):
|
||||
continue
|
||||
|
||||
if False == results[0].isdigit() or 0 >= int(results[0]):
|
||||
continue
|
||||
|
||||
list_id.append(results[0])
|
||||
|
||||
hitomi.GetListSearchResult(list_id)
|
||||
|
||||
|
||||
def on_Item_SelChanged_listArc(self):
|
||||
|
||||
Reference in New Issue
Block a user