Skip to content

Commit 748b1a7

Browse files
committed
[PerformerStashboxUrltoID]
simplify STASH_BOX iteration - add JAVStash, TPDB - move some debug to TRACE - modular domain adding and collapsed IF structure
1 parent a16ba71 commit 748b1a7

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

plugins/performerStashboxUrlToID/performerStashboxUrlToID.py

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,31 @@
22
from stashapi.stashapp import StashInterface
33
import sys
44
import json
5-
import time
6-
import re
75

6+
STASH_BOXES = [
7+
"https://fansdb.cc",
8+
"https://pmvstash.org",
9+
"https://stashdb.org",
10+
"https://javstash.org",
11+
"https://theporndb.net"
12+
]
813

914
def processPerformer(performer):
10-
log.debug(performer["stash_ids"])
15+
log.trace(performer["stash_ids"])
1116
stash_boxes = [x["endpoint"] for x in performer["stash_ids"]]
1217
needs_update = False
1318
performer_update = {"id": performer["id"], "stash_ids": performer["stash_ids"]}
1419
for url in performer["urls"]:
15-
log.debug(url)
16-
if "https://fansdb.cc/performers/" in url:
17-
if "https://fansdb.cc/graphql" not in stash_boxes:
20+
log.trace(url)
21+
for domain in STASH_BOXES:
22+
if domain in url and f"{domain}/graphql" not in stash_boxes:
1823
performer_update["stash_ids"].append(
19-
{"endpoint": "https://fansdb.cc/graphql", "stash_id": url[-36:]}
20-
)
21-
needs_update = True
22-
if "https://pmvstash.org/performers/" in url:
23-
if "https://pmvstash.org/graphql" not in stash_boxes:
24-
performer_update["stash_ids"].append(
25-
{"endpoint": "https://pmvstash.org/graphql", "stash_id": url[-36:]}
26-
)
27-
needs_update = True
28-
if "https://stashdb.org/performers/" in url:
29-
if "https://stashdb.org/graphql" not in stash_boxes:
30-
performer_update["stash_ids"].append(
31-
{"endpoint": "https://stashdb.org/graphql", "stash_id": url[-36:]}
24+
{"endpoint": f"{domain}/graphql", "stash_id": url[-36:]}
3225
)
3326
needs_update = True
27+
log.info("Adding stashbox %s to performer %s" % (domain, performer["id"]))
3428

35-
log.debug(performer_update)
29+
log.trace(performer_update)
3630
if needs_update:
3731
stash.update_performer(performer_update)
3832

plugins/performerStashboxUrlToID/performerStashboxUrlToID.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Performer Stashbox Url to ID
22
description: If the performer has a url for another stashbox add it as an id to the performer
3-
version: 0.1
3+
version: 0.2
44
url: https://github.com/stashapp/CommunityScripts/
55
exec:
66
- python

0 commit comments

Comments
 (0)