From 32ca75ff8e5fdaa1f335f034b3e73a401d01c08c Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 15 Jan 2015 12:52:48 +0000
Subject: [PATCH] include source username in the liquidsoap configuration

---
 node/liquidsoap.go      | 4 +++-
 node/liquidsoap_test.go | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/node/liquidsoap.go b/node/liquidsoap.go
index b24595c2..6298c06b 100644
--- a/node/liquidsoap.go
+++ b/node/liquidsoap.go
@@ -25,7 +25,7 @@ set("log.stdout", true)
 
 upstream = mksafe(input.http("{{.SourceURL}}", buffer=5.0))
 output.icecast(%{{.Format}}(samplerate={{.SampleRate}}, {{if gt .BitRate 0}}bitrate={{.BitRate}}, {{end}}{{if gt .Quality 0.0}}quality={{.Quality}}, {{end}}{{if eq .Channels 2}}stereo{{else}}mono{{end}}),
-  mount="{{.TargetMount}}", host="{{.TargetIP}}", port={{.TargetPort}}, password="{{.TargetPassword}}",
+  mount="{{.TargetMount}}", host="{{.TargetIP}}", port={{.TargetPort}}, user="{{.TargetUsername}}", password="{{.TargetPassword}}",
   upstream)
 `
 
@@ -41,6 +41,7 @@ type liquidsoapParams struct {
 	TargetIP       string
 	TargetPort     int
 	TargetMount    string
+	TargetUsername string
 	TargetPassword string
 
 	// Stream encoding parameters. One note on the 'float32'
@@ -62,6 +63,7 @@ func newLiquidsoapParams(mount *autoradio.Mount) *liquidsoapParams {
 		TargetIP:       "localhost",
 		TargetPort:     80,
 		TargetMount:    mount.Name,
+		TargetUsername: mount.Username,
 		TargetPassword: mount.Password,
 		Format:         mount.Transcoding.Format,
 		BitRate:        mount.Transcoding.BitRate,
diff --git a/node/liquidsoap_test.go b/node/liquidsoap_test.go
index 58db3684..d78742f5 100644
--- a/node/liquidsoap_test.go
+++ b/node/liquidsoap_test.go
@@ -16,6 +16,7 @@ var testParams = &liquidsoapParams{
 	TargetIP:       "localhost",
 	TargetPort:     80,
 	TargetMount:    "/stream.mp3",
+	TargetUsername: "sourceuser",
 	TargetPassword: "password",
 	Format:         "mp3",
 	BitRate:        64,
-- 
GitLab