From e0991c92fb65a5407e1030f6e9c91b6fb83bf259 Mon Sep 17 00:00:00 2001 From: adtdev20 Date: Wed, 9 Sep 2026 17:44:30 -0700 Subject: [PATCH 1/2] Fixed relink images process hanging for > 100 images --- .../stashdb-performer-gallery.py | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/plugins/stashdb-performer-gallery/stashdb-performer-gallery.py b/plugins/stashdb-performer-gallery/stashdb-performer-gallery.py index e103786e..21d770b7 100644 --- a/plugins/stashdb-performer-gallery/stashdb-performer-gallery.py +++ b/plugins/stashdb-performer-gallery/stashdb-performer-gallery.py @@ -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()) From 4d54962b75def2d724e2fe4f9ea981e1e112c1a4 Mon Sep 17 00:00:00 2001 From: adtdev20 Date: Thu, 10 Sep 2026 10:34:06 -0700 Subject: [PATCH 2/2] bumped version number in yml --- plugins/stashdb-performer-gallery/stashdb-performer-gallery.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stashdb-performer-gallery/stashdb-performer-gallery.yml b/plugins/stashdb-performer-gallery/stashdb-performer-gallery.yml index 0a96728e..4d0b695c 100644 --- a/plugins/stashdb-performer-gallery/stashdb-performer-gallery.yml +++ b/plugins/stashdb-performer-gallery/stashdb-performer-gallery.yml @@ -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