auto update videojs
This commit is contained in:
parent
9f8a966edb
commit
326c6699d7
@ -1,7 +1,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.12.1/video-js.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video-js.css">
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.12.1/video.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<video class="video-js" data-setup='{}' controls>
|
<video class="video-js" data-setup='{}' controls>
|
||||||
|
11
sources.py
11
sources.py
@ -32,3 +32,14 @@ if playlist is not None:
|
|||||||
|
|
||||||
with open("/app/sources.json", "w+") as f:
|
with open("/app/sources.json", "w+") as f:
|
||||||
f.write(json.dumps(playlist))
|
f.write(json.dumps(playlist))
|
||||||
|
|
||||||
|
videojs_version = None
|
||||||
|
try:
|
||||||
|
resp = requests.get("https://api.cdnjs.com/libraries/video.js?fields=version")
|
||||||
|
data = json.loads(resp.text)
|
||||||
|
videojs_version = data["version"]
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
else:
|
||||||
|
with open("/app/videojs-version.txt", "w") as f:
|
||||||
|
f.write(videojs_version)
|
||||||
|
11
stream.py
11
stream.py
@ -56,6 +56,13 @@ try:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
|
videojs_version = None
|
||||||
|
try:
|
||||||
|
with open("/app/videojs-version.txt", "r") as f:
|
||||||
|
videojs_version = f.read().strip()
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
def get_proxy_url(proxy, current, path):
|
def get_proxy_url(proxy, current, path):
|
||||||
data = {}
|
data = {}
|
||||||
data["upstream"] = urllib.parse.urljoin(current, path)
|
data["upstream"] = urllib.parse.urljoin(current, path)
|
||||||
@ -137,9 +144,9 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
self.write("Stream not found.")
|
self.write("Stream not found.")
|
||||||
|
|
||||||
def handle_render(self, provider, write):
|
def handle_render(self, provider, write):
|
||||||
if template is not None:
|
if template is not None and version is not None:
|
||||||
stream_path = f'{self.request.path}?provider={provider}'
|
stream_path = f'{self.request.path}?provider={provider}'
|
||||||
rendered = template.generate(stream=stream_path)
|
rendered = template.generate(stream=stream_path, videojs_version=videojs_version)
|
||||||
self.write(rendered)
|
self.write(rendered)
|
||||||
else:
|
else:
|
||||||
self.set_status(404)
|
self.set_status(404)
|
||||||
|
Loading…
Reference in New Issue
Block a user