mirror of
https://github.com/stashapp/CommunityScripts.git
synced 2025-12-11 14:55:10 -06:00
[PerformerStashboxUrltoID] (#604)
Co-authored-by: feederbox826 <feederbox826@users.noreply.github.com>
This commit is contained in:
parent
a16ba714eb
commit
445bbe29ad
@ -2,37 +2,30 @@ import stashapi.log as log
|
|||||||
from stashapi.stashapp import StashInterface
|
from stashapi.stashapp import StashInterface
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import time
|
|
||||||
import re
|
|
||||||
|
|
||||||
|
STASH_BOXES = [
|
||||||
|
"https://fansdb.cc",
|
||||||
|
"https://pmvstash.org",
|
||||||
|
"https://stashdb.org",
|
||||||
|
"https://javstash.org"
|
||||||
|
]
|
||||||
|
|
||||||
def processPerformer(performer):
|
def processPerformer(performer):
|
||||||
log.debug(performer["stash_ids"])
|
log.trace(performer["stash_ids"])
|
||||||
stash_boxes = [x["endpoint"] for x in performer["stash_ids"]]
|
stash_boxes = [x["endpoint"] for x in performer["stash_ids"]]
|
||||||
needs_update = False
|
needs_update = False
|
||||||
performer_update = {"id": performer["id"], "stash_ids": performer["stash_ids"]}
|
performer_update = {"id": performer["id"], "stash_ids": performer["stash_ids"]}
|
||||||
for url in performer["urls"]:
|
for url in performer["urls"]:
|
||||||
log.debug(url)
|
log.trace(url)
|
||||||
if "https://fansdb.cc/performers/" in url:
|
for domain in STASH_BOXES:
|
||||||
if "https://fansdb.cc/graphql" not in stash_boxes:
|
if domain in url and f"{domain}/graphql" not in stash_boxes:
|
||||||
performer_update["stash_ids"].append(
|
performer_update["stash_ids"].append(
|
||||||
{"endpoint": "https://fansdb.cc/graphql", "stash_id": url[-36:]}
|
{"endpoint": f"{domain}/graphql", "stash_id": url[-36:]}
|
||||||
)
|
|
||||||
needs_update = True
|
|
||||||
if "https://pmvstash.org/performers/" in url:
|
|
||||||
if "https://pmvstash.org/graphql" not in stash_boxes:
|
|
||||||
performer_update["stash_ids"].append(
|
|
||||||
{"endpoint": "https://pmvstash.org/graphql", "stash_id": url[-36:]}
|
|
||||||
)
|
|
||||||
needs_update = True
|
|
||||||
if "https://stashdb.org/performers/" in url:
|
|
||||||
if "https://stashdb.org/graphql" not in stash_boxes:
|
|
||||||
performer_update["stash_ids"].append(
|
|
||||||
{"endpoint": "https://stashdb.org/graphql", "stash_id": url[-36:]}
|
|
||||||
)
|
)
|
||||||
needs_update = True
|
needs_update = True
|
||||||
|
log.info("Adding stashbox %s to performer %s" % (domain, performer["id"]))
|
||||||
|
|
||||||
log.debug(performer_update)
|
log.trace(performer_update)
|
||||||
if needs_update:
|
if needs_update:
|
||||||
stash.update_performer(performer_update)
|
stash.update_performer(performer_update)
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
name: Performer Stashbox Url to ID
|
name: Performer Stashbox Url to ID
|
||||||
description: If the performer has a url for another stashbox add it as an id to the performer
|
description: If the performer has a url for another stashbox add it as an id to the performer
|
||||||
version: 0.1
|
version: 0.2
|
||||||
url: https://github.com/stashapp/CommunityScripts/
|
url: https://github.com/stashapp/CommunityScripts/
|
||||||
exec:
|
exec:
|
||||||
- python
|
- python
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user