Skip to content

Commit

Permalink
If station if 0 or negative then we set to the highest station, closes
Browse files Browse the repository at this point in the history
…#8

[ci skip]
  • Loading branch information
probonopd committed Jan 5, 2016
1 parent 1a9ea30 commit 3ab133d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion traits/audio/radio/files/usr/bin/radioplayer
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ done
nr_to_name()
{
NUMBER_OF_STATIONS=$(uci show radio | grep -e "=station$" | wc -l)
if [ $1 -le $NUMBER_OF_STATIONS ] ; then
if [ $1 -lt 1 ] ; then
uci set radio.next=$NUMBER_OF_STATIONS # if 0 or negative then we set to the highest station
echo $(uci show radio | grep -e "=station$" | cut -d "." -f 2 | cut -d "=" -f 1 | head -n $1 | tail -n 1)
elif [ $1 -le $NUMBER_OF_STATIONS ] ; then
echo $(uci show radio | grep -e "=station$" | cut -d "." -f 2 | cut -d "=" -f 1 | head -n $1 | tail -n 1)
else
uci set radio.next=1 # Reset
Expand Down

0 comments on commit 3ab133d

Please sign in to comment.