Add VLC add-on (#1862)

* Add VLC add-on

* remove armhf support
This commit is contained in:
Pascal Vizeli
2021-02-16 17:49:06 +01:00
committed by GitHub
parent dc2ae4d4b3
commit 9fd88b5e35
16 changed files with 229 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Prepair VLC for ingress access
# ==============================================================================
# Generate NGINX config
bashio::var.json \
supervisor_ip "$(getent hosts supervisor | awk '{ print $1 }' | head -1)" \
| tempio \
-template /usr/share/tempio/nginx.conf \
-out /etc/nginx/nginx.conf

View File

@@ -0,0 +1,11 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Create VLC secret
# ==============================================================================
if bashio::fs.file_exists /data/secret; then
bashio::exit.ok
fi
# Generate password
pwgen 64 1 > /data/secret

View File

@@ -0,0 +1,8 @@
#!/usr/bin/execlineb -S1
# ==============================================================================
# Take down the S6 supervision tree based on service exit code
# ==============================================================================
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bashio
# ==============================================================================
# Start NGINX service
# ==============================================================================
exec nginx

View File

@@ -0,0 +1,19 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Send vlc_telnet discovery information to Home Assistant
# ==============================================================================
declare ha_config
# Prepare discovery payload
ha_config=$(\
bashio::var.json \
host "$(hostname)" \
port "^3000" \
password "$(cat /data/secret)" \
)
if bashio::discovery "vlc_telnet" "${ha_config}" > /dev/null; then
bashio::log.info "Successfully send discovery information to Home Assistant."
else
bashio::log.error "Discovery message to Home Assistant failed!"
fi

View File

@@ -0,0 +1,8 @@
#!/usr/bin/execlineb -S1
# ==============================================================================
# Take down the S6 supervision tree when Z-Wave JS fails
# ==============================================================================
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -0,0 +1,11 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Start Z-Wave JS service for Z-Wave radio
# ==============================================================================
readonly PASSWORD="$(cat /data/secret)"
# Send out discovery information to Home Assistant
./discovery &
# Run daemon
exec cvlc -I http --extraintf telnet --http-host 127.0.0.1 --http-password "INGRESS" --telnet-password "${PASSWORD}" --aout=pulse

View File

@@ -0,0 +1,55 @@
worker_processes 1;
pid /var/run/nginx.pid;
error_log /dev/stdout info;
daemon off;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
proxy_read_timeout 1200;
gzip on;
gzip_disable "msie6";
upstream backend {
ip_hash;
server 127.0.0.1:8080;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# Ingress
server {
listen 8099 default_server;
listen [::]:8099 default_server;
allow {{ .supervisor_ip }};
deny all;
server_name _;
access_log /dev/stdout combined;
client_max_body_size 4G;
keepalive_timeout 5;
root /dev/null;
location / {
proxy_redirect off;
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Authorization "Basic OklOR1JFU1M=";
}
}
}