forked from server/soundboard
Revert "add images"
This reverts commit f570309d9cc64b761aa2354da885be9cdf8d1b42.
This commit is contained in:
parent
a1b9dd39c6
commit
577e625a51
@ -4,4 +4,3 @@ itsdangerous==0.24
|
|||||||
Jinja2==2.9.6
|
Jinja2==2.9.6
|
||||||
MarkupSafe==1.0
|
MarkupSafe==1.0
|
||||||
Werkzeug==0.12.2
|
Werkzeug==0.12.2
|
||||||
requests
|
|
||||||
@ -1,9 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
|
||||||
|
|
||||||
import requests
|
|
||||||
from flask import Flask, render_template, request, redirect, url_for, send_from_directory
|
from flask import Flask, render_template, request, redirect, url_for, send_from_directory
|
||||||
|
|
||||||
import config
|
import config
|
||||||
@ -56,19 +53,3 @@ def index(sound=None, text=None, video=None):
|
|||||||
@app.route("/sounds/<path:name>")
|
@app.route("/sounds/<path:name>")
|
||||||
def sounds(name):
|
def sounds(name):
|
||||||
return send_from_directory(config.path, name)
|
return send_from_directory(config.path, name)
|
||||||
|
|
||||||
@app.route("/image/")
|
|
||||||
def image(imageurl=None):
|
|
||||||
if not imageurl:
|
|
||||||
return False
|
|
||||||
with tempfile.NamedTemporaryFile(mode="wb", buffering=True) as tmp:
|
|
||||||
image = requests.get(imageurl, stream=True)
|
|
||||||
if not image.ok:
|
|
||||||
return False
|
|
||||||
shutil.copyfileobj(image.raw, tmp)
|
|
||||||
subprocess.Popen(["killall", "pngview"])
|
|
||||||
subprocess.Popen(["/opt/raspidmx/pngview/pngview", "-b", "0", "-d", "0", "-n", tmp.name])
|
|
||||||
|
|
||||||
@app.route("/kill/images")
|
|
||||||
def killImages():
|
|
||||||
subprocess.Popen(["killall", "pngview"])
|
|
||||||
|
|||||||
@ -197,20 +197,3 @@ function killAllAudio() {
|
|||||||
ajaxRequest("/?killvideo=yes");
|
ajaxRequest("/?killvideo=yes");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reads the stream url from input with id #streaming-url and forwards it to the server using AJAX.
|
|
||||||
*/
|
|
||||||
function showImage() {
|
|
||||||
var streamUrl = document.querySelector("#streaming-url").value;
|
|
||||||
ajaxRequest("/image/?imageurl="+encodeURI(streamUrl));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Kills all images
|
|
||||||
*/
|
|
||||||
function killAllImages() {
|
|
||||||
ajaxRequest("/kill/images");
|
|
||||||
}
|
|
||||||
|
|||||||
@ -33,7 +33,6 @@
|
|||||||
<a href="#sounds" id="sounds-nav">Sounds</a>
|
<a href="#sounds" id="sounds-nav">Sounds</a>
|
||||||
<a href="#streams">Streams</a>
|
<a href="#streams">Streams</a>
|
||||||
<a href="#voice">Voices</a>
|
<a href="#voice">Voices</a>
|
||||||
<a href="#image">Images</a>
|
|
||||||
</nav>
|
</nav>
|
||||||
<content>
|
<content>
|
||||||
<section id="sounds" style="display:none;">
|
<section id="sounds" style="display:none;">
|
||||||
@ -67,16 +66,6 @@
|
|||||||
<input type="submit" value="Voice" />
|
<input type="submit" value="Voice" />
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
<section id="images" style="display:none;">
|
|
||||||
<div>
|
|
||||||
<form>
|
|
||||||
<label for="image">Image URL</label>
|
|
||||||
<input id="streaming-url" type="text" name="image" placeholder="paste image url here..." />
|
|
||||||
</form>
|
|
||||||
<button onclick="showImage();">Play!</button>
|
|
||||||
</div>
|
|
||||||
<button name="submit" onclick="killAllImages();">clear images</button>
|
|
||||||
</section>
|
|
||||||
</content>
|
</content>
|
||||||
<script src="/static/howler.js"></script>
|
<script src="/static/howler.js"></script>
|
||||||
<script src="/static/main.js"></script>
|
<script src="/static/main.js"></script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user