1
0
Fork 0

Add srrdb.com

This commit is contained in:
Casper V. Kristensen 2022-06-14 23:14:30 +02:00
parent fae03e5e43
commit 6c5d80cc3e

View file

@ -17,8 +17,10 @@ class Pre(NamedTuple):
def get_pres() -> List[Pre]:
logger.info("Getting pres from predbs")
# PreDBs in order of preference
predbs = (get_xrel, get_predbde, get_srrdb, get_predbovh)
pres = {}
for get in (get_predbovh, get_predbde, get_xrel): # in reverse order of preference
for get in reversed(predbs):
try:
pres.update(
(p.dirname, p) for p in get()
@ -98,3 +100,18 @@ def get_predbovh() -> List[Pre]:
)
for rls in r.json["data"]["rows"]
]
def get_srrdb() -> List[Pre]:
logger.debug("Getting pres from srrdb.com")
r = cache.get("https://api.srrdb.com/v1/search/category:pc/order:date-desc")
return [
Pre(
dirname=rls["release"],
nfo_link="https://www.srrdb.com/release/details/{}".format(rls["release"]),
timestamp=datetime.fromisoformat(rls["date"]),
)
for rls in r.json["results"]
]