Skip to content

Commit

Permalink
replace URL with constant
Browse files Browse the repository at this point in the history
  • Loading branch information
feederbox826 committed Aug 16, 2024
1 parent c0acd03 commit 90dc678
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions plugins/TPDBMarkers/tpdbMarkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],)
Expand Down Expand Up @@ -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": "",
},
Expand Down Expand Up @@ -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": "",
},
Expand Down Expand Up @@ -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"]:
Expand Down

0 comments on commit 90dc678

Please sign in to comment.