Curseforge: Allow installation using Curse Project ID in place of slug.

This commit is contained in:
Casper V. Kristensen 2020-04-21 00:27:38 +02:00
parent 376c485a5a
commit 440e8dd596
Signed by: caspervk
GPG key ID: 289CA03790535054

View file

@ -29,8 +29,14 @@ class CurseForge(Web):
except KeyError:
pass
logger.debug("Getting CurseForge AddOn ID")
slug = addon.url.split("/addons/")[-1]
if slug.isnumeric():
# We allow users to substitute AddOn slug with Curse "Project ID" for weirdly-named AddOns
curse_id = int(slug)
addon.provider_data["curse_id"] = curse_id
return curse_id
logger.debug("Getting CurseForge AddOn ID")
query = " ".join(( # slug "big-wigs" becomes query "big-wigs bigwigs big wigs"
slug,
slug.replace("-", ""),