Skip to content

Commit a6107b5

Browse files
committed
Bugfix
Check that inputFields is in hookContext, and fixed wrongly-named variable
1 parent e19a8d0 commit a6107b5

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

plugins/PlexSync/PlexSync.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def processScene(scene):
1717

1818
if settings["tagStashIDs"]:
1919
if not scene["stash_ids"]: # Tagging empty Stash ID
20-
tags.append(empty_stashid)
20+
tags.append(int(settings["tagID_emptystashid"]))
2121

2222
for stashbox in scene["stash_ids"]: # Add all the stashbox ID tags
2323
url = stashbox['endpoint']
@@ -117,27 +117,29 @@ def processScene(scene):
117117
stashbox_tags = []
118118
stashbox_tags.append(frozenset(
119119
{
120+
int(settings["tagID_emptystashid"]),
120121
int(settings["tagID_stashdb"]),
121122
int(settings["tagID_pmvstash"]),
122123
int(settings["tagID_porndb"]),
123124
int(settings["tagID_fansdb"]),
124125
int(settings["tagID_javstash"])
125126
}))
126127

127-
if "tag_ids" in json_input["args"]["hookContext"]["inputFields"]:
128-
request_tags = json_input["args"]["hookContext"]["input"]["tag_ids"]
129-
if set(request_tags) & set(stashbox_tags): # prevent rerunning tag addition, when the update is simply adding the tags
130-
log.info("Already have correct tags.")
131-
exit = True
132-
else:
133-
exit = False
134-
135-
if "urls" in json_input["args"]["hookContext"]["inputFields"]:
136-
if len(json_input["args"]["hookContext"]["inputFields"]) == 2: # Hacky fix; Plex agent sends only two fields, so in this case we won't update metadata there again. Stash UI etc usually sends all fields in update, so no worries.
137-
log.info("Got new Plex URL, will not refresh.")
138-
exit = True
139-
else:
140-
exit = False
128+
if "inputFields" in json_input["args"]["hookContext"]:
129+
if "tag_ids" in json_input["args"]["hookContext"]["inputFields"]:
130+
request_tags = json_input["args"]["hookContext"]["input"]["tag_ids"]
131+
if set(request_tags) & set(stashbox_tags): # prevent rerunning tag addition, when the update is simply adding the tags
132+
log.info("Already have correct tags.")
133+
exit = True
134+
else:
135+
exit = False
136+
137+
if "urls" in json_input["args"]["hookContext"]["inputFields"]:
138+
if len(json_input["args"]["hookContext"]["inputFields"]) == 2: # Hacky fix; Plex agent sends only two fields, so in this case we won't update metadata there again. Stash UI etc usually sends all fields in update, so no worries.
139+
log.info("Got new Plex URL, will not refresh.")
140+
exit = True
141+
else:
142+
exit = False
141143

142144
if exit == True:
143145
log.info("Nothing to do, exiting.")

0 commit comments

Comments
 (0)