Compare commits

...

2 commits

4 changed files with 13 additions and 6 deletions

View file

@ -1 +1 @@
3.12.2
system@3.13.1

View file

@ -6,6 +6,5 @@
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
-e file:.

View file

@ -6,6 +6,5 @@
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
-e file:.

View file

@ -188,7 +188,7 @@ def get_db_type(cur: sqlite3.Cursor) -> Literal["firefox", "chromium"]:
return db_type
def get_browser_info(root_cur: sqlite3.Cursor, name: str) -> tuple[int, int, str]:
def get_browser_info(root_cur: sqlite3.Cursor, name: str) -> tuple[int, int, str] | None:
res = root_cur.execute(
"""
SELECT
@ -202,7 +202,10 @@ def get_browser_info(root_cur: sqlite3.Cursor, name: str) -> tuple[int, int, str
""",
(name,),
)
browser_id, visits_time_max, database_path = res.fetchone()
res_one = res.fetchone()
if res_one is None:
return None
browser_id, visits_time_max, database_path = res_one
return (browser_id, visits_time_max, database_path)
@ -250,7 +253,13 @@ def add_db(
root_con: sqlite3.Connection, root_cur: sqlite3.Cursor, args: argparse.Namespace
):
print("Add history to root db")
browser_id, visits_time_max, database_path = get_browser_info(root_cur, args.name)
browser_info = get_browser_info(root_cur, args.name)
if browser_info is None:
print(f"browser {args.name} is not registered to the database")
logging.debug("Cleaning up (closing db connection)")
root_con.close()
exit(1)
browser_id, visits_time_max, database_path = browser_info
logging.info(f"{browser_id=}, {visits_time_max=}")
logging.info(f"Source: {database_path}")