@@ -13,7 +13,7 @@ def processAll():
1313 exclussion_marker_tag = stash .find_tag (settings ["excludeSceneWithTag" ])
1414 if exclussion_marker_tag is not None :
1515 exclusion_marker_tag_id = exclussion_marker_tag ['id' ]
16-
16+
1717 query = {
1818 "tags" : {
1919 "modifier" : "NOT_NULL" ,
@@ -23,21 +23,21 @@ def processAll():
2323 "value" : 0 ,
2424 },
2525 }
26-
26+
2727 try :
2828 performersTotal = stash .find_performers (f = query , filter = {"page" : 0 , "per_page" : 1 }, get_count = True )[0 ]
2929 except Exception :
3030 performersTotal = 0
31-
31+
3232 processed = 0
3333 page = 0
34-
34+
3535 while True :
3636 if performersTotal > 0 :
3737 log .progress (min (processed / performersTotal , 1.0 ))
3838
3939 performers = stash .find_performers (
40- f = query ,
40+ f = query ,
4141 filter = {"page" : page , "per_page" : PERFORMER_PAGE_SIZE },
4242 fragment = "id name tags { id name }"
4343 )
@@ -47,13 +47,18 @@ def processAll():
4747 break
4848
4949 for perf in performers :
50- performer_tags_ids = [t ["id" ] for t in perf ["tags" ]]
51- performer_tags_names = [t ["name" ] for t in perf ["tags" ]]
52-
50+ performer_tags_ids = []
51+ performer_tags_names = []
52+ for performer_tag in perf [0 ]["tags" ]:
53+ if settings ["excludeTagWithIgnoreAutoTag" ] and performer_tag ["ignore_auto_tag" ]:
54+ continue
55+ performer_tags_ids .append (performer_tag ["id" ])
56+ performer_tags_names .append (performer_tag ["name" ])
57+
5358 if not performer_tags_ids :
5459 processed += 1
5560 continue
56-
61+
5762 scene_query = {
5863 "performers" : {
5964 "value" : [perf ["id" ]],
@@ -96,20 +101,22 @@ def processScene(scene: dict):
96101 for tag in scene .get ("tags" , []):
97102 if tag ["name" ] == settings ["excludeSceneWithTag" ]:
98103 return
99-
104+
100105 if settings ['excludeSceneOrganized' ] and scene .get ('organized' ):
101106 return
102107
103108 target_tag_ids = []
104109 for perf in scene .get ("performers" , []):
105110 for tag in perf .get ("tags" , []):
111+ if settings ["excludeTagWithIgnoreAutoTag" ] and tag ["ignore_auto_tag" ]:
112+ continue
106113 target_tag_ids .append (tag ["id" ])
107114
108115 if not target_tag_ids :
109116 return
110117
111118 stash .update_scenes ({
112- "ids" : [scene ["id" ]],
119+ "ids" : [scene ["id" ]],
113120 "tag_ids" : {"mode" : "ADD" , "ids" : list (set (target_tag_ids ))}
114121 })
115122
@@ -133,13 +140,13 @@ def processScene(scene: dict):
133140elif "hookContext" in json_input ["args" ]:
134141 id = json_input ["args" ]["hookContext" ]["id" ]
135142 hook_type = json_input ["args" ]["hookContext" ].get ("type" , "" )
136-
143+
137144 if (
138- (hook_type == "Scene.Update.Post" or hook_type == "Scene.Create.Post" )
145+ (hook_type == "Scene.Update.Post" or hook_type == "Scene.Create.Post" )
139146 and "inputFields" in json_input ["args" ]["hookContext" ]
140147 and len (json_input ["args" ]["hookContext" ]["inputFields" ]) > 1
141148 ):
142149 # Enforce explicit studio object allocation inside our graphQL post-hook criteria
143- scene = stash .find_scene (id , fragment = "id organized tags { name } performers { id tags { id } } studio { id }" )
150+ scene = stash .find_scene (id , fragment = "id organized tags { name } performers { id tags { id ignore_auto_tag } } studio { id }" )
144151 if scene :
145- processScene (scene )
152+ processScene (scene )
0 commit comments