diff --git a/client.py b/client.py index 8af2338..20be0cc 100644 --- a/client.py +++ b/client.py @@ -99,6 +99,7 @@ class DramaClient: return [] db["last_processed_id"] = max(c["id"] for c in comments) + db.commit() # New comments may have pushed others to page n+1 while fetching. deduped_comments = {c["id"]: c for c in comments}.values() diff --git a/data.py b/data.py index 614d993..3cefd87 100644 --- a/data.py +++ b/data.py @@ -12,9 +12,5 @@ def load_config(): return yaml.safe_load(f) -def open_database(): - return SqliteDict("db.sqlite", autocommit=True) - - config = load_config() -db = open_database() +db = SqliteDict(f"{config['data_dir']}/db.sqlite", autocommit=True)