merge dump listings and dump details commands - fetch both details and listings in the same command

This commit is contained in:
Viktor Barzin 2025-06-07 12:00:23 +00:00
parent 29213f3d26
commit 842f7cefbe
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
7 changed files with 54 additions and 59 deletions

View file

@ -37,7 +37,7 @@ class Listing:
@staticmethod
def get_all_listings(
listing_paths: list[str],
listing_paths: list[pathlib.Path],
seen_in_the_last_n_days: int = 30,
) -> List["Listing"]:
identifiers = []
@ -256,8 +256,11 @@ class Listing:
@property
def detailobject(self) -> dict[str, Any]:
if self._cached is None:
with open(self.path_detail_json()) as f:
self._cached = json.load(f)
if self.path_detail_json().exists():
with open(self.path_detail_json()) as f:
self._cached = json.load(f)
else:
return {}
return self._cached # type: ignore
@property