OpenBCM V1.07b12 (Linux)

Packet Radio Mailbox

IW8PGT

[Mendicino(CS)-Italy]

 Login: GUEST





  
N3FIX  > LINUX    17.12.18 06:40l 62 Lines 2270 Bytes #999 (0) @ WW
BID : 1258_N3FIX
Read: GUEST
Subj: AllStarLink node to say the local weather forecast
Path: IW8PGT<HB9CSR<IK7NXU<IK6IHL<IZ3LSV<IR2UBX<F1OYP<F1OYP<AB0AF<KA3BVJ<
      N3DWB<N3FIX
Sent: 181217/0200Z 1258@N3FIX.#EPA.PA.USA.NOAM LinBPQ6.0.17
From N3FIX BBS

I wrote this script early in the year, and it works rather well.
The script uses the national weather service to get
a text transcription of the weather forecast.
It re-formats the text taking out the header and footer.
It then uses a text to speech translator to create a .ul
(the Linux computer must have tts_audio installed)
file which can be read over the air by Asterisk.
Another crontab deletes the .ul file at midnight.

This is implemented on a hamvoip node on a Raspberry Pi.
It can be triggered by DTMF tones or on a time schedule.

The script is written below (sorry for the long line lengths).

73

N3FIX
Eric


----------------------------------------------
# script written by N3FIX
# date 2018-JAN-13
# this script downloads the weather forecast
# strips the header and footer
# converts it from a txt file to a .ul file
# and plays the .ul file on the air.
# play the forecast at 8:00 am and edit the crontab
# crontab -e
# 00 8 * * * /etc/asterisk/local/Forecast.sh

# use the lynx dump command to get the current weather forecast
# determine zone from alerts.weather.gov
# zone is PAZ065
lynx --dump "http://forecast.weather.gov/MapClick.php?zoneid=PAZ065&FcstType=text&TextType=2" > Forecast.txt

# take the header out by removing lines 2 through 4.
sed '2,4d' /etc/asterisk/local/Forecast.txt > /etc/asterisk/local/Forecast1.txt

# take the footer out by listing the file backwards with tac and taking out lines 1 to 10.
tac /etc/asterisk/local/Forecast1.txt | sed '1,10d' | tac > /etc/asterisk/local/Forecast.txt

# remove all the underscores from the file
sed 's/_//g' /etc/asterisk/local/Forecast.txt > /etc/asterisk/local/Forecast1.txt

# tts_audio doesn't say winds correctly. Make her say "wend" instead.
sed 's/winds/wend/g' /etc/asterisk/local/Forecast1.txt > /etc/asterisk/local/Forecast.txt

# convert the file to a ul file using tts_audio.sh
tts_audio.sh /etc/asterisk/local/Forecast.txt

# play the resulting file on the air by calling asterisk
# for 46891 ... insert your own node number
asterisk -rx "rpt localplay 46891 /etc/asterisk/local/Forecast"

# remove the temporary files after debugging
rm /etc/asterisk/local/Forecast1.txt
rm /etc/asterisk/local/Forecast.txt
------------------------------------------------


Read previous mail | Read next mail


 12.05.2024 04:53:10lGo back Go up