Empty playlist now reflects on timeline, fix file sync CA path
This commit is contained in:
parent
f4682a5640
commit
703083fa66
12
app.py
12
app.py
|
@ -85,7 +85,6 @@ def isup(host_l, port):
|
|||
import socket
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
if useSSL:
|
||||
#sslcontext = ssl.create_default_context(cafile=host_l + ".crt")
|
||||
sslcontext = ssl.create_default_context()
|
||||
if os.path.exists(CAfile):
|
||||
sslcontext.load_verify_locations(cafile=CAfile)
|
||||
|
@ -101,7 +100,7 @@ def isup(host_l, port):
|
|||
return 1
|
||||
except (socket.error, socket.timeout) as e:
|
||||
if DEBUG:
|
||||
print("Error on connect to " + host_l + ": %s" % e)
|
||||
print("Error on connect to " + host_l + ":" + str(port) + ": %s" % e)
|
||||
return 0
|
||||
finally:
|
||||
s.close()
|
||||
|
@ -136,8 +135,7 @@ def httpUpload(filename, hostl, trailing_slash=1):
|
|||
filename = "/" + filename
|
||||
files = { "file":( filename, open( media_folder_local + filename, "rb"), "multipart/form-data") }
|
||||
print(files)
|
||||
# ~ resp = requests.post(url, files=files, auth=('', auth ), verify=hostl + ".crt")
|
||||
resp = requests.post(url, files=files, headers=headers, verify=hostl + ".crt")
|
||||
resp = requests.post(url, files=files, headers=headers, verify=CAfile)
|
||||
print(resp.text)
|
||||
if resp.ok:
|
||||
return 1
|
||||
|
@ -203,7 +201,6 @@ def sec2min(duration):
|
|||
# VLC lua utilities
|
||||
|
||||
def sendCommand(host, arg0, arg1, arg2):
|
||||
#conn = http.client.HTTPConnection( host + ":" + str(port), timeout=3 )
|
||||
portl = port
|
||||
# Build request
|
||||
req = "/requests/status.xml"
|
||||
|
@ -233,20 +230,16 @@ def sendCommand(host, arg0, arg1, arg2):
|
|||
req = req + "&input=file://" + media_folder_remote + "/" + arg1
|
||||
# Send request
|
||||
if useSSL:
|
||||
#sslcontext = ssl.create_default_context(cafile=host_l + ".crt")
|
||||
sslcontext = ssl.create_default_context()
|
||||
if os.path.exists(CAfile):
|
||||
sslcontext.load_verify_locations(cafile=CAfile)
|
||||
else:
|
||||
sslcontext.check_hostname = False
|
||||
sslcontext.verify_mode = ssl.CERT_NONE
|
||||
# ~ if useSSL:
|
||||
# ~ sslcontext = ssl.create_default_context(cafile=host + ".crt")
|
||||
conn = http.client.HTTPSConnection( host + ":" + str(portl), timeout=3, context = sslcontext )
|
||||
else:
|
||||
conn = http.client.HTTPConnection( host + ":" + str(portl), timeout=3 )
|
||||
try:
|
||||
# ~ conn.request( "GET", req, headers={"Authorization":"Basic " + auth} )
|
||||
conn.request( "GET", req, headers = headers )
|
||||
except:
|
||||
return "Connection to " + host + " was refused on port " + str(portl)
|
||||
|
@ -366,7 +359,6 @@ def sync(host):
|
|||
def action(host, arg0, arg1, arg2):
|
||||
status_message = "Idle"
|
||||
if arg0 not in cmd:
|
||||
# ~ return "<p>Wrong command</p>"
|
||||
status_message = "<p>Wrong command</p>"
|
||||
elif host == "all":
|
||||
resp = []
|
||||
|
|
|
@ -6,7 +6,29 @@ services: # add
|
|||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "8080:8080"
|
||||
command: "sh -c 'pip install -r requirements.txt && python app.py'"
|
||||
- "8887:8887"
|
||||
- "8888:8888"
|
||||
#~ command: "sh -c 'sleep 3600'"
|
||||
command: "sh -c 'pip install -r requirements.txt && sleep 3600'"
|
||||
volumes:
|
||||
- .:/app
|
||||
- ../medias:/medias
|
||||
networks:
|
||||
- dockervlan
|
||||
|
||||
networks:
|
||||
dockervlan:
|
||||
name: dockervlan
|
||||
driver: macvlan
|
||||
driver_opts:
|
||||
parent: wlo1
|
||||
ipam:
|
||||
config:
|
||||
- subnet: "10.42.0.1/24"
|
||||
ip_range: "10.42.0.1/26"
|
||||
gateway: "10.42.0.1"
|
||||
#~ docker network create -d macvlan \
|
||||
#~ --subnet=10.42.0.1/24 \
|
||||
#~ --gateway=10.42.0.1 \
|
||||
#~ -o parent=wlo1 \
|
||||
#~ vpi-macvlan-net
|
|
@ -129,7 +129,7 @@ addEventListener("DOMContentLoaded", function() {
|
|||
// On recupere la valeur de value="" sur le bouton
|
||||
var clickedButton = event.currentTarget;
|
||||
var command = clickedButton.value;
|
||||
if (( command == "/10.42.0.135/reboot" ) || ( command == "/10.42.0.135/poweroff" )) {
|
||||
if ( command.indexOf("/reboot" ) > -1 || command.indexOf("/poweroff") > -1 ) {
|
||||
if ( !confirm("Êtes vous certain de vouloir effectuer cette action ?") ) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -202,6 +202,14 @@ function parseResult(command, infos_array) {
|
|||
document.getElementById("playlist_"+infos_array[i].host).innerHTML = infos_array[i].leng + " item(s) in playlist - " + infos_array[i].duration;
|
||||
// Build html table and timeline
|
||||
var items_array = Array.from(infos_array[i].items);
|
||||
console.log(items_array.length);
|
||||
if (items_array.length == 0){
|
||||
var child_list = Array.from(document.getElementById("timeline").children);
|
||||
for(i=0,l=child_list.length;i<l;i++){
|
||||
document.getElementById("timeline").removeChild(child_list[i]);
|
||||
};
|
||||
break;
|
||||
}
|
||||
var html_table = "<table>" +
|
||||
"<tr>" +
|
||||
"<th>Id</th>" +
|
||||
|
@ -224,7 +232,9 @@ function parseResult(command, infos_array) {
|
|||
document.getElementById("timeline").appendChild( addElement("div", tl_cont_attr, 0, len) );
|
||||
}
|
||||
document.getElementById(tl_cont_attr.id + j).replaceChildren(child_node);
|
||||
// Adjust elements width
|
||||
adjustTl();
|
||||
// Highlight currently playing element
|
||||
if (item_meta[3] != ""){
|
||||
document.getElementById(tl_cont_attr.id + j).children[0].style.borderBottom = "4px solid " + timeline_color_cursor;
|
||||
document.getElementById(tl_cont_attr.id + j).children[0].style.fontWeight = "bold";
|
||||
|
|
Loading…
Reference in New Issue