parameterize dump_detail to use a custom data dir and also move data dir param as part of the click context

This commit is contained in:
Viktor Barzin 2025-05-14 20:32:37 +00:00
parent 48d379567b
commit e424361ed9
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
3 changed files with 32 additions and 21 deletions

View file

@ -1,13 +1,14 @@
import json
import pathlib
from rec.query import detail_query
from tqdm import tqdm
from data_access import Listing
def dump_detail():
def dump_detail(listing_paths: list[str]):
incremental = True
listings = Listing.get_all_listings()
listings = Listing.get_all_listings(listing_paths)
filtered_listings = []
for listing in listings:
# We introduced last_seen later, so not all entries have it.
@ -32,7 +33,8 @@ def dump_detail():
def main():
dump_detail()
listing_paths = sorted(list(pathlib.Path("data/rs").glob("*/listing.json")))
dump_detail(listing_paths)
if __name__ == "__main__":