Script to check outdated mods

Enhance your gameplay with these tools. This category is also the right place for tools useful for modders.
Mod databases, calculators, cheatsheets, multiplayer, scripts, libs and other useful stuff that is not strictly in-game mods.
Post Reply
Yakoot
Burner Inserter
Burner Inserter
Posts: 17
Joined: Thu Nov 02, 2017 2:24 pm
Contact:

Script to check outdated mods

Post by Yakoot »

Oh, I wrote this post in modding discussions, but now I found this forum =)

Simple python script to check outdated mods. Running in mods folder

https://gist.github.com/Yakoot/22cb010d ... b621544f09

Code: Select all

#!/usr/bin/python

import json
import time
import urllib
from urllib.request import urlopen

mods_list = json.load(open('mod-list.json'))['mods']
global total, ready, not_ready
total = 0
ready = 0
not_ready = 0

def check_mod(name):
    global total, ready, not_ready
    search = urlopen('https://mods.factorio.com/api/mods?q=' + urllib.parse.quote(name))
    search_data = json.load(search)
    result = search_data['results'][0]
    version = result['latest_release']['info_json']['factorio_version']
    if version != "0.16":
        not_ready += 1
        print(name)
    else:
        ready += 1

for mod in mods_list:
    if mod['enabled']:
        total += 1
        # time.sleep(1)
        check_mod(mod['name'])
print("Total: " + str(total))
print("Not ready: " + str(not_ready))
print("Ready: " + str(ready))

Post Reply

Return to “Tools”