Skip to content

Commit

Permalink
Allow disabling scene marker hooks (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
p0rnb0x authored Feb 21, 2024
1 parent 3bf16a6 commit 02894d1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
5 changes: 5 additions & 0 deletions plugins/TPBDMarkers/TPDBMarkers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ hooks:
triggeredBy:
- Scene.Update.Post

settings:
disableSceneMarkerHook:
displayName: Disable the Scene Markers hook
type: BOOLEAN

tasks:
- name: "Sync"
description: Get markers for all scenes with a stashid from metadataapi.net and no markers
Expand Down
17 changes: 13 additions & 4 deletions plugins/TPBDMarkers/tpdbMarkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ def processAll():
FRAGMENT_SERVER = json_input["server_connection"]
stash = StashInterface(FRAGMENT_SERVER)

config = stash.get_configuration()["plugins"]
settings = {
"disableSceneMarkerHook": False,
}
if "tPdBmarkers" in config:
settings.update(config["tPdBmarkers"])
log.debug("settings: %s " % (settings,))

# Set up the auth token for tpdb
if "https://metadataapi.net/graphql" in [
x["endpoint"] for x in stash.get_configuration()["general"]["stashBoxes"]
Expand All @@ -108,10 +116,11 @@ def processAll():
if "processScene" in PLUGIN_ARGS:
processAll()
elif "hookContext" in json_input["args"]:
id = json_input["args"]["hookContext"]["id"]
if json_input["args"]["hookContext"]["type"] == "Scene.Update.Post":
scene = stash.find_scene(id)
processScene(scene)
_id = json_input["args"]["hookContext"]["id"]
_type = json_input["args"]["hookContext"]["type"]
if _type == "Scene.Update.Post" and not settings["disableSceneMarkerHook"]:
scene = stash.find_scene(_id)
processScene(scene)

else:
log.warning("The Porn DB endpoint not configured")
15 changes: 9 additions & 6 deletions plugins/timestampTrade/timestampTrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,10 +656,12 @@ def getImages(gallery_id):
"createGalleryFromScene": False,
"createMovieFromScene": False,
"extraUrls": False,
"disableSceneMarkersHook": False,
"disableGalleryLookupHook": False,
}
if "timestampTrade" in config:
settings.update(config["timestampTrade"])
log.debug("config: %s " % (settings,))
log.debug("settings: %s " % (settings,))


if "mode" in json_input["args"]:
Expand Down Expand Up @@ -700,10 +702,11 @@ def getImages(gallery_id):
processAll()

elif "hookContext" in json_input["args"]:
id = json_input["args"]["hookContext"]["id"]
if json_input["args"]["hookContext"]["type"] == "Scene.Update.Post":
scene = stash.find_scene(id)
_id = json_input["args"]["hookContext"]["id"]
_type = json_input["args"]["hookContext"]["type"]
if _type == "Scene.Update.Post" and not settings["disableSceneMarkersHook"]:
scene = stash.find_scene(_id)
processScene(scene)
if json_input["args"]["hookContext"]["type"] == "Gallery.Update.Post":
gallery = stash.find_gallery(id)
if _type == "Gallery.Update.Post" and not settings["disableGalleryLookupHook"]:
gallery = stash.find_gallery(_id)
processGallery(gallery)
6 changes: 6 additions & 0 deletions plugins/timestampTrade/timestampTrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ settings:
displayName: Add extra urls if they exist on timestamp.trade
description: Extra urls can be submitted to timestamp.trade, add them to the scene if they exist
type: BOOLEAN
disableSceneMarkersHook:
displayName: Disable the Scene Markers hook
type: BOOLEAN
disableGalleryLookupHook:
displayName: Disable the Gallery Lookup hook
type: BOOLEAN

hooks:
- name: Add Marker to Scene
Expand Down

0 comments on commit 02894d1

Please sign in to comment.