Support multiple download URLs per module#3877
Conversation
techman83
left a comment
There was a problem hiding this comment.
Ok, this is super cool! Is there an example of what the outputed ckan will look like? Do we have the extra test coverage for this new functionality?
|
Here's the output of running netkan on the example netkan in the description: {
"spec_version": "v1.34",
"identifier": "SpaceWarp",
"name": "SpaceWarp",
"abstract": "A C# modding API for KSP2 built off of BepInEx",
"author": "cheese3660",
"version": "1.4.0",
"ksp_version_min": "0",
"ksp_version_max": "0.1.3",
"license": "MIT",
"resources": {
"homepage": "https://forum.kerbalspaceprogram.com/topic/218490-space-warp-v140-for-ksp2-013/",
"spacedock": "https://spacedock.info/mod/3277/Space%20Warp%20+%20BepInEx",
"repository": "https://github.com/SpaceWarpDev/SpaceWarp",
"bugtracker": "https://github.com/SpaceWarpDev/SpaceWarp/issues",
"remote-swinfo": "https://raw.githubusercontent.com/SpaceWarpDev/SpaceWarp/main/SpaceWarpBuildTemplate/swinfo.json",
"x_screenshot": "https://spacedock.info/content/cheese3660_103715/Space_Warp__BepInEx/Space_Warp__BepInEx-1678544917.png"
},
"tags": [
"plugin",
"library"
],
"depends": [
{
"name": "BepInEx"
},
{
"name": "UITKforKSP2"
}
],
"install": [
{
"find": "BepInEx",
"install_to": "GameRoot",
"include_only": [
"patchers",
"plugins"
]
}
],
"download": [
"https://spacedock.info/mod/3277/Space%20Warp%20+%20BepInEx/download/1.4.0",
"https://github.com/SpaceWarpDev/SpaceWarp/releases/download/spacewarp-1.4.0/spacewarp-release-1.4.0.zip"
],
"download_size": 10997877,
"download_hash": {
"sha1": "44713C69616854626578DD4B0DED54E2DAD3D1A7",
"sha256": "F4821C66B612074FA8364D6759E7CB21770DFA92C3EE3265EC6BCF69C81775D2"
},
"download_content_type": "application/zip",
"install_size": 26579768,
"release_date": "2023-07-19T00:16:14Z",
"x_generated_by": "netkan"
}Good point about tests. I'll look into that next (but not immediately)... |
|
Awesome. Maybe if we can get at least one on the expected netkan output we should be good enough for now. Our indexing should be ok (it's based around netkan anyway), but maybe need to check the mirrorer, as this is going from a key/value to key/list |
e17ad0a to
985292b
Compare
|
OK, each commit now has some tests for the other stuff added in that commit, some of which is now more deterministic (e.g., not relying on Good point, the Infra will probably need some updates. |
techman83
left a comment
There was a problem hiding this comment.
This is really cool @HebaruSan ! Thanks for adding the extra tests 🙂
Motivation
SpaceDock has been having unexplained bandwidth problems recently, which have caused downloads to be very slow and sometimes truncated. This has been reported to the site owner (see KSP-SpaceDock/SpaceDock#463), but so far there's no sign of an improvement on the horizon.
Many mods are available on multiple hosts. Currently we have to choose just one to put in the netkan. This situation with SpaceDock would be easier to handle if we could support alternate download URLs.
Changes
downloadto be a string or a list of stringsauthorandlicense)Registry.GetAllHostsfunction scans the available modules in the registry and returns their URLs' hosts in order of frequencyversionattributes. Thedownloadproperties will be merged into a list.After this, we will be able to start adding alternate download sources for mods, and users will be able to prioritize GitHub over SpaceDock to avoid SpaceDock's bandwidth problems.
Fixes #487.
Fixes #1760.