add favicon
This commit is contained in:
parent
cabccfa7b5
commit
ef6674b35b
11
Dockerfile
11
Dockerfile
@ -1,4 +1,5 @@
|
||||
FROM roypur/stream-runtime:latest as base
|
||||
FROM alpine:edge as base
|
||||
RUN ["apk", "add", "--no-cache", "inkscape"]
|
||||
RUN ["mkdir", "-p", "/app/version"]
|
||||
COPY ["tv.json", "/app/setup/tv.json"]
|
||||
COPY ["backend/start.sh", "/app/start.sh"]
|
||||
@ -6,14 +7,20 @@ COPY ["backend/sources.py", "/app/setup/sources.py"]
|
||||
COPY ["backend/stream.py", "/app/stream.py"]
|
||||
COPY ["backend/stream_providers.py", "/app/stream_providers.py"]
|
||||
COPY ["frontend/index.html", "/app/index.html"]
|
||||
COPY ["frontend/favicon.svg", "/app/favicon.svg"]
|
||||
COPY ["frontend/script.js", "/app/script.js"]
|
||||
COPY ["frontend/style.css", "/app/style.css"]
|
||||
RUN ["chmod", "-R", "755", "/app"]
|
||||
RUN ["inkscape", "--export-area-page", "--export-width=256", "--export-height=256", "/app/favicon.svg", "--export-filename=/app/favicon.png"]
|
||||
RUN ["rm", "/app/favicon.svg"]
|
||||
|
||||
FROM roypur/stream-runtime:latest as venv
|
||||
COPY --from=base /app /app
|
||||
RUN ["/app/venv/bin/python3", "/app/setup/sources.py"]
|
||||
RUN ["rm", "-r", "/app/setup"]
|
||||
|
||||
FROM scratch
|
||||
COPY --from=base / /
|
||||
COPY --from=venv / /
|
||||
USER 1444:1444
|
||||
ENV ICECAST_SERVER=https://icecast.purser.it:7000
|
||||
ENV STREAM_SERVER=https://stream.purser.it
|
||||
|
@ -229,6 +229,7 @@ script_file = None
|
||||
videojs_version = None
|
||||
font_awesome_version = None
|
||||
custom_style = None
|
||||
favicon = None
|
||||
try:
|
||||
with open("/app/index.html", "r") as f:
|
||||
template_html = tornado.template.Template(f.read().strip())
|
||||
@ -242,6 +243,8 @@ try:
|
||||
chromecast_version = f.read().strip()
|
||||
with open("/app/version/font-awesome.txt", "r") as f:
|
||||
font_awesome_version = f.read().strip()
|
||||
with open("/app/favicon.png", "rb") as f:
|
||||
favicon = f.read()
|
||||
with open("/app/style.css", "r") as f:
|
||||
custom_style_raw = bytes(f.read().strip(), "utf-8")
|
||||
b64 = str(base64.b64encode(custom_style_raw), "ascii")
|
||||
@ -319,27 +322,18 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
if script_file is not None and template_html is not None:
|
||||
meta = await handler.meta()
|
||||
title = handler.render_url
|
||||
video_creator = None
|
||||
video_title = None
|
||||
for elem in meta:
|
||||
if isinstance(elem[1], str):
|
||||
if elem[0] == "og:title":
|
||||
video_title = elem[1]
|
||||
elif elem[0] == "og:description":
|
||||
video_creator = elem[1]
|
||||
|
||||
if isinstance(video_creator, str) and isinstance(video_title, str):
|
||||
title = f'{video_creator}: {video_title}'
|
||||
elif isinstance(video_creator, str):
|
||||
title = video_creator
|
||||
elif isinstance(video_title, str):
|
||||
title = video_title
|
||||
data["script"] = script_file
|
||||
data["videojs_version"] = videojs_version
|
||||
data["chromecast_version"] = chromecast_version
|
||||
data["font_awesome_version"] = font_awesome_version
|
||||
data["custom_style"] = custom_style
|
||||
rendered_html = template_html.generate(data=data, meta=meta)
|
||||
rendered_html = template_html.generate(data=data, meta=meta, title=video_title)
|
||||
self.write(rendered_html)
|
||||
else:
|
||||
self.set_status(404)
|
||||
@ -377,11 +371,10 @@ class FileHandler(tornado.web.RequestHandler):
|
||||
def get(self):
|
||||
self.set_header("Content-Type", "text/plain; charset=utf-8")
|
||||
self.write(playlist)
|
||||
|
||||
class IconHandler(tornado.web.RequestHandler):
|
||||
def get(self):
|
||||
self.set_header("Content-Type", "text/plain; charset=utf-8")
|
||||
self.set_status(204)
|
||||
self.set_header("Content-Type", "image/png")
|
||||
self.write(favicon)
|
||||
try:
|
||||
handlers = []
|
||||
handlers.append((tornado.routing.PathMatches("/sources.m3u8"), FileHandler))
|
||||
|
@ -91,7 +91,7 @@ async def get_any(upstream, proxy, logger):
|
||||
tasks.append(asyncio.create_task(get_streamlink(upstream, proxy, logger)))
|
||||
tasks.append(asyncio.create_task(get_ytdl(upstream, proxy, logger)))
|
||||
result = None
|
||||
for task in asyncio.as_completed(tasks, timeout=2.0):
|
||||
for task in asyncio.as_completed(tasks, timeout=5.0):
|
||||
result = await task
|
||||
if isinstance(result, str):
|
||||
break
|
||||
|
3
frontend/favicon-basic.svg
Normal file
3
frontend/favicon-basic.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg height="100" width="100">
|
||||
<polygon points="7,0 7,100 93,50" fill="darkgreen" />
|
||||
</svg>
|
After Width: | Height: | Size: 96 B |
4
frontend/favicon.svg
Normal file
4
frontend/favicon.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg height="100" width="100">
|
||||
<circle cx="50" cy="50" r="50" fill="black" />
|
||||
<polygon points="30,20 30,80 85,50" fill="limegreen" />
|
||||
</svg>
|
After Width: | Height: | Size: 149 B |
@ -1,5 +1,6 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ title }}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">{% for item in meta %}
|
||||
{% block item %}<meta property="{{ item[0] }}" content="{{ item[1] }}" />{% end %}{% end %}
|
||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ data["videojs_version"] }}/video.min.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user