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
|
@classmethod
|
||||||
def _get_latest_file_url(cls, addon: Addon) -> str:
|
def _get_latest_file_url(cls, addon: Addon) -> str:
|
||||||
info = cls._get_curse_addon_info(addon)
|
info = cls._get_curse_addon_info(addon)
|
||||||
for file in info["latestFiles"]:
|
flavor_priorities = [
|
||||||
# releaseTypes: 1: release, 2: beta, 3: alpha
|
"wow_burning_crusade",
|
||||||
if file["gameVersionFlavor"] == "wow_burning_crusade" and file["releaseType"] == 1:
|
"wow_classic",
|
||||||
return file["downloadUrl"]
|
"wow_retail",
|
||||||
raise FileNotFoundError("No file found")
|
]
|
||||||
|
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