(self)
| 12 | |
| 13 | class 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) |
nothing calls this directly
no test coverage detected