Skip to content

Commit

Permalink
Fix: having a tagged local performer without specific Stashbox ID no …
Browse files Browse the repository at this point in the history
…longer crashes the plugin
  • Loading branch information
MinasukiHikimuna committed Aug 15, 2024
1 parent dfe1276 commit 6f83c32
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins/CompleteTheStash/CompleteTheStash.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CompleteTheStash
description: Finds missing scenes for selected performers and creates missing scene metadata to another missing Stash instance. You can use either StashDB or TPDB or both as a source for missing scenes.
version: 0.4.3
version: 0.4.4
url: https://github.com/MinasukiHikimuna/MidnightRider-Stash/
exec:
- python
Expand Down
11 changes: 10 additions & 1 deletion plugins/CompleteTheStash/StashCompleter.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def find_selected_local_performers(self):

def process_performers(self):
selected_local_performers = self.find_selected_local_performers()
selected_local_performers_with_stash_ids = []
missing_performers_by_stash_id = {}

for local_performer in selected_local_performers:
Expand All @@ -227,13 +228,21 @@ def process_performers(self):
),
None,
)
self.logger.debug(f"Performer {local_performer_name}: Stash ID {performer_stash_id}")
if not performer_stash_id:
self.logger.warning(
f"Performer {local_performer_name} does not have a Stashbox ID for endpoint {self.config.get('stashboxEndpoint')}. Skipping..."
)
continue

selected_local_performers_with_stash_ids.append(local_performer)
missing_performer_id = self.get_or_create_missing_performer(
local_performer_name, performer_stash_id
)

missing_performers_by_stash_id[performer_stash_id] = missing_performer_id

for local_performer in selected_local_performers:
for local_performer in selected_local_performers_with_stash_ids:
self.process_performer(
local_performer["id"], missing_performers_by_stash_id
)
Expand Down
16 changes: 16 additions & 0 deletions plugins/CompleteTheStash/test_stash_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ def test_stashdb(
.with_stash_id("a68a7630-4282-4d60-9734-6f695dea6ab8", graphql_endpoint)
.build()
)
performer_alexis = (PerformerBuilder()
.with_name("Alexis Crystal")
.with_stash_id("f1f1e7a-5380-4c4f-92b1-c340f48f8c94", "https://anotherendpoint.com/graphql")
.build()
)

scene_quality_work = (
SceneBuilder()
Expand Down Expand Up @@ -342,6 +347,9 @@ def test_stashdb(
performer_alissa_local = local_stash_instance_stashdb.create_performer(
{**performer_alissa, "tag_ids": [tag["id"]]}
)
performer_alexis_local = local_stash_instance_stashdb.create_performer(
{**performer_alexis, "tag_ids": [tag["id"]]}
)

job_id = local_stash_instance_stashdb.run_plugin_task(
"CompleteTheStash", "Complete The Stash!"
Expand Down Expand Up @@ -465,6 +473,11 @@ def test_tpdb(
.with_stash_id("19dcb2e9-1bfb-40b1-9567-ed8670bb4efc", graphql_endpoint)
.build()
)
performer_alexis = (PerformerBuilder()
.with_name("Alexis Crystal")
.with_stash_id("f1f1e7a-5380-4c4f-92b1-c340f48f8c94", "https://anotherendpoint.com/graphql")
.build()
)

scene_quality_work = (
SceneBuilder()
Expand Down Expand Up @@ -497,6 +510,9 @@ def test_tpdb(
performer_alissa_local = local_stash_instance_tpdb.create_performer(
{**performer_alissa, "tag_ids": [tag["id"]]}
)
performer_alexis_local = local_stash_instance_tpdb.create_performer(
{**performer_alexis, "tag_ids": [tag["id"]]}
)

job_id = local_stash_instance_tpdb.run_plugin_task(
"CompleteTheStash", "Complete The Stash!"
Expand Down

0 comments on commit 6f83c32

Please sign in to comment.