From 90dc678e03ab04e44c19eb72717d5fb6d993fa49 Mon Sep 17 00:00:00 2001 From: feederbox826 Date: Fri, 16 Aug 2024 14:37:35 -0400 Subject: [PATCH] replace URL with constant --- plugins/TPDBMarkers/tpdbMarkers.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/TPDBMarkers/tpdbMarkers.py b/plugins/TPDBMarkers/tpdbMarkers.py index 2c84192d..1cb63bc5 100644 --- a/plugins/TPDBMarkers/tpdbMarkers.py +++ b/plugins/TPDBMarkers/tpdbMarkers.py @@ -10,10 +10,11 @@ per_page = 100 request_s = requests.Session() +TPDB_ENDPOINT = "https://theporndb.net/graphql" def processScene(scene): for sid in scene["stash_ids"]: - if sid["endpoint"] == "https://theporndb.net/graphql": + if sid["endpoint"] == TPDB_ENDPOINT: log.debug("Scene has a TPDB stash id, looking up %s " % (sid["stash_id"],)) res = request_s.get( "https://api.theporndb.net/scenes/%s" % (sid["stash_id"],) @@ -58,7 +59,7 @@ def processAll(): count = stash.find_scenes( f={ "stash_id_endpoint": { - "endpoint": "https://theporndb.net/graphql", + "endpoint": TPDB_ENDPOINT, "modifier": "NOT_NULL", "stash_id": "", }, @@ -87,7 +88,7 @@ def processAll(): scenes = stash.find_scenes( f={ "stash_id_endpoint": { - "endpoint": "https://theporndb.net/graphql", + "endpoint": TPDB_ENDPOINT, "modifier": "NOT_NULL", "stash_id": "", }, @@ -160,11 +161,11 @@ def processMovie(m): log.debug("settings: %s " % (settings,)) # Set up the auth token for tpdb -if "https://theporndb.net/graphql" in [ +if TPDB_ENDPOINT in [ x["endpoint"] for x in stash.get_configuration()["general"]["stashBoxes"] ]: for x in stash.get_configuration()["general"]["stashBoxes"]: - if x["endpoint"] == "https://theporndb.net/graphql": + if x["endpoint"] == TPDB_ENDPOINT: request_s.headers["Authorization"] = "Bearer %s" % (x["api_key"],) if "mode" in json_input["args"]: