diff --git a/Mystery.py b/Mystery.py index 972ed92c..c8c58102 100644 --- a/Mystery.py +++ b/Mystery.py @@ -49,7 +49,7 @@ def mystery_argparse(): return args -def main(args=None): +def main(args=None, callback = ERmain): if not args: args = mystery_argparse() @@ -203,7 +203,7 @@ def main(args=None): erargs.skip_progression_balancing = {player: not balanced for player, balanced in erargs.progression_balancing.items()} del (erargs.progression_balancing) - ERmain(erargs, seed) + callback(erargs, seed) def get_weights(path): diff --git a/Patch.py b/Patch.py index 405cd3c2..6c56dfe1 100644 --- a/Patch.py +++ b/Patch.py @@ -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}") diff --git a/WebHostLib/__init__.py b/WebHostLib/__init__.py index 07a571ca..5daa2f1e 100644 --- a/WebHostLib/__init__.py +++ b/WebHostLib/__init__.py @@ -2,7 +2,6 @@ So unless you're Berserker you need to include license information.""" import os -import threading from pony.flask import Pony from flask import Flask, request, redirect, url_for, render_template, Response, session, abort @@ -24,6 +23,9 @@ def allowed_file(filename): app = Flask(__name__) Pony(app) +app.jinja_env.filters['any'] = any +app.jinja_env.filters['all'] = all + app.config["SELFHOST"] = True app.config["SELFLAUNCH"] = True app.config["DEBUG"] = False diff --git a/WebHostLib/customserver.py b/WebHostLib/customserver.py index e82044a0..4a6ffc36 100644 --- a/WebHostLib/customserver.py +++ b/WebHostLib/customserver.py @@ -26,6 +26,11 @@ class CustomClientMessageProcessor(ClientMessageProcessor): self.ctx.save() self.output(f"Registered Twitch Stream https://www.twitch.tv/{user}") return True + elif platform.lower().startswith("y"): # youtube + self.ctx.video[self.client.team, self.client.slot] = "Youtube", user + self.ctx.save() + self.output(f"Registered Youtube Stream for {user}") + return True return False diff --git a/WebHostLib/templates/tracker.html b/WebHostLib/templates/tracker.html index 64da421a..d352ae0e 100644 --- a/WebHostLib/templates/tracker.html +++ b/WebHostLib/templates/tracker.html @@ -8,8 +8,16 @@ {% endblock %} {% block body %} +
{{ loop.index }} | {% if (team, loop.index) in video %} + {% if video[(team, loop.index)][0] == "Twitch" %}{{ player_names[(team, loop.index)] }} ▶️ | + {% elif video[(team, loop.index)][0] == "Youtube" %} ++ + {{ player_names[(team, loop.index)] }} + ▶️ | + {% endif %} {% else %}{{ player_names[(team, loop.index)] }} | {% endif %}