Skip to content
Snippets Groups Projects
Commit 98b427de authored by Bob Mottram's avatar Bob Mottram
Browse files

Set stream name/description

parent 945ca418
No related branches found
No related tags found
No related merge requests found
......@@ -340,6 +340,38 @@ function icecast_enable_login {
esac
}
function icecast_set_stream_name {
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"Change Icecast stream details" \
--form "\n" 8 60 4 \
$"Stream name:" 1 1 "Example stream name" 1 18 40 1000 \
$"Description:" 2 1 "A short description of your stream" 2 18 40 1000 \
$"Genre:" 3 1 "Example genre" 3 18 40 1000 \
2> $data
sel=$?
case $sel in
1) return;;
255) return;;
esac
stream_name=$(cat $data | sed -n 1p)
stream_description=$(cat $data | sed -n 2p)
stream_genre=$(cat $data | sed -n 3p)
if [ ${#stream_name} -gt 2 ]; then
sed -i "s|<name>.*|<name>${stream_name}</name>|g" /etc/ices2/ices-playlist.xml
fi
if [ ${#stream_description} -gt 2 ]; then
sed -i "s|<description>.*|<description>${stream_description}</description>|g" /etc/ices2/ices-playlist.xml
fi
if [ ${#stream_genre} -gt 2 ]; then
sed -i "s|<genre>.*|<genre>${stream_genre}</genre>|g" /etc/ices2/ices-playlist.xml
fi
rm $data
stop_icecast
start_icecast
}
function configure_interactive_icecast {
while true
do
......@@ -347,7 +379,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:" 17 70 10 \
--radiolist $"Choose an operation:" 18 70 11 \
1 $"Import stream files from directory" off \
2 $"Import stream files from USB drive" off \
3 $"Manually edit playlist" off \
......@@ -357,7 +389,8 @@ function configure_interactive_icecast {
7 $"Change password for stream visitors" off \
8 $"Re-scan playlist" off \
9 $"Restart stream" off \
10 $"Exit" on 2> $data
10 $"Set Stream Name/Description/Genre" off \
11 $"Exit" on 2> $data
sel=$?
case $sel in
1) break;;
......@@ -376,9 +409,10 @@ function configure_interactive_icecast {
icecast_rescan;;
9) clear
echo $'Restarting Icecast stream'
stop_icacast
stop_icecast
start_icecast;;
10) break;;
10) icecast_set_stream_name;;
11) break;;
esac
done
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment