Init
This commit is contained in:
commit
39073d8f3a
15 changed files with 297 additions and 0 deletions
5
snapcast/data/Radios.m3u8.gtpl
Normal file
5
snapcast/data/Radios.m3u8.gtpl
Normal file
|
@ -0,0 +1,5 @@
|
|||
#EXTM3U
|
||||
{{- range fromJson .radios}}
|
||||
#EXTINF:-1,{{.name}}
|
||||
{{.url}}
|
||||
{{- end}}
|
18
snapcast/data/config.js
Normal file
18
snapcast/data/config.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
let base_url = window.location.pathname.replace(/\/$/, '');
|
||||
|
||||
let config = {
|
||||
baseUrl: (window.location.protocol === 'https:' ? 'wss://' : 'ws://') + window.location.host + base_url,
|
||||
};
|
||||
|
||||
|
||||
window.addEventListener("DOMContentLoaded", (event) => {
|
||||
let mopidy_link = document.createElement('a');
|
||||
//mopidy_link.href = window.location.protocol + '//' + window.location.host + base_url + '/mobile/';
|
||||
mopidy_link.href = window.location.protocol + '//' + window.location.hostname + ':6680/mobile/';
|
||||
mopidy_link.target = '_blank';
|
||||
mopidy_link.innerHTML = 'Mopidy';
|
||||
|
||||
document.getElementById('show').parentNode.appendChild(mopidy_link);
|
||||
});
|
9
snapcast/data/mopidy-extra.conf
Normal file
9
snapcast/data/mopidy-extra.conf
Normal file
|
@ -0,0 +1,9 @@
|
|||
[audio]
|
||||
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! tcpclientsink host=127.0.0.1 port=4953
|
||||
|
||||
[http]
|
||||
enabled = true
|
||||
hostname = 0.0.0.0
|
||||
port = 6680
|
||||
csrf_protection = true
|
||||
default_app = mobile
|
39
snapcast/data/nginx-site.gtpl
Normal file
39
snapcast/data/nginx-site.gtpl
Normal file
|
@ -0,0 +1,39 @@
|
|||
server {
|
||||
listen {{ .interface }}:8099 default_server;
|
||||
|
||||
allow 172.30.32.2;
|
||||
deny all;
|
||||
|
||||
absolute_redirect off;
|
||||
|
||||
location /mobile/ {
|
||||
if ($request_uri ~ ^([^.\?]*[^/])$) {
|
||||
return 301 {{ .entry }}$1/;
|
||||
}
|
||||
|
||||
proxy_pass http://localhost:6680;
|
||||
|
||||
sub_filter_once off;
|
||||
sub_filter_types *;
|
||||
sub_filter '/mobile/' '{{ .entry }}/mobile/';
|
||||
sub_filter '/mopidy/ws' '{{ .entry }}/mopidy/ws';
|
||||
}
|
||||
location /mopidy/ws {
|
||||
proxy_pass http://localhost:6680;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:1780;
|
||||
}
|
||||
location ~ ^/(jsonrpc|stream) {
|
||||
proxy_pass http://localhost:1780;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
}
|
20
snapcast/data/run.sh
Normal file
20
snapcast/data/run.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
_librespot_username=$(bashio::config 'spotify_username')
|
||||
export LIBRESPOT_USERNAME="$_librespot_username"
|
||||
_librespot_password=$(bashio::config 'spotify_password')
|
||||
export LIBRESPOT_PASSWORD="$_librespot_password"
|
||||
|
||||
bashio::var.json \
|
||||
interface "$(bashio::addon.ip_address)" \
|
||||
entry "$(bashio::addon.ingress_entry)" \
|
||||
| tempio \
|
||||
-template "/templates/nginx-site.gtpl" \
|
||||
-out "/etc/nginx/http.d/default.conf"
|
||||
|
||||
bashio::var.json radios "$(bashio::config 'radios' | jq -cMs .)" \
|
||||
| tempio \
|
||||
-template "/templates/Radios.m3u8.gtpl" \
|
||||
-out "/var/lib/mopidy/playlists/Radios.m3u8"
|
||||
|
||||
supervisord -c /etc/supervisord.conf
|
14
snapcast/data/snapserver.conf
Normal file
14
snapcast/data/snapserver.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
[stream]
|
||||
source = pipe:///tmp/snapfifo?name=Default
|
||||
source = tcp://127.0.0.1:4953?name=Mopidy
|
||||
#source = librespot:///usr/bin/librespot?name=Spotify&devicename=Snapcast&autoplay=true&volume=90
|
||||
source = pipe:///tmp/snapfifo_librespot?name=Spotify&sampleformat=44100:16:2
|
||||
|
||||
[logging]
|
||||
filter = debug
|
||||
|
||||
[http]
|
||||
doc_root = /usr/share/snapserver/snapweb/
|
||||
|
||||
[streaming_client]
|
||||
initial_volume = 10
|
58
snapcast/data/supervisord.conf
Normal file
58
snapcast/data/supervisord.conf
Normal file
|
@ -0,0 +1,58 @@
|
|||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/dev/null
|
||||
logfile_maxbytes=0
|
||||
pidfile=/run/supervisord.pid
|
||||
user=root
|
||||
|
||||
[program:nginx]
|
||||
command=nginx
|
||||
priority=1
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
|
||||
redirect_stderr=true
|
||||
killasgroup=true
|
||||
stopasgroup=true
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
|
||||
[program:snapcast-server]
|
||||
command=snapserver
|
||||
priority=1
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
|
||||
redirect_stderr=true
|
||||
killasgroup=true
|
||||
stopasgroup=true
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
|
||||
[program:mopidy]
|
||||
command=mopidy --config /etc/mopidy/
|
||||
priority=1
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
|
||||
redirect_stderr=true
|
||||
killasgroup=true
|
||||
stopasgroup=true
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
|
||||
[program:librespot]
|
||||
command=librespot
|
||||
priority=1
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
|
||||
redirect_stderr=true
|
||||
killasgroup=true
|
||||
stopasgroup=true
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
Loading…
Add table
Add a link
Reference in a new issue