archive work

This commit is contained in:
gauthiier
2019-12-31 17:53:47 +01:00
parent 8a92b3b1be
commit 7892f1fa64
4 changed files with 33 additions and 21 deletions
+13 -2
View File
@@ -133,8 +133,7 @@ class Archive:
logging.info(" - done.")
def insert_db(self, config=None):
def insert_db(self, config=None, file=None):
if self.db_con is None:
if config is not None:
@@ -143,12 +142,24 @@ class Archive:
if self.db_con is None:
return
tag = file
if file is not None:
tag = file.replace("_", " ")
try:
cursor = self.db_con.cursor()
progress = terminal.progress.ProgressBar(self.archive_name, len(self.data), fmt=terminal.progress.ProgressBar.FULL)
for t in self.data:
# print(tag)
print(t['name'])
if file is not None and t['name'] != tag:
continue
logging.info("inserting " + t['name'])
n_inserted = self.recursive_insert_db(cursor, t["threads"])
logging.info(" - " + str(n_inserted))