fix wgcompany

This commit is contained in:
Aron Petau 2026-01-02 23:29:17 +01:00
parent 29a3f629e2
commit bc0c369a92
3 changed files with 33 additions and 3 deletions

View file

@ -132,8 +132,8 @@ class WGCompanyNotifier:
return []
def load_previous_listings(self):
if self.listings_file.exists():
with open(self.listings_file, 'r') as f:
if WGCOMPANY_LISTINGS_FILE.exists():
with open(WGCOMPANY_LISTINGS_FILE, 'r') as f:
data = json.load(f)
logger.debug(f"[WG] Loaded {len(data)} previous listings")
return data
@ -142,7 +142,7 @@ class WGCompanyNotifier:
def save_listings(self, listings: list[dict]) -> None:
listings_dict = {l['id']: l for l in listings}
logger.debug(f"[WG] Saving {len(listings_dict)} listings")
with open(self.listings_file, 'w') as f:
with open(WGCOMPANY_LISTINGS_FILE, 'w') as f:
json.dump(listings_dict, f, indent=2, ensure_ascii=False)
def find_new_listings(self, current: list[dict], previous: dict) -> list[dict]: