Last active
December 15, 2017 22:46
-
-
Save Yakoot/22cb010d2d87e62dca70fab621544f09 to your computer and use it in GitHub Desktop.
Check factorio mods not ready to update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment