-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraspradio
101 lines (93 loc) · 3.64 KB
/
raspradio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
PS3="RaspRadio>"
absolutePath=$(realpath .)
mainmenu() {
mainmenu=("Lauch RaspRadio" "Update" "View Readme" "Quit")
select opt in "${mainmenu[@]}"; do
if [ "$opt" = "Quit" ]; then
echo "Quitting...Thank you for using RaspRadio!" && sleep 1 && clear
exit 0
elif [ "$opt" = "Lauch RaspRadio" ]; then
raspradiomenu
elif [ "$opt" = "Update" ]; then
gitUpdate=$(git pull)
if [ "$gitUpdate" == "Already up-to-date." ] || [ "$gitUpdate" = "Already up to date." ]; then
echo "$gitUpdate"
else
echo "$gitUpdate"
echo ""
echo "RaspRadio has been updated. Press enter to restart the program"
read
sudo bash ./raspradio
fi
elif
[ "$opt" = "View Readme" ]
then
showreadme
else
echo "That's not a valid option! Hit Return to show main menu"
fi
done
}
raspradiomenu() {
echo "Radio Name (max. 8 chars):"
read radioName
: ${radioName:="RaspRadio"}
echo "Radio Description (max. 64 chars):"
read radioDescription
: ${radioDescription:="RaspRadio, the cheapest FM radio transmitter through your simple Raspberry."}
echo "Radio Audio path/link (wav/ogg):"
read radioAudio
: ${radioAudio:="RaspRadio, the cheapest FM radio transmitter through your simple Raspberry."}
echo "Radio Frequence (MHz):"
read radioFrequency
: ${radioFrequency:="101.5"}
echo "Radio PI-code (default: FFFF):"
read radioPICode
: ${radioPICode:="FFFF"}
if [ "${radioAudio:0:4}" == "http" ]; then
echo "radioAudio"
echo "${radioAudio:0:4}"
radioAudioPath=$radioAudio
else
radioAudioPath="$absolutePath/audio/$radioAudio"
fi
echo ""
echo "Radio Name: $radioName"
echo "Radio Description: $radioDescription"
echo "Radio Audio path/link: $radioAudioPath"
echo "Radio Frequency: $radioFrequency"
echo "Radio PI-code: $radioPICode"
echo ""
echo "Are you ready to launch your radio ? "
read
if [ "${radioAudioPath:0:4}" == "http" ]; then
sudo sox -t mp3 "$radioAudioPath" -t wav - | pi_fm_rds -freq $radioFrequency -pi "$radioPICode" -ps "$radioName" -rt "$radioDescription" -audio -
else
pi_fm_rds -freq "$radioFrequency" -audio "$radioAudioPath" -pi "$radioPICode" -ps "$radioName" -rt "$radioDescription"
fi
}
showreadme() {
curl -s https://raw.githubusercontent.com/Gumbraise/RaspRadio/master/README.md | more
}
clear && echo ""
echo " ! "
echo " | "
echo " | |~/ "
echo " | _|~ ____ ____ ___ "
echo " .============.| (_| |~/ / __ \____ __________ / __ \____ _____/ (_)___ "
echo ".-;____________;|. _|~ / /_/ / __ \`/ ___/ __ \/ /_/ / __ \`/ __ / / __ \\"
echo "| [_________I__] | (_| / _, _/ /_/ (__ ) /_/ / _, _/ /_/ / /_/ / / /_/ /"
echo "| \"\"\"\"\" (_) (_) |\" /_/ |_|\__,_/____/ .___/_/ |_|\__,_/\__,_/_/\____/ "
echo "| .=====..=====. | /_/ "
echo "| |:::::||:::::| | "
echo "| '=====''=====' | "
echo "'----------------' "
echo ""
echo "Welcome to RaspRadio!"
echo "Please report all bugs, improvements and suggestions to https://github.com/Gumbraise/RaspRadio/issues"
echo "This software is only for responsible, authorised use."
echo "YOU are responsible for your own actions!"
echo "Please review the readme at https://raw.githubusercontent.com/GinjaChris/RaspRadio/master/README.md before proceeding"
echo ""
mainmenu