CurseForge: Prefer classic AddOns instead of ignoring retail ones.
This commit is contained in:
parent
2fd7640a9e
commit
1f3bbbde28
|
@ -66,8 +66,19 @@ class CurseForge(Web):
|
|||
@classmethod
|
||||
def _get_latest_file_url(cls, addon: Addon) -> str:
|
||||
info = cls._get_curse_addon_info(addon)
|
||||
for file in info["latestFiles"]:
|
||||
# releaseTypes: 1: release, 2: beta, 3: alpha
|
||||
if file["gameVersionFlavor"] == "wow_burning_crusade" and file["releaseType"] == 1:
|
||||
return file["downloadUrl"]
|
||||
raise FileNotFoundError("No file found")
|
||||
flavor_priorities = [
|
||||
"wow_burning_crusade",
|
||||
"wow_classic",
|
||||
"wow_retail",
|
||||
]
|
||||
files = sorted(
|
||||
info["latestFiles"],
|
||||
key=lambda f: (
|
||||
flavor_priorities.index(f["gameVersionFlavor"]),
|
||||
f["releaseType"] # releaseType: 1: release, 2: beta, 3: alpha
|
||||
),
|
||||
)
|
||||
try:
|
||||
return files[0]["downloadUrl"]
|
||||
except IndexError:
|
||||
raise FileNotFoundError("No file found")
|
||||
|
|
Loading…
Reference in a new issue