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

5
vlc/CHANGELOG.md Normal file
View File

@@ -0,0 +1,5 @@
# Changelog
## 0.1.0
- Inital release

40
vlc/DOCS.md Normal file
View File

@@ -0,0 +1,40 @@
# Home Assistant Add-on: VLC
## Installation
Follow these steps to get the add-on installed on your system:
1. Navigate in your Home Assistant frontend to **Supervisor** -> **Add-on Store**.
2. Find the "VLC" add-on and click it.
3. Click on the "INSTALL" button.
## How to use
1. Start the add-on.
2. Add the VLC Telnet integration to Home Assistant, see documentation:
<https://www.home-assistant.io/integrations/vlc_telnet>
## Configuration
Add-on configuration:
```yaml
```
## Support
Got questions?
You have several options to get them answered:
- The [Home Assistant Discord Chat Server][discord].
- The Home Assistant [Community Forum][forum].
- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]
In case you've found a bug, please [open an issue on our GitHub][issue].
[discord]: https://discord.gg/c5DvZ4e
[forum]: https://community.home-assistant.io
[issue]: https://github.com/home-assistant/hassio-addons/issues
[reddit]: https://reddit.com/r/homeassistant

16
vlc/Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
ARG BUILD_FROM
FROM ${BUILD_FROM}
# Install Z-Wave JS
WORKDIR /usr/src
RUN \
set -x \
&& apk add --no-cache \
nginx \
pwgen \
vlc \
&& sed -i 's/geteuid/getppid/' /usr/bin/vlc \
&& sed -i '197s#.*# dir = dir == undefined ? "file:///media" : dir;#' /usr/share/vlc/lua/http/js/controllers.js
WORKDIR /
COPY rootfs /

12
vlc/README.md Normal file
View File

@@ -0,0 +1,12 @@
# Home Assistant Add-on: VLC
Allow Home Assistant to use your local device as Media Player.
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield]
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg

8
vlc/build.json Normal file
View File

@@ -0,0 +1,8 @@
{
"build_from": {
"amd64": "homeassistant/amd64-base:3.13",
"i386": "homeassistant/i386-base:3.13",
"armv7": "homeassistant/armv7-base:3.13",
"aarch64": "homeassistant/aarch64-base:3.13"
}
}

20
vlc/config.json Normal file
View File

@@ -0,0 +1,20 @@
{
"name": "VLC",
"version": "0.1.0",
"slug": "vlc",
"description": "Turn you device into a Media Player with VLC",
"arch": ["amd64", "i386", "armv7", "aarch64"],
"url": "https://github.com/home-assistant/hassio-addons/tree/master/vlc",
"startup": "services",
"init": false,
"stage": "experimental",
"map": ["share:ro", "media:ro"],
"homeassistant": "2021.3.0.dev20210216",
"ingress": true,
"panel_icon": "mdi:vlc",
"discovery": ["vlc_telnet"],
"audio": true,
"options": {},
"schema": false,
"image": "homeassistant/{arch}-addon-vlc"
}

BIN
vlc/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
vlc/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

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=";
}
}
}