Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions plugins/stashdb-performer-gallery/stashdb-performer-gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,37 @@ def relink_images(performer_id=None):
# else:
# query["file_count"] = {"modifier": "NOT_EQUALS", "value": 1}

total = stash.find_images(f=query, get_count=True)[0]
i = 0
# Collect the images up front. processImages() attaches galleries, which
# drops images out of the "is_missing: galleries" result set and would
# shift later pages back onto offsets we have already read past.
images = []
while i < total:
images = stash.find_images(f=query, filter={"page": i, "per_page": per_page})
for img in images:
log.debug("image: %s" % (img,))
processImages(img)
i = i + 1
log.progress((i / total))
page = 1
while True:
batch = stash.find_images(
f=query,
filter={
"page": page,
"per_page": per_page,
"sort": "created_at",
"direction": "ASC",
},
fragment=FRAGMENT_IMAGE,
)
if not batch:
break
images.extend(batch)
page = page + 1

total = len(images)
if total == 0:
log.info("no images found to relink")
return

log.info("relinking %s images" % (total,))
for i, img in enumerate(images, start=1):
log.debug("image: %s" % (img,))
processImages(img)
log.progress(i / total)


json_input = json.loads(sys.stdin.read())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: stashdb performer gallery
description: Automatically download performer images from stashdb or other stash-boxes. Add the [Stashbox Performer Gallery] tag to a performer and it will create a gallery of images from that stash-box database. Apply the tag [Set Profile Image] to an image to set it as the profile image of that performer. Note you will need to configure the download path and add this as a path under settings > library
version: 0.3
version: 0.4
url: https://discourse.stashapp.cc/t/stashdb-performer-gallery/1411
exec:
- python
Expand Down
Loading