Skip to content

Commit 445bbe2

Browse files
authored
[PerformerStashboxUrltoID] (#604)
Co-authored-by: feederbox826 <[email protected]>
1 parent a16ba71 commit 445bbe2

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

plugins/performerStashboxUrlToID/performerStashboxUrlToID.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,30 @@
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+
]
812

913
def processPerformer(performer):
10-
log.debug(performer["stash_ids"])
14+
log.trace(performer["stash_ids"])
1115
stash_boxes = [x["endpoint"] for x in performer["stash_ids"]]
1216
needs_update = False
1317
performer_update = {"id": performer["id"], "stash_ids": performer["stash_ids"]}
1418
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:
19+
log.trace(url)
20+
for domain in STASH_BOXES:
21+
if domain in url and f"{domain}/graphql" not in stash_boxes:
1822
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:]}
23+
{"endpoint": f"{domain}/graphql", "stash_id": url[-36:]}
3224
)
3325
needs_update = True
26+
log.info("Adding stashbox %s to performer %s" % (domain, performer["id"]))
3427

35-
log.debug(performer_update)
28+
log.trace(performer_update)
3629
if needs_update:
3730
stash.update_performer(performer_update)
3831

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)