-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenwebrx-soundcard.sh
84 lines (70 loc) · 3.01 KB
/
openwebrx-soundcard.sh
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
#!/bin/bash
# Copyright (c) 2019 by Philip Collier, radio AB9IL <[email protected]>
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version. There is NO warranty; not even for
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#OpenWebRX for softrocks / soundcard based SDRs
cd /usr/local/sbin/openwebrx/
start() {
cp /usr/local/sbin/openwebrx/config_webrx.orig.py /usr/local/sbin/openwebrx/config_webrx.py
#Edit the configuration file.
sed -i "
s/receiver_name =.*/receiver_name = \"Openwebrx in Skywave Linux\"/;
s/receiver_location =.*/receiver_location = \"City, Country\"/;
s/receiver_qra =.*/receiver_qra = \"GRIDLOC\"/;
s/photo_height =.*/photo_height = 316/;
s/photo_title =.*/photo_title = \"Scenery from the Interneational Space Station\"/;
s/sdrhu_key =.*/sdrhu_key = \"$accountkey\"/;
s/sdrhu_public_listing =.*/sdrhu_public_listing = $status/;
s/fft_size =.*/fft_size = 8192/;
s/real_input =.*/real_input = False/;
s/samp_rate =.*/samp_rate = $samprate/;
s/center_freq =.*/center_freq = $ctrfreq$mega/;
s/audio_compression =.*/audio_compression = \"none\"/;
s/fft_compression =.*/fft_compression = \"none\"/;
s/client_audio_buffer_size =.*/client_audio_buffer_size = 10/;
s/waterfall_min_level =.*/waterfall_min_level = -95/;
s/waterfall_max_level =.*/waterfall_max_level = -5/;" /usr/local/sbin/openwebrx/config_webrx.py
# Append to the configuration file.
echo 'start_rtl_command="arecord -D default -f S16_LE -r {samp_rate} -c2 - ".format(samp_rate=samp_rate)
format_conversion="csdr convert_s16_f | csdr gain_ff 30"
start_mod = "'${mode}'"' >> /usr/local/sbin/openwebrx/config_webrx.py
#Start OpenWebRX
python2 ./openwebrx.py & firefox --new-tab http://localhost:8073/
}
notifyerror(){
echo "Something went wrong!!!!!!"
WINDOW=$(zenity --info --height 100 --width 350 \
--title="Openwebrx - Error." \
--text="Something went wrong!!!!!!");
exit
}
OUTPUT=$(zenity --forms --title="OpenWebRX - Soundcard" --text="Enter the SDR start-up parameters." \
--separator="," --add-entry="Frequency (MHz)" --add-entry="Mode (am,fm,usb,lsb,cw)" --add-entry="Samplerate (44100,48000,96000,192000)" --add-entry="List on SDR.hu? (yes/no)");
if [[ "$?" -ne "0" ]]; then
notifyerror
fi
ctrfreq=$(awk -F, '{print $1}' <<<$OUTPUT)
mode=$(awk -F, '{print $2}' <<<$OUTPUT)
samprate=$(awk -F, '{print $3}' <<<$OUTPUT)
status=$(awk -F, '{print $4}' <<<$OUTPUT)
mega=e6
accountkey=''
if [ "$status" == "yes" ]; then
OUTPUT2=$(zenity --forms --title="OpenWebRX (SoapySDR)" \
--add-entry="SDR.hu a ccount key:");
accountkey=$(awk -F, '{print $1}' <<<$OUTPUT2)
if [[ "$?" -ne "0" || -z "$OUTPUT2" ]]; then
notifyerror
else
status="True"
fi
else
status="False"
fi
start
killall -9 openwebrx ncat nmux rtl_mus rtl_sdr csdr arecord
pkill -f "python2 ./openwebrx.py"
exit