CurseForge, GitHub: Update for TBCC.
This commit is contained in:
parent
e4618876dc
commit
ce6e5f6eb7
2 changed files with 18 additions and 2 deletions
|
@ -67,6 +67,7 @@ class CurseForge(Web):
|
|||
def _get_latest_file_url(cls, addon: Addon) -> str:
|
||||
info = cls._get_curse_addon_info(addon)
|
||||
for file in info["latestFiles"]:
|
||||
if file["gameVersionFlavor"] == "wow_classic" and file["releaseType"] == 1: # 1: release, 2: beta, 3: alpha
|
||||
# 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")
|
||||
|
|
|
@ -28,7 +28,22 @@ class GitHub(Web):
|
|||
latest_release = http.open(
|
||||
url=f"{cls.api_url}/repos/{repo_owner}/{repo_name}/releases/latest"
|
||||
).json()
|
||||
for asset in sorted(latest_release["assets"], key=lambda a: "classic" in a["name"].lower(), reverse=True):
|
||||
|
||||
asset_priorities = [
|
||||
r"[._-]bcc[._-]",
|
||||
r"[._-]bc[._-]",
|
||||
r"[._-]tbc[._-]",
|
||||
r"[._-]classic[._-]",
|
||||
r".*",
|
||||
]
|
||||
for asset in sorted(
|
||||
latest_release["assets"],
|
||||
key=lambda a: next(
|
||||
i
|
||||
for i, ap in enumerate(asset_priorities)
|
||||
if re.search(ap, a["name"], flags=re.IGNORECASE)
|
||||
)
|
||||
):
|
||||
if Path(asset["name"]).suffix == ".zip":
|
||||
return super().download(addon, asset["browser_download_url"])
|
||||
raise FileNotFoundError("No zip file found for latest release")
|
||||
|
|
Loading…
Reference in a new issue