WebHost: Add youtube livestreaming and autogenerated multistream link
This commit is contained in:
parent
aacd5b4063
commit
5cd5223ae0
|
@ -49,7 +49,7 @@ def mystery_argparse():
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
def main(args=None):
|
def main(args=None, callback = ERmain):
|
||||||
if not args:
|
if not args:
|
||||||
args = mystery_argparse()
|
args = mystery_argparse()
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ def main(args=None):
|
||||||
erargs.skip_progression_balancing = {player: not balanced for player, balanced in
|
erargs.skip_progression_balancing = {player: not balanced for player, balanced in
|
||||||
erargs.progression_balancing.items()}
|
erargs.progression_balancing.items()}
|
||||||
del (erargs.progression_balancing)
|
del (erargs.progression_balancing)
|
||||||
ERmain(erargs, seed)
|
callback(erargs, seed)
|
||||||
|
|
||||||
|
|
||||||
def get_weights(path):
|
def get_weights(path):
|
||||||
|
|
12
Patch.py
12
Patch.py
|
@ -125,16 +125,22 @@ if __name__ == "__main__":
|
||||||
Utils.persistent_store("servers", data['hash'], data['server'])
|
Utils.persistent_store("servers", data['hash'], data['server'])
|
||||||
print(f"Host is {data['server']}")
|
print(f"Host is {data['server']}")
|
||||||
|
|
||||||
elif rom.endswith("_multidata"):
|
elif rom.endswith("multidata"):
|
||||||
import json
|
import json
|
||||||
import zlib
|
import zlib
|
||||||
with open(rom, 'rb') as fr:
|
with open(rom, 'rb') as fr:
|
||||||
|
|
||||||
multidata = zlib.decompress(fr.read()).decode("utf-8")
|
multidata = zlib.decompress(fr.read()).decode("utf-8")
|
||||||
with open(rom + '.txt', 'w') as fw:
|
with open(rom + '.txt', 'w') as fw:
|
||||||
fw.write(multidata)
|
fw.write(multidata)
|
||||||
multidata = json.loads(multidata)
|
multidata = json.loads(multidata)
|
||||||
for rom in multidata['roms']:
|
for romname in multidata['roms']:
|
||||||
Utils.persistent_store("servers", "".join(chr(byte) for byte in rom[2]), address)
|
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"):
|
elif rom.endswith(".zip"):
|
||||||
print(f"Updating host in patch files contained in {rom}")
|
print(f"Updating host in patch files contained in {rom}")
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
So unless you're Berserker you need to include license information."""
|
So unless you're Berserker you need to include license information."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import threading
|
|
||||||
|
|
||||||
from pony.flask import Pony
|
from pony.flask import Pony
|
||||||
from flask import Flask, request, redirect, url_for, render_template, Response, session, abort
|
from flask import Flask, request, redirect, url_for, render_template, Response, session, abort
|
||||||
|
@ -24,6 +23,9 @@ def allowed_file(filename):
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
Pony(app)
|
Pony(app)
|
||||||
|
|
||||||
|
app.jinja_env.filters['any'] = any
|
||||||
|
app.jinja_env.filters['all'] = all
|
||||||
|
|
||||||
app.config["SELFHOST"] = True
|
app.config["SELFHOST"] = True
|
||||||
app.config["SELFLAUNCH"] = True
|
app.config["SELFLAUNCH"] = True
|
||||||
app.config["DEBUG"] = False
|
app.config["DEBUG"] = False
|
||||||
|
|
|
@ -26,6 +26,11 @@ class CustomClientMessageProcessor(ClientMessageProcessor):
|
||||||
self.ctx.save()
|
self.ctx.save()
|
||||||
self.output(f"Registered Twitch Stream https://www.twitch.tv/{user}")
|
self.output(f"Registered Twitch Stream https://www.twitch.tv/{user}")
|
||||||
return True
|
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
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,16 @@
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
||||||
<div id="tracker-wrapper" data-tracker="{{ room.tracker }}">
|
<div id="tracker-wrapper" data-tracker="{{ room.tracker }}">
|
||||||
|
<div id="tracker-header-bar">
|
||||||
<input placeholder="Search" id="search" />
|
<input placeholder="Search" id="search" />
|
||||||
|
{% if video %}<span><a target="_blank" href="https://multistream.me/
|
||||||
|
{%- for teamslot, (platform, link) in video.items()-%}
|
||||||
|
{%- if platform == "Twitch" -%}t{%- else -%}yt{%- endif -%}:{{ link }}/">Multistream</a></span>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
{% for team, players in inventory.items() %}
|
{% for team, players in inventory.items() %}
|
||||||
<div class="table-wrapper">
|
<div class="table-wrapper">
|
||||||
<table class="table unique-item-table">
|
<table class="table unique-item-table">
|
||||||
|
@ -33,10 +41,17 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ loop.index }}</td>
|
<td>{{ loop.index }}</td>
|
||||||
{% if (team, loop.index) in video %}
|
{% if (team, loop.index) in video %}
|
||||||
|
{% if video[(team, loop.index)][0] == "Twitch" %}
|
||||||
<td>
|
<td>
|
||||||
<a target="_blank" href="https://www.twitch.tv/{{ video[(team, loop.index)][1] }}">
|
<a target="_blank" href="https://www.twitch.tv/{{ video[(team, loop.index)][1] }}">
|
||||||
{{ player_names[(team, loop.index)] }}
|
{{ player_names[(team, loop.index)] }}
|
||||||
▶️</a></td>
|
▶️</a></td>
|
||||||
|
{% elif video[(team, loop.index)][0] == "Youtube" %}
|
||||||
|
<td>
|
||||||
|
<a target="_blank" href="youtube.com/c/{{ video[(team, loop.index)][1] }}/live">
|
||||||
|
{{ player_names[(team, loop.index)] }}
|
||||||
|
▶️</a></td>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<td>{{ player_names[(team, loop.index)] }}</td>
|
<td>{{ player_names[(team, loop.index)] }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue