Update MgrCalibreDB.py, MgrCalibreUI.py, and 3 more files...

python - requirements.txt added
This commit is contained in:
2025-08-03 21:03:16 +09:00
parent d5f2d82bc9
commit 2c36327ae8
5 changed files with 98 additions and 11 deletions

View File

@@ -4,9 +4,11 @@ import UtilPack as util
import MgrSQLiteDB as MyDB import MgrSQLiteDB as MyDB
class MgrCalibreDB(MyDB.MgrSQLiteDB): class MgrCalibreDB(MyDB.MgrSQLiteDB):
def init(self): def __init__(self, path: str):
print(f"{self.path} DB Calibre Init") super().__init__(path)
self.init()
def init(self):
# 데이터베이스 연결 (파일이 없으면 새로 생성됨) # 데이터베이스 연결 (파일이 없으면 새로 생성됨)
self.conn = sqlite3.connect(self.path) self.conn = sqlite3.connect(self.path)
self.conn.create_function("title_sort", 1, self._title_sort ) self.conn.create_function("title_sort", 1, self._title_sort )

View File

@@ -61,7 +61,7 @@ class MyApp(QMainWindow):
if False == os.path.exists(self.pathDB): if False == os.path.exists(self.pathDB):
os.makedirs(self.pathDB, exist_ok=True) os.makedirs(self.pathDB, exist_ok=True)
self.pathLastCalibre = settings.value('LastCalibrePath', "~/캘리버 서재", type=str) self.pathLastCalibre = settings.value('LastCalibrePath', "~/CalibreLibrary", type=str)
if False == os.path.exists(self.pathDB): if False == os.path.exists(self.pathDB):
os.makedirs(self.pathDB, exist_ok=True) os.makedirs(self.pathDB, exist_ok=True)
@@ -100,8 +100,7 @@ class MyApp(QMainWindow):
self.DBPupil = MgrPupilColDB.MgrPupilColDB(pathPupilDB) self.DBPupil = MgrPupilColDB.MgrPupilColDB(pathPupilDB)
pathCalibreDB = os.path.join(self.pathLastCalibre, self.fileNameCallibreDB) pathCalibreDB = os.path.join(self.pathLastCalibre, self.fileNameCallibreDB)
util.DbgOut(f"Loading Calibre DB from {pathCalibreDB}", True) self.LoadCalibreDB(pathCalibreDB)
self.DBCalibre = MgrCalibreDB.MgrCalibreDB(pathCalibreDB)
# #
def MakeUI_Left(self): def MakeUI_Left(self):
@@ -291,13 +290,17 @@ class MyApp(QMainWindow):
## metadata.db ## metadata.db
def LoadCalibreDB(self, path:str ) -> None: def LoadCalibreDB(self, path:str ) -> None:
pathDB = path
if True == os.path.isdir(path):
pathDB = os.path.join(path, "metadata.db") pathDB = os.path.join(path, "metadata.db")
print(f"LoadCalibreDB: {pathDB}")
if False == os.path.exists(pathDB): if False == os.path.exists(pathDB):
util.DbgOut(f"Calibre DB not found: {pathDB}", True) util.DbgOut(f"Calibre DB not found: {pathDB}", True)
return return
DB = MgrCalibreDB.MgrCalibreDB(pathDB) self.DBCalibre = MgrCalibreDB.MgrCalibreDB(pathDB)
listItems = DB.GetBookListforUI_ArcList() listItems = self.DBCalibre.GetBookListforUI_ArcList()
for item in listItems: for item in listItems:
strID = item[4] strID = item[4]
strTitle = item[0] strTitle = item[0]

View File

@@ -4,6 +4,14 @@ import UtilPack as util
import MgrSQLiteDB as MyDB import MgrSQLiteDB as MyDB
class MgrPupilColDB(MyDB.MgrSQLiteDB): class MgrPupilColDB(MyDB.MgrSQLiteDB):
def __init__(self, path: str):
super().__init__(path)
self.init()
def init(self):
# 데이터베이스 연결 (파일이 없으면 새로 생성됨)
self.conn = sqlite3.connect(f'file:{self.path}?charset=UTF-8', uri=True)
self.cursor = self.conn.cursor()
# ID -> HitomiID, ArchiveID, Title, Authors, Group, Series, Type. Language, Tags, Description, # ID -> HitomiID, ArchiveID, Title, Authors, Group, Series, Type. Language, Tags, Description,
def GetBookByID(self, nID: int) -> dict: def GetBookByID(self, nID: int) -> dict:

View File

@@ -1,3 +1,5 @@
from abc import abstractmethod
import sqlite3 import sqlite3
import UtilPack as util import UtilPack as util
@@ -12,10 +14,9 @@ class MgrSQLiteDB:
def __exit__(self, ex_type, ex_value, traceback): def __exit__(self, ex_type, ex_value, traceback):
self.conn.close() self.conn.close()
@abstractmethod
def init(self): def init(self):
# 데이터베이스 연결 (파일이 없으면 새로 생성됨) pass
self.conn = sqlite3.connect(self.path)
self.cursor = self.conn.cursor()
# 쿼리를 실행한다. Commit 여부를 선택할 수 있다. # 쿼리를 실행한다. Commit 여부를 선택할 수 있다.
def SQLExecute(self, cursor: sqlite3.Cursor, strSQL: str, bCommit: bool = True): def SQLExecute(self, cursor: sqlite3.Cursor, strSQL: str, bCommit: bool = True):

73
requirements.txt Normal file
View File

@@ -0,0 +1,73 @@
appnope==0.1.4
asgiref==3.8.1
asttokens==2.4.1
attrs==23.2.0
beautifulsoup4==4.12.3
bs4==0.0.2
certifi==2024.2.2
cloudpickle==3.0.0
comm==0.2.2
ctype==7.4.2
debugpy==1.8.1
decorator==5.1.1
Django==5.0.4
et-xmlfile==1.1.0
executing==2.0.1
h11==0.14.0
idna==3.6
image==1.5.33
ipykernel==6.29.4
ipython==8.23.0
jedi==0.19.1
jupyter_client==8.6.1
jupyter_core==5.7.2
matplotlib-inline==0.1.6
nest-asyncio==1.6.0
numpy==1.26.4
openpyxl==3.1.2
outcome==1.3.0.post0
packaging==24.0
pandas==2.2.2
parso==0.8.3
pexpect==4.9.0
pillow==10.3.0
platformdirs==4.2.0
prompt-toolkit==3.0.43
psutil==5.9.8
ptyprocess==0.7.0
pure-eval==0.2.2
Pygments==2.17.2
PyQt5==5.15.11
PyQt5-Qt5==5.15.14
PyQt5_sip==12.15.0
PyQt6==6.7.0
PyQt6-Qt6==6.7.0
PyQt6-sip==13.6.0
PySide6==6.6.3.1
PySide6_Addons==6.6.3.1
PySide6_Essentials==6.6.3.1
PySocks==1.7.1
python-dateutil==2.9.0.post0
pytz==2024.1
pyzmq==25.1.2
rarfile==4.2
selenium==4.19.0
shiboken6==6.6.3.1
six==1.16.0
sniffio==1.3.1
sortedcontainers==2.4.0
soupsieve==2.5
spyder-kernels==2.5.1
sqlparse==0.5.0
stack-data==0.6.3
tk==0.1.0
tornado==6.4
traitlets==5.14.2
trio==0.25.0
trio-websocket==0.11.1
typing_extensions==4.10.0
tzdata==2024.1
urllib3==2.2.1
wcwidth==0.2.13
wsproto==1.2.0
wurlitzer==3.0.3