Skip to content

Commit

Permalink
Fix deleting missing scenes with multiple Stashboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
MinasukiHikimuna committed Aug 4, 2024
1 parent 924c5c1 commit 77a023f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
25 changes: 1 addition & 24 deletions plugins/CompleteTheStash/CompleteTheStash.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def process_input(json_input, stash_completer: StashCompleter):
event_type = json_input.get("args", {}).get("hookContext", {}).get("type")
if json_input.get("args", {}).get("mode") == "process_performers":
stash_completer.process_performers()
elif event_type == "Scene.Create.Post":
elif event_type in ["Scene.Create.Post", "Scene.Update.Post"]:
try:
scene_id = json_input.get("args", {}).get("hookContext", {}).get("id")
except AttributeError:
Expand All @@ -184,29 +184,6 @@ def process_input(json_input, stash_completer: StashCompleter):

logger.debug(f"Processing scene create type {event_type} for scene {scene_id}.")
stash_completer.process_scene_by_id(scene_id)
elif event_type == "Scene.Update.Post":
try:
stash_ids = (
json_input.get("args", {})
.get("hookContext", {})
.get("input", {})
.get("stash_ids", [])
)
except AttributeError:
stash_ids = []

stash_id = next(
(sid.get("stash_id") for sid in stash_ids),
None,
)
if (stash_id is None) or (stash_id == ""):
logger.debug(
f"Stash ID is not provided in the input for type {event_type}. Skipping."
)
return

logger.debug(f"Processing scene update type {event_type} for scene {stash_id}.")
stash_completer.process_scene_by_stashbox_id(stash_id)
else:
logger.error(f"Invalid input: {json_input}")

Expand Down
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.1
version: 0.4.2
url: https://github.com/MinasukiHikimuna/MidnightRider-Stash/
exec:
- python
Expand Down

0 comments on commit 77a023f

Please sign in to comment.