Commit e32b64ec authored by ale's avatar ale

Configure all mounts to fall back to silence

Unless an explicit fallback is configured. Untested.
parent a4b78e24
...@@ -12,6 +12,11 @@ override_dh_auto_install: ...@@ -12,6 +12,11 @@ override_dh_auto_install:
dh_auto_install dh_auto_install
$(RM) -rv $(DESTDIR)/usr/share/gocode $(RM) -rv $(DESTDIR)/usr/share/gocode
# Install our silent snippets to the Icecast web dir.
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/icecast2/web
(for f in silence.ogg silence.mp3; do \
install -m 644 -o root -g root $$f $(DESTDIR)/usr/share/icecast2/web/$$f; done)
override_dh_installinit: override_dh_installinit:
dh_installinit --name=autoradio dh_installinit --name=autoradio
......
...@@ -9,6 +9,7 @@ import ( ...@@ -9,6 +9,7 @@ import (
"net" "net"
"net/url" "net/url"
"os" "os"
"path/filepath"
"git.autistici.org/ale/autoradio" "git.autistici.org/ale/autoradio"
pb "git.autistici.org/ale/autoradio/proto" pb "git.autistici.org/ale/autoradio/proto"
...@@ -262,15 +263,26 @@ func slaveMountConfig(m *pb.Mount, masterAddr string) (*iceRelayConfig, error) { ...@@ -262,15 +263,26 @@ func slaveMountConfig(m *pb.Mount, masterAddr string) (*iceRelayConfig, error) {
func masterMountConfig(m *pb.Mount) *iceMountConfig { func masterMountConfig(m *pb.Mount) *iceMountConfig {
mc := iceMountConfig{ mc := iceMountConfig{
Name: autoradio.MountPathToIcecastPath(m.Path), Name: autoradio.MountPathToIcecastPath(m.Path),
Username: m.SourceUsername, Username: m.SourceUsername,
Password: m.SourcePassword, Password: m.SourcePassword,
FallbackOverride: 1,
// MaxListeners: 1000, // MaxListeners: 1000,
// NoYp: 1, // NoYp: 1,
} }
if m.FallbackPath != "" {
// When no explicit fallback URL is specified, use the locally
// installed silence audo file. In order to serve the right
// format, we guess the file extension for the silence
// fallback by looking at the extension of the mount itself.
switch {
case m.FallbackPath != "":
mc.FallbackMount = m.FallbackPath mc.FallbackMount = m.FallbackPath
mc.FallbackOverride = 1 case filepath.Ext(m.Path) == ".ogg":
mc.FallbackMount = "/silence.ogg"
default:
mc.FallbackMount = "/silence.mp3"
} }
return &mc return &mc
} }
File added
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment