diff --git a/dailyreleases/predbs.py b/dailyreleases/predbs.py index c82fb7c..dc7f5ec 100644 --- a/dailyreleases/predbs.py +++ b/dailyreleases/predbs.py @@ -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"] + ]