You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
self.db_title= {blur_title(row[0]): row[1] forrowinself.con.execute("SELECT title, gid FROM gallery") ifnotrow[0] isNone}
48
-
self.db_title_jpn= {blur_title(row[0]): row[1] forrowinself.con.execute("SELECT title_jpn, gid FROM gallery") ifnotrow[0] isNone}
49
-
ifsettings.importEHdb_matchtorrent:
50
-
self.db_title_torrent= {}
56
+
req_title2gid_index=self.con.execute(f"SELECT name FROM sqlite_master WHERE type='index' AND name=?", (title2gid_index,)).fetchone() isNone
57
+
req_titlejpn2gid_index=self.con.execute(f"SELECT name FROM sqlite_master WHERE type='index' AND name=?", (titlejpn2gid_index,)).fetchone() isNone
58
+
ifreq_title2gid_indexorreq_titlejpn2gid_index:
59
+
logger.info('Building ehentai database title cache, please wait...')
60
+
ifreq_title2gid_index:
61
+
ifsettings.importEHdb_matchtitle!='exact':
62
+
self.con.execute(f"CREATE TABLE {title2gid_table} (title TEXT NOT NULL, gid INTEGER NOT NULL, FOREIGN KEY (gid) REFERENCES gallery (gid))")
63
+
self.con.executemany(f"INSERT INTO {title2gid_table} VALUES(?, ?)", ((blur_title(row[0]), row[1]) forrowinself.con.execute("SELECT title, gid FROM gallery") ifrow[0] isnotNone))
64
+
self.con.execute(f"CREATE INDEX {title2gid_index} ON {title2gid_table} (title)")
65
+
ifreq_titlejpn2gid_index:
66
+
self.con.execute(f"CREATE TABLE {titlejpn2gid_table} (title_jpn TEXT NOT NULL, gid INTEGER NOT NULL, FOREIGN KEY (gid) REFERENCES gallery (gid))")
67
+
self.con.executemany(f"INSERT INTO {titlejpn2gid_table} VALUES(?, ?)", ((blur_title(row[0]), row[1]) forrowinself.con.execute("SELECT title_jpn, gid FROM gallery") ifrow[0] isnotNone))
68
+
self.con.execute(f"CREATE INDEX {titlejpn2gid_index} ON {titlejpn2gid_table} (title_jpn)")
69
+
self.con.commit()
70
+
ifsettings.importEHdb_matchtorrentandself.con.execute(f"SELECT name FROM sqlite_master WHERE type='index' AND name='torrent_index_v{blur_title_version}'").fetchone() isNone:
if(row:=self.con.execute(f"SELECT gid FROM {title2gid_table} INDEXED BY {title2gid_index} WHERE title == ?", (blur_title(metadata["title"]),)).fetchone())isnotNone:
90
+
returnrow['gid']
91
+
elif(row:=self.con.execute(f"SELECT gid FROM {titlejpn2gid_table} INDEXED BY {titlejpn2gid_index} WHERE title_jpn == ?", (blur_title(metadata["title"]),)).fetchone())isnotNone:
92
+
returnrow['gid']
93
+
elif(row:=self.con.execute(f"SELECT gid FROM {titlejpn2gid_table} INDEXED BY {titlejpn2gid_index} WHERE title_jpn == ?", (blur_title(metadata["subtitle"]),)).fetchone())isnotNone:
if(row:=self.con.execute(f"SELECT gid FROM comiclib_torrent2gid_v{blur_title_version} INDEXED BY torrent_index_v{blur_title_version} WHERE title == ?", (blur_title(metadata["title"]),)).fetchone())isnotNone:
97
+
returnrow['gid']
98
+
elif(row:=self.con.execute(f"SELECT gid FROM comiclib_torrent2gid_v{blur_title_version} INDEXED BY torrent_index_v{blur_title_version} WHERE title == ?", (blur_title(metadata["subtitle"]),)).fetchone())isnotNone:
0 commit comments