MCPcopy
hub / github.com/tonquer/JMComic-qt / __init__

Method __init__

src/view/nas/nas_db.py:14–62  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

12
13class NasDb(object):
14 def __init__(self):
15 self.db = QSqlDatabase.addDatabase("QSQLITE", "nas")
16 path = os.path.join(Setting.GetConfigPath(), "nas.db")
17 self.db.setDatabaseName(path)
18 if not self.db.open():
19 Log.Warn(self.db.lastError().text())
20
21 query = QSqlQuery(self.db)
22 sql = """\
23 create table if not exists nas_info(\
24 nas_id int primary key,\
25 title varchar ,\
26 address varchar,\
27 port int, \
28 type int ,\
29 user varchar ,\
30 passwd varchar ,\
31 compress_index int,\
32 save_index int,\
33 dir_index int,\
34 is_waifu2x int,\
35 path varchar ,\
36 tick int \
37 )\
38 """
39 suc = query.exec_(sql)
40 if not suc:
41 a = query.lastError().text()
42 Log.Warn(a)
43
44 query = QSqlQuery(self.db)
45 sql = """\
46 create table if not exists nas_upload(\
47 book_id varchar ,\
48 title varchar,\
49 nas_id int,\
50 eps_ids varchar, \
51 curPreUpIndex int,\
52 tick int, \
53 status int ,\
54 status_msg int ,\
55 primary key (book_id,nas_id)\
56 )\
57 """
58 suc = query.exec_(sql)
59 if not suc:
60 a = query.lastError().text()
61 Log.Warn(a)
62 # self.LoadDownload()
63
64 def DelUploadDB(self, nas_id, book_id):
65 query = QSqlQuery(self.db)

Callers

nothing calls this directly

Calls 3

GetConfigPathMethod · 0.80
WarnMethod · 0.80
textMethod · 0.80

Tested by

no test coverage detected