FactorioMods icon indicating copy to clipboard operation
FactorioMods copied to clipboard

Download Consistency

Open Berserker66 opened this issue 9 years ago • 3 comments

Building a mod manager, with the aim of automatically updating mods before launching into factorio. Problem I'm running into, is that the files are inconsistent. You get download links from the api, that can link to practically anything. I can check the returned file to be zip and contains the info.json file, but if that doesn't exist, the file is worthless to an automated process. In my opinion the mods should be consistently factorio zip files, either by the website checking contributions to be that when the link is added, or by hosting the file on FactorioMods.

With the current mods, I mostly get zip files, but also stuff like "5dim pack.rar" "XxrcAy6" and "file.php"

Berserker66 avatar Sep 15 '15 14:09 Berserker66

For reliability you should use the mirror link which will always be a zip file hosted by the app, so it won't go down. Although for big mods (50mb+) the mirror probably contains nothing.

Zequez avatar Sep 15 '15 15:09 Zequez

Again... very inconsistent.

So far, it works always as:

url = mod["releases"][0]["files"][0]["url"]
if not url:
    url = mod["releases"][0]["files"][0]["mirror"]
if not url:
    raise Exception("Cannot find download link for mod.")

However, the retrieved file can be anything.

Berserker66 avatar Sep 15 '15 15:09 Berserker66

Try to use the mirror first if it exists, since the URL is usually hotlinked and it might be broken. Anyway, the next version is going to have a single download link with validated files and hosted by the Factorio CDN.

Zequez avatar Sep 15 '15 16:09 Zequez