Skip to content
Merged
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
14 changes: 10 additions & 4 deletions plugins/tagScenesWithPerfTags/tagScenesWithPerfTags.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def processAll():
performers = stash.find_performers(
f=query,
filter={"page": page, "per_page": PERFORMER_PAGE_SIZE},
fragment="id name tags { id name }"
fragment="id name tags { id name ignore_auto_tag }"
)

if not performers:
Expand All @@ -54,6 +54,8 @@ def processAll():
performer_tags_names = set()

for tag in perf["tags"]:
if settings["excludeTagWithIgnoreAutoTag"] and tag["ignore_auto_tag"]:
continue
performer_tags_ids.add(tag["id"])
performer_tags_names.add(tag["name"])

Expand Down Expand Up @@ -112,7 +114,10 @@ def processScene(scene: dict):

perf_tag_ids = set()
for perf in scene.get("performers", []):
perf_tag_ids.update(map(lambda tag: tag["id"], perf.get("tags", [])))
for tag in perf.get("tags", []):
if settings["excludeTagWithIgnoreAutoTag"] and tag["ignore_auto_tag"]:
continue
perf_tag_ids.add(tag["id"])

# Skip if no performer tags
if not perf_tag_ids:
Expand Down Expand Up @@ -142,7 +147,8 @@ def processScene(scene: dict):

settings = {
"excludeSceneWithTag": "",
"excludeSceneOrganized": False
"excludeSceneOrganized": False,
"excludeTagWithIgnoreAutoTag": False
}
if "tagScenesWithPerfTags" in config["plugins"]:
settings.update(config["plugins"]["tagScenesWithPerfTags"])
Expand All @@ -161,6 +167,6 @@ def processScene(scene: dict):
and len(json_input["args"]["hookContext"]["inputFields"]) > 1
):
# Enforce explicit studio object allocation inside our graphQL post-hook criteria
scene = stash.find_scene(id, fragment="id organized tags { id name } performers { id tags { id } }")
scene = stash.find_scene(id, fragment="id organized tags { id name } performers { id tags { id ignore_auto_tag } }")
if scene:
processScene(scene)
2 changes: 1 addition & 1 deletion plugins/tagScenesWithPerfTags/tagScenesWithPerfTags.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Tag Scenes From Performer Tags
description: Tags scenes with performer tags.
version: 1.0.2
version: 1.0.3
url: https://discourse.stashapp.cc/t/tag-scenes-from-performer-tags/1413
exec:
- python
Expand Down
Loading