Update MgrCalibreDB.py and UI.py
This commit is contained in:
@@ -49,6 +49,21 @@ class MgrCalibreDB:
|
||||
|
||||
return listRet
|
||||
|
||||
def GetBookListforUI_ArcList(self):
|
||||
if None == self.cursor:
|
||||
return None
|
||||
|
||||
try:
|
||||
strSQL = f"Select title, path from books;"
|
||||
self.cursor.execute(strSQL)
|
||||
listRet = self.cursor.fetchall()
|
||||
except sqlite3.Error as e:
|
||||
listRet = []
|
||||
print(f"SQLite Erro occurred: {e}")
|
||||
|
||||
return listRet
|
||||
|
||||
|
||||
def UpdateTableValue(self,Table, nID, ColName, Value):
|
||||
if None == self.cursor:
|
||||
return
|
||||
@@ -71,29 +86,29 @@ class MgrCalibreDB:
|
||||
strSQL = f"SELECT MAX(id) FROM \'{strTableName}\';"
|
||||
self.cursor.execute(strSQL)
|
||||
nMaxID = self.cursor.fetchone()[0]
|
||||
nMaxID += 1.
|
||||
nMaxID += 1
|
||||
|
||||
strAuthorSort = strAuthor.replace(" ", ",")
|
||||
strSQL = f"INSERT OR IGNORE INTO \'{strTableName}\' VALUES ({nMaxID}, \'{strAuthor}\',\'{strAuthorSort}\', \'\');"
|
||||
self.cursor.execute(strSQL)
|
||||
self.conn.commit()
|
||||
|
||||
def InsertTag(self, tag):
|
||||
if None == self.cursor:
|
||||
return
|
||||
|
||||
if True == util.IsEmptyStr(tag):
|
||||
return
|
||||
def InsertTag(self, tag):
|
||||
if None == self.cursor:
|
||||
return
|
||||
|
||||
if True == util.IsEmptyStr(tag):
|
||||
return
|
||||
|
||||
strTableName = "tags"
|
||||
strSQL = f"SELECT MAX(id) FROM \'{strTableName}\';"
|
||||
self.cursor.execute(strSQL)
|
||||
nMaxID = self.cursor.fetchone()[0]
|
||||
nMaxID += 1.
|
||||
strTableName = "tags"
|
||||
strSQL = f"SELECT MAX(id) FROM \'{strTableName}\';"
|
||||
self.cursor.execute(strSQL)
|
||||
nMaxID = self.cursor.fetchone()[0]
|
||||
nMaxID += 1.
|
||||
|
||||
strSQL = f"INSERT OR IGNORE INTO \'{strTableName}\' VALUES ({nMaxID}, \'{strAuthor}\', \'\');"
|
||||
self.cursor.execute(strSQL)
|
||||
self.conn.commit()
|
||||
strSQL = f"INSERT OR IGNORE INTO \'{strTableName}\' VALUES ({nMaxID}, \'{strAuthor}\', \'\');"
|
||||
self.cursor.execute(strSQL)
|
||||
self.conn.commit()
|
||||
|
||||
def main():
|
||||
db = MgrCalibreDB("/Users/minarinari/캘리버 서재/metadata.db")
|
||||
|
||||
Reference in New Issue
Block a user