Set maximum number of icecast clients

This commit is contained in:
Bob Mottram 2017-11-27 11:02:16 +00:00
parent 0653439604
commit 18c2603789
1 changed files with 31 additions and 3 deletions

View File

@ -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|<clients>.*|<clients>${max_clients}</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
}