WebHost: Add youtube livestreaming and autogenerated multistream link

This commit is contained in:
Fabian Dill
2020-07-25 22:40:24 +02:00
parent aacd5b4063
commit 5cd5223ae0
5 changed files with 35 additions and 7 deletions

View File

@@ -125,16 +125,22 @@ if __name__ == "__main__":
Utils.persistent_store("servers", data['hash'], data['server'])
print(f"Host is {data['server']}")
elif rom.endswith("_multidata"):
elif rom.endswith("multidata"):
import json
import zlib
with open(rom, 'rb') as fr:
multidata = zlib.decompress(fr.read()).decode("utf-8")
with open(rom + '.txt', 'w') as fw:
fw.write(multidata)
multidata = json.loads(multidata)
for rom in multidata['roms']:
Utils.persistent_store("servers", "".join(chr(byte) for byte in rom[2]), address)
for romname in multidata['roms']:
Utils.persistent_store("servers", "".join(chr(byte) for byte in romname[2]), address)
from Utils import get_options
multidata["server_options"] = get_options()["server_options"]
multidata = zlib.compress(json.dumps(multidata).encode("utf-8"), 9)
with open(rom+"_updated.multidata", 'wb') as f:
f.write(multidata)
elif rom.endswith(".zip"):
print(f"Updating host in patch files contained in {rom}")