From 18c2603789f429bde232771bedcc0048e39e3315 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 27 Nov 2017 11:02:16 +0000 Subject: [PATCH] Set maximum number of icecast clients --- src/freedombone-app-icecast | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/freedombone-app-icecast b/src/freedombone-app-icecast index 81a57183..e579422d 100755 --- a/src/freedombone-app-icecast +++ b/src/freedombone-app-icecast @@ -372,6 +372,32 @@ function icecast_set_stream_name { start_icecast } +function icecast_set_maximum_streams { + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 + dialog --title $"Set the maximum clients" \ + --backtitle $"Freedombone Control Panel" \ + --inputbox $"Maximum number of clients" 8 40 "10" 2>$data + sel=$? + case $sel in + 0) + max_clients=$(<$data) + if [ ${#max_clients} -gt 0 ]; then + if [[ "$max_clients" != *' '* ]]; then + if [[ $max_clients =~ '^[0-9]+$' ]] ; then + sed -i "s|.*|${max_clients}|g" /etc/icecast2/icecast.xml + stop_icecast + start_icecast + dialog --title $"Set the maximum clients" \ + --msgbox $"\nMaximum Icecast clients was set to ${max_clients}" 8 50 + fi + fi + fi + ;; + esac + rm $data +} + function configure_interactive_icecast { while true do @@ -379,7 +405,7 @@ function configure_interactive_icecast { trap "rm -f $data" 0 1 2 5 15 dialog --backtitle $"Freedombone Control Panel" \ --title $"Icecast" \ - --radiolist $"Choose an operation:" 18 70 11 \ + --radiolist $"Choose an operation:" 19 70 12 \ 1 $"Import stream files from directory" off \ 2 $"Import stream files from USB drive" off \ 3 $"Manually edit playlist" off \ @@ -390,7 +416,8 @@ function configure_interactive_icecast { 8 $"Re-scan playlist" off \ 9 $"Restart stream" off \ 10 $"Set Stream Name/Description/Genre" off \ - 11 $"Exit" on 2> $data + 11 $"Set maximum number of clients/streams" off \ + 12 $"Exit" on 2> $data sel=$? case $sel in 1) break;; @@ -412,7 +439,8 @@ function configure_interactive_icecast { stop_icecast start_icecast;; 10) icecast_set_stream_name;; - 11) break;; + 11) icecast_set_maximum_streams;; + 12) break;; esac done }