35 lines
732 B
Python
35 lines
732 B
Python
#/bin/python3.6
|
|
import json
|
|
from yaml import load, dump
|
|
try:
|
|
from yaml import CLoader as Loader, CDumper as Dumper
|
|
except ImportError:
|
|
from yaml import Loader, Dumper
|
|
|
|
|
|
# -------------------------------------------
|
|
|
|
|
|
|
|
f = open("./config.yaml", "r")
|
|
|
|
config = load(f, Loader=Loader)
|
|
|
|
commandBuilder = ""
|
|
|
|
dic = {
|
|
'assetDirectories':[
|
|
|
|
],
|
|
"storageDirectory" : "../storage/"
|
|
}
|
|
|
|
for mod in config["mods"]:
|
|
commandBuilder += " +workshop_download_item "+str(config["game"])+" "+str(mod)+" "
|
|
dic["assetDirectories"].append("../mods/"+str(mod)+"/");
|
|
|
|
print(commandBuilder)
|
|
|
|
|
|
with open('data.json', 'w', encoding='utf-8') as f:
|
|
json.dump(dic, f, ensure_ascii=False, indent=4) |