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"]
|
RUN ["mkdir", "-p", "/app/version"]
|
||||||
COPY ["tv.json", "/app/setup/tv.json"]
|
COPY ["tv.json", "/app/setup/tv.json"]
|
||||||
COPY ["backend/start.sh", "/app/start.sh"]
|
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.py", "/app/stream.py"]
|
||||||
COPY ["backend/stream_providers.py", "/app/stream_providers.py"]
|
COPY ["backend/stream_providers.py", "/app/stream_providers.py"]
|
||||||
COPY ["frontend/index.html", "/app/index.html"]
|
COPY ["frontend/index.html", "/app/index.html"]
|
||||||
|
COPY ["frontend/favicon.svg", "/app/favicon.svg"]
|
||||||
COPY ["frontend/script.js", "/app/script.js"]
|
COPY ["frontend/script.js", "/app/script.js"]
|
||||||
COPY ["frontend/style.css", "/app/style.css"]
|
COPY ["frontend/style.css", "/app/style.css"]
|
||||||
RUN ["chmod", "-R", "755", "/app"]
|
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 ["/app/venv/bin/python3", "/app/setup/sources.py"]
|
||||||
RUN ["rm", "-r", "/app/setup"]
|
RUN ["rm", "-r", "/app/setup"]
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=base / /
|
COPY --from=venv / /
|
||||||
USER 1444:1444
|
USER 1444:1444
|
||||||
ENV ICECAST_SERVER=https://icecast.purser.it:7000
|
ENV ICECAST_SERVER=https://icecast.purser.it:7000
|
||||||
ENV STREAM_SERVER=https://stream.purser.it
|
ENV STREAM_SERVER=https://stream.purser.it
|
||||||
|
@ -229,6 +229,7 @@ script_file = None
|
|||||||
videojs_version = None
|
videojs_version = None
|
||||||
font_awesome_version = None
|
font_awesome_version = None
|
||||||
custom_style = None
|
custom_style = None
|
||||||
|
favicon = None
|
||||||
try:
|
try:
|
||||||
with open("/app/index.html", "r") as f:
|
with open("/app/index.html", "r") as f:
|
||||||
template_html = tornado.template.Template(f.read().strip())
|
template_html = tornado.template.Template(f.read().strip())
|
||||||
@ -242,6 +243,8 @@ try:
|
|||||||
chromecast_version = f.read().strip()
|
chromecast_version = f.read().strip()
|
||||||
with open("/app/version/font-awesome.txt", "r") as f:
|
with open("/app/version/font-awesome.txt", "r") as f:
|
||||||
font_awesome_version = f.read().strip()
|
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:
|
with open("/app/style.css", "r") as f:
|
||||||
custom_style_raw = bytes(f.read().strip(), "utf-8")
|
custom_style_raw = bytes(f.read().strip(), "utf-8")
|
||||||
b64 = str(base64.b64encode(custom_style_raw), "ascii")
|
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:
|
if script_file is not None and template_html is not None:
|
||||||
meta = await handler.meta()
|
meta = await handler.meta()
|
||||||
title = handler.render_url
|
title = handler.render_url
|
||||||
video_creator = None
|
|
||||||
video_title = None
|
video_title = None
|
||||||
for elem in meta:
|
for elem in meta:
|
||||||
if isinstance(elem[1], str):
|
if isinstance(elem[1], str):
|
||||||
if elem[0] == "og:title":
|
if elem[0] == "og:title":
|
||||||
video_title = elem[1]
|
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["script"] = script_file
|
||||||
data["videojs_version"] = videojs_version
|
data["videojs_version"] = videojs_version
|
||||||
data["chromecast_version"] = chromecast_version
|
data["chromecast_version"] = chromecast_version
|
||||||
data["font_awesome_version"] = font_awesome_version
|
data["font_awesome_version"] = font_awesome_version
|
||||||
data["custom_style"] = custom_style
|
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)
|
self.write(rendered_html)
|
||||||
else:
|
else:
|
||||||
self.set_status(404)
|
self.set_status(404)
|
||||||
@ -377,11 +371,10 @@ class FileHandler(tornado.web.RequestHandler):
|
|||||||
def get(self):
|
def get(self):
|
||||||
self.set_header("Content-Type", "text/plain; charset=utf-8")
|
self.set_header("Content-Type", "text/plain; charset=utf-8")
|
||||||
self.write(playlist)
|
self.write(playlist)
|
||||||
|
|
||||||
class IconHandler(tornado.web.RequestHandler):
|
class IconHandler(tornado.web.RequestHandler):
|
||||||
def get(self):
|
def get(self):
|
||||||
self.set_header("Content-Type", "text/plain; charset=utf-8")
|
self.set_header("Content-Type", "image/png")
|
||||||
self.set_status(204)
|
self.write(favicon)
|
||||||
try:
|
try:
|
||||||
handlers = []
|
handlers = []
|
||||||
handlers.append((tornado.routing.PathMatches("/sources.m3u8"), FileHandler))
|
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_streamlink(upstream, proxy, logger)))
|
||||||
tasks.append(asyncio.create_task(get_ytdl(upstream, proxy, logger)))
|
tasks.append(asyncio.create_task(get_ytdl(upstream, proxy, logger)))
|
||||||
result = None
|
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
|
result = await task
|
||||||
if isinstance(result, str):
|
if isinstance(result, str):
|
||||||
break
|
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>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<title>{{ title }}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">{% for item in meta %}
|
<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 %}
|
{% 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>
|
<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