Add support for json url for playerskins DB
parent
b9e7ed45b7
commit
a454625207
|
@ -5,6 +5,7 @@ import html
|
|||
import json
|
||||
import logging
|
||||
import pathlib
|
||||
import requests
|
||||
import sys
|
||||
|
||||
import appdirs
|
||||
|
@ -87,10 +88,10 @@ def main():
|
|||
)
|
||||
top8_parser.add_argument(
|
||||
"--playerskinsdb", "-PD",
|
||||
type = pathlib.Path,
|
||||
type = (lambda s: s if s.startswith("http") else pathlib.Path(s)),
|
||||
default = ROOTDIR / "data" / "playerskinsdb.json",
|
||||
help = "A JSON file matching player tags, characters and " \
|
||||
"preferred skins",
|
||||
help = "A JSON file path or urk matching player tags, characters,"\
|
||||
" sponsors, and preferred skins",
|
||||
)
|
||||
top8_parser.add_argument(
|
||||
"--cachedir", "-CD",
|
||||
|
@ -209,6 +210,9 @@ def main():
|
|||
# Initialize PLAYERSKINS db
|
||||
log.debug("loading playerskins db from '{}'" \
|
||||
.format(args.playerskinsdb))
|
||||
try:
|
||||
smashgg.PLAYERSKINS = requests.get(args.playerskinsdb).json()
|
||||
except:
|
||||
with args.playerskinsdb.open("r", encoding="utf8") as f:
|
||||
smashgg.PLAYERSKINS = json.load(f)
|
||||
|
||||
|
|
Loading…
Reference in New Issue