No description
Find a file
2025-01-29 22:24:41 +08:00
releases Add v4.1.10 2025-01-29 22:11:35 +08:00
.gitattributes Enforce LFS for archives 2024-03-21 14:14:08 +08:00
.gitignore Ignore pycache 2024-03-26 23:07:07 +08:00
README.md Fix suggested method of getting latest tag 2025-01-29 22:24:41 +08:00
SMAPI.json Add v4.1.10 2025-01-29 22:11:35 +08:00
sync.py Rename update.py to sync.py 2024-03-26 23:00:52 +08:00
update.py Fix version comparison 2025-01-29 22:11:25 +08:00

SMAPI Releases

Description

This repository archives all the releases of the Stardew Valley Modding API (SMAPI) from version 3.13.1 onwards for scripting purposes.

Usage

Use the SMAPI.json file maintained in this repository to get the available releases and make up their download links.

Example

Load and read the SMAPI.json file:

url = "https://gitlab.com/irfanhakim/smapi-release/-/raw/master/SMAPI.json"
smapi_json = json.loads(urllib.request.urlopen(url).read())

Make up the release info containing their version numbers and corresponding download IDs:

release_info = {release["version"]: release["id"] for release in smapi_json["releases"]}

Get the latest SMAPI version and its unique download ID:

# get the latest smapi version
latest_tag = max(release_info.keys(), key=lambda v: tuple(map(int, v.split("."))))

# get the id corresponding to the latest version
latest_id = release_info[latest_tag]

Make up the download URL for the latest SMAPI release:

latest_smapi_url = smapi_json["base_url"] % latest_id

Download the latest SMAPI release:

urllib.request.urlretrieve(latest_smapi_url, "SMAPI.zip")