Skip to content

Commit

Permalink
Add option to filter by collection
Browse files Browse the repository at this point in the history
  • Loading branch information
laurejt committed Nov 15, 2024
1 parent 3671540 commit 96b56bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ppa/archive/management/commands/hathi_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,18 @@ def handle(self, *args, **kwargs):
raise CommandError("Thumbnail width cannot be more than 250 pixels")

# use ids specified via command line when present
htids = kwargs.get("htids", [])
htids = kwargs["htids"]

# by default, download images for all non-suppressed hathi source ids
digworks = DigitizedWork.objects.filter(
status=DigitizedWork.PUBLIC, source=DigitizedWork.HATHI
)

# if collection is specified via parameter, use it to filter the querset
collection = kwargs.get("collection")
if collection:
digworks = digworks.filter(collections__name=collection)

# if htids are specified via parameter, use them to filter
# the queryset, to ensure we only sync records that are
# in the database and not suppressed
Expand Down

0 comments on commit 96b56bb

Please sign in to comment.