commit
3c55eaa8a5
@ -0,0 +1,48 @@
|
|||||||
|
README.txt
|
||||||
|
|
||||||
|
README.txt v0.1
|
||||||
|
( wx_scripts - release v0.3)
|
||||||
|
|
||||||
|
============================================================================
|
||||||
|
| IMPORTANT NOTICE! |
|
||||||
|
| |
|
||||||
|
| No matter what the Weather Alerts are indicating, the information |
|
||||||
|
| gathered and presented here may NOT be accurate. You MUST use your own |
|
||||||
|
| judgement to determine your best course of action in any given |
|
||||||
|
| circumstance! The are many reasons WHY the data here may not be accurate, |
|
||||||
|
| including, but not limited to, software problems, network problems, and or |
|
||||||
|
| hardware problems. The Weather Alerts and other Weather information should |
|
||||||
|
| NOT be used to make any determination of actual current conditions, it is |
|
||||||
|
| merely an indication of what the software is seeing as a result of it's |
|
||||||
|
| attempts to read publicly available data sources. These data sources may |
|
||||||
|
| be unavailable, unreachable, or innacurate. Please check other sources to |
|
||||||
|
| verify any information presented here. |
|
||||||
|
============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
==Distribution Installation==
|
||||||
|
These instructions are for the Allstar BBB distribution to install the Weather
|
||||||
|
scripts in the the "/usr/local/bin/Weather" directories. It will also install
|
||||||
|
any dependencies required by using the "pacman" software install utility.
|
||||||
|
|
||||||
|
=Installation=
|
||||||
|
|
||||||
|
Install using the compressed tar file. Copy the tar file over to
|
||||||
|
/root (as root) and extract the files:
|
||||||
|
cd /root
|
||||||
|
tar zxf wxscripts-<version>.tgz
|
||||||
|
|
||||||
|
Then change directories to the extracted directory and run the installation
|
||||||
|
script:
|
||||||
|
cd /wx_scripts-<version>
|
||||||
|
./wx_scripts_install.sh
|
||||||
|
|
||||||
|
This will install any dependency packages, setup the distribution directories,
|
||||||
|
and copy the scripts to the appropriate locations.
|
||||||
|
|
||||||
|
This script will not setup any cron entries or configuration files.
|
||||||
|
|
||||||
|
The user will need to configure the rest.
|
||||||
|
|
||||||
|
|
||||||
|
< $Id $ >
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
- Add check for enable/disable_wx_alertmsg for arguments.
|
||||||
|
|
||||||
|
- give examples in code files for both a cron and rpt.conf entries. (done)
|
||||||
|
|
||||||
|
- change enable/disable_wx_alertmsg to include node arguement? (not needed)
|
||||||
|
|
||||||
|
- update precipitation changes (from acid release)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# create tar ball.
|
||||||
|
|
||||||
|
# $Id: create_tar.sh 24 2015-03-27 00:53:24Z w0anm $
|
||||||
|
|
||||||
|
if [ -z "$1" ] ; then
|
||||||
|
version=$(svn info | grep Rev: | awk '{print $4}')
|
||||||
|
else
|
||||||
|
version=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
REPO=arm_wxscripts
|
||||||
|
TMP_DIR=/tmp/$REPO
|
||||||
|
SVN_SRC_DIR=$(pwd)
|
||||||
|
|
||||||
|
if [ ! -d /tmp/$REPO ] ; then
|
||||||
|
mkdir -p /tmp/$REPO
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $SVN_SRC_DIR
|
||||||
|
|
||||||
|
|
||||||
|
# run as root
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cp -rp $SVN_SRC_DIR/* /tmp/$REPO/.
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
|
|
||||||
|
# remove unwanted files
|
||||||
|
rm -rf /tmp/$REPO/.svn
|
||||||
|
rm -f /tmp/$REPO/create_tar.sh
|
||||||
|
rm -f /tmp/$REPO/*.tgz
|
||||||
|
rm -rf /tmp/$REPO/not_available
|
||||||
|
rm -rf /tmp/$REPO/archive
|
||||||
|
rm -rf /tmp/$REPO/sandbox
|
||||||
|
rm -f next_releaseToDo.txt
|
||||||
|
|
||||||
|
# fix permissions
|
||||||
|
chown -R root:root /tmp/$REPO
|
||||||
|
chmod 755 /tmp/$REPO/src/*
|
||||||
|
|
||||||
|
# create compressed tar file
|
||||||
|
tar zcf ${SVN_SRC_DIR}/arm-wxscripts-0.${version}.tgz -C /tmp ./$REPO
|
||||||
|
|
||||||
|
# create zip file
|
||||||
|
# zip -r ${SVN_SRC_DIR}/BBB-wxscripts-0.${version}.zip ./$REPO
|
||||||
|
|
||||||
|
rm -rf /tmp/$REPO
|
||||||
|
|
||||||
|
cd $SVN_SRC_DIR
|
||||||
|
chown ckovacs:ckovacs ./*.tgz
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Done...":
|
||||||
|
exit
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#git config user.name KB8PMY
|
||||||
|
git init
|
||||||
|
git checkout -b main
|
||||||
|
git add *
|
||||||
|
git commit -m "first commit"
|
||||||
|
git remote add origin https://git.rdcclouds.com/KB8PMY/Weatherscript_V2.git
|
||||||
|
#git push -u origin main
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
There are no active watches, warnings or advisories
|
||||||
|
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/python2
|
||||||
|
#
|
||||||
|
# google_tts.py - allstar Text to Speech
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# This script will convert text to speech (audio file). This uses google's
|
||||||
|
# online text to speech services.
|
||||||
|
# http://translate.google.com/translate_tts?tl=en&"
|
||||||
|
#
|
||||||
|
#######################
|
||||||
|
# $Id: google_tts.py 28 2015-07-27 02:10:47Z w0anm $
|
||||||
|
|
||||||
|
import urllib, pycurl, os, sys
|
||||||
|
|
||||||
|
print 'Number of arguments:', len(sys.argv), 'arguments.'
|
||||||
|
print 'Argument List:', str(sys.argv)
|
||||||
|
|
||||||
|
print "length of string:"
|
||||||
|
print len(sys.argv[1])
|
||||||
|
|
||||||
|
textmsg=str(sys.argv[1])
|
||||||
|
print textmsg
|
||||||
|
|
||||||
|
|
||||||
|
def downloadFile(url, fileName):
|
||||||
|
fp = open(fileName, "wb")
|
||||||
|
curl = pycurl.Curl()
|
||||||
|
curl.setopt(pycurl.URL, url)
|
||||||
|
curl.setopt(pycurl.USERAGENT, 'Mozilla/5.0 (X11; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0')
|
||||||
|
curl.setopt(pycurl.WRITEDATA, fp)
|
||||||
|
curl.perform()
|
||||||
|
curl.close()
|
||||||
|
fp.close()
|
||||||
|
|
||||||
|
def getGoogleSpeechURL(phrase):
|
||||||
|
googleTranslateURL = "http://translate.google.com/translate_tts?tl=en&"
|
||||||
|
parameters = {'q': phrase}
|
||||||
|
data = urllib.urlencode(parameters)
|
||||||
|
googleTranslateURL = "%s%s" % (googleTranslateURL,data)
|
||||||
|
return googleTranslateURL
|
||||||
|
|
||||||
|
# just download, don't play it
|
||||||
|
def speakSpeechFromText(phrase):
|
||||||
|
googleSpeechURL = getGoogleSpeechURL(phrase)
|
||||||
|
downloadFile(googleSpeechURL,"/tmp/tts/tts.mp3")
|
||||||
|
# os.system("mplayer tts.mp3 -af extrastereo=0 &")
|
||||||
|
# os.system("mplayer tts.mp3 > /dev/null 2>&1" )
|
||||||
|
|
||||||
|
# speakSpeechFromText("testing, testing, 1 2 3. Lets try this")
|
||||||
|
speakSpeechFromText(textmsg)
|
||||||
|
print "done..."
|
||||||
@ -0,0 +1,253 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
#
|
||||||
|
# Script that uses Google Translate for text to speech synthesis.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012, Lefteris Zafiris <zaf.000@gmail.com>
|
||||||
|
#
|
||||||
|
# This program is free software, distributed under the terms of
|
||||||
|
# the GNU General Public License Version 2.
|
||||||
|
#
|
||||||
|
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
use utf8;
|
||||||
|
use Encode qw(decode encode);
|
||||||
|
use Getopt::Std;
|
||||||
|
use File::Temp qw(tempfile);
|
||||||
|
use URI::Escape;
|
||||||
|
use LWP::UserAgent;
|
||||||
|
use LWP::ConnCache;
|
||||||
|
|
||||||
|
my %options;
|
||||||
|
my @text;
|
||||||
|
my @mp3list;
|
||||||
|
my @soxargs;
|
||||||
|
my $samplerate;
|
||||||
|
my $input;
|
||||||
|
my $speed = 1;
|
||||||
|
my $lang = "en-US";
|
||||||
|
my $tmpdir = "/tmp";
|
||||||
|
my $timeout = 10;
|
||||||
|
my $url = "http://translate.google.com/translate_tts";
|
||||||
|
my $mpg123 = `/usr/bin/which mpg123`;
|
||||||
|
my $sox = `/usr/bin/which sox`;
|
||||||
|
|
||||||
|
VERSION_MESSAGE() if (!@ARGV);
|
||||||
|
|
||||||
|
getopts('o:l:r:t:f:s:hqv', \%options);
|
||||||
|
|
||||||
|
# Dislpay help messages #
|
||||||
|
VERSION_MESSAGE() if (defined $options{h});
|
||||||
|
lang_list("dislpay") if (defined $options{v});
|
||||||
|
|
||||||
|
if (!$mpg123 || !$sox) {
|
||||||
|
say_msg("mpg123 or sox is missing. Aborting.");
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
chomp($mpg123, $sox);
|
||||||
|
|
||||||
|
parse_options();
|
||||||
|
$input = decode('utf8', $input);
|
||||||
|
for ($input) {
|
||||||
|
# Split input to comply with google tts requirements #
|
||||||
|
s/[\\|*~<>^\n\(\)\[\]\{\}[:cntrl:]]/ /g;
|
||||||
|
s/\s+/ /g;
|
||||||
|
s/^\s|\s$//g;
|
||||||
|
if (!length) {
|
||||||
|
say_msg("No text passed for synthesis.");
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
$_ .= "." unless (/^.+[.,?!:;]$/);
|
||||||
|
@text = /.{1,99}[.,?!:;]|.{1,99}\s/g;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $ua = LWP::UserAgent->new;
|
||||||
|
$ua->agent("Mozilla/5.0 (X11; Linux; rv:8.0) Gecko/20100101");
|
||||||
|
$ua->env_proxy;
|
||||||
|
$ua->conn_cache(LWP::ConnCache->new());
|
||||||
|
$ua->timeout($timeout);
|
||||||
|
|
||||||
|
foreach my $line (@text) {
|
||||||
|
# Get speech data from google and save them in temp files #
|
||||||
|
$line = encode('utf8', $line);
|
||||||
|
$line =~ s/^\s+|\s+$//g;
|
||||||
|
next if (length($line) == 0);
|
||||||
|
$line = uri_escape($line);
|
||||||
|
my ($mp3_fh, $mp3_name) = tempfile(
|
||||||
|
"tts_XXXXXX",
|
||||||
|
DIR => $tmpdir,
|
||||||
|
SUFFIX => ".mp3",
|
||||||
|
UNLINK => 1
|
||||||
|
);
|
||||||
|
my $request = HTTP::Request->new('GET' => "$url?tl=$lang&q=$line");
|
||||||
|
my $response = $ua->request($request, $mp3_name);
|
||||||
|
if (!$response->is_success) {
|
||||||
|
say_msg("Failed to fetch speech data.");
|
||||||
|
exit 1;
|
||||||
|
} else {
|
||||||
|
push(@mp3list, $mp3_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# decode mp3s and concatenate #
|
||||||
|
my ($wav_fh, $wav_name) = tempfile(
|
||||||
|
"tts_XXXXXX",
|
||||||
|
DIR => $tmpdir,
|
||||||
|
SUFFIX => ".wav",
|
||||||
|
UNLINK => 1
|
||||||
|
);
|
||||||
|
if (system($mpg123, "-q", "-w", $wav_name, @mp3list)) {
|
||||||
|
say_msg("mpg123 failed to process sound file.");
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set sox args and process wav file #
|
||||||
|
@soxargs = ($sox, "-q", $wav_name);
|
||||||
|
defined $options{o} ? push(@soxargs, ($options{o})) : push(@soxargs, ("-t", "alsa", "-d"));
|
||||||
|
push(@soxargs, ("tempo", "-s", $speed)) if ($speed != 1);
|
||||||
|
push(@soxargs, ("rate", $samplerate)) if ($samplerate);
|
||||||
|
|
||||||
|
if (system(@soxargs)) {
|
||||||
|
say_msg("sox failed to process sound file.");
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
|
||||||
|
sub say_msg {
|
||||||
|
# Print messages to user if 'quiet' flag is not set #
|
||||||
|
my @message = @_;
|
||||||
|
warn @message if (!defined $options{q});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub parse_options {
|
||||||
|
# Get input text #
|
||||||
|
if (defined $options{t}) {
|
||||||
|
$input = $options{t};
|
||||||
|
} elsif (defined $options{f}) {
|
||||||
|
if (open(my $fh, "<", "$options{f}")) {
|
||||||
|
$input = do { local $/; <$fh> };
|
||||||
|
close($fh);
|
||||||
|
} else {
|
||||||
|
say_msg("Cant read file $options{f}");
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
say_msg("No text passed for synthesis.");
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
# set the speech language #
|
||||||
|
if (defined $options{l}) {
|
||||||
|
$options{l} =~ /^[a-zA-Z]{2}(-[a-zA-Z]{2,6})?$/ ? $lang = $options{l}
|
||||||
|
: say_msg("Invalid language setting, using default.");
|
||||||
|
}
|
||||||
|
# set audio sample rate #
|
||||||
|
if (defined $options{r}) {
|
||||||
|
$options{r} =~ /\d+/ ? $samplerate = $options{r}
|
||||||
|
: say_msg("Invalid sample rate, using default.");
|
||||||
|
}
|
||||||
|
# set speed factor #
|
||||||
|
if (defined $options{s}) {
|
||||||
|
$options{s} =~ /\d+/ ? $speed = $options{s}
|
||||||
|
: say_msg("Invalind speed factor, using default.");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub VERSION_MESSAGE {
|
||||||
|
# Help message #
|
||||||
|
print "Text to speech synthesis using google voice.\n\n",
|
||||||
|
"Supported options:\n",
|
||||||
|
" -t <text> text string to synthesize\n",
|
||||||
|
" -f <file> text file to synthesize\n",
|
||||||
|
" -l <lang> specify the language to use, defaults to 'en-US' (English)\n",
|
||||||
|
" -o <filename> write output as WAV file\n",
|
||||||
|
" -r <rate> specify the output sampling rate in Hertz (default 22050)\n",
|
||||||
|
" -s <factor> specify the output speed factor\n",
|
||||||
|
" -q quiet (Don't print any messages or warnings)\n",
|
||||||
|
" -h this help message\n",
|
||||||
|
" -v suppoted languages list\n\n",
|
||||||
|
"Examples:\n",
|
||||||
|
"$0 -l en -t \"Hello world\"\n Have the synthesized speech played back to the user.\n",
|
||||||
|
"$0 -o hello.wav -l en -t \"Hello world\"\n Save the synthesized speech as a wav file.\n\n";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub lang_list {
|
||||||
|
# Display the list of supported languages to the user or return it as a hash #
|
||||||
|
my $opt = shift;
|
||||||
|
my %sup_lang = (
|
||||||
|
"Afrikaans", "af", "Albanian", "sq",
|
||||||
|
"Amharic", "am", "Arabic", "ar",
|
||||||
|
"Armenian", "hy", "Azerbaijani", "az",
|
||||||
|
"Basque", "eu", "Belarusian", "be",
|
||||||
|
"Bengali", "bn", "Bihari", "bh",
|
||||||
|
"Bosnian", "bs", "Breton", "br",
|
||||||
|
"Bulgarian", "bg", "Cambodian", "km",
|
||||||
|
"Catalan", "ca", "Chinese (Simplified)", "zh-CN",
|
||||||
|
"Chinese (Traditional)", "zh-TW", "Corsican", "co",
|
||||||
|
"Croatian", "hr", "Czech", "cs",
|
||||||
|
"Danish", "da", "Dutch", "nl",
|
||||||
|
"English", "en", "Esperanto", "eo",
|
||||||
|
"Estonian", "et", "Faroese", "fo",
|
||||||
|
"Filipino", "tl", "Finnish", "fi",
|
||||||
|
"French", "fr", "Frisian", "fy",
|
||||||
|
"Galician", "gl", "Georgian", "ka",
|
||||||
|
"German", "de", "Greek", "el",
|
||||||
|
"Guarani", "gn", "Gujarati", "gu",
|
||||||
|
"Hacker", "xx-hacker", "Hausa", "ha",
|
||||||
|
"Hebrew", "iw", "Hindi", "hi",
|
||||||
|
"Hungarian", "hu", "Icelandic", "is",
|
||||||
|
"Indonesian", "id", "Interlingua", "ia",
|
||||||
|
"Irish", "ga", "Italian", "it",
|
||||||
|
"Japanese", "ja", "Javanese", "jw",
|
||||||
|
"Kannada", "kn", "Kazakh", "kk",
|
||||||
|
"Kinyarwanda", "rw", "Kirundi", "rn",
|
||||||
|
"Klingon", "xx-klingon", "Korean", "ko",
|
||||||
|
"Kurdish", "ku", "Kyrgyz", "ky",
|
||||||
|
"Laothian", "lo", "Latin", "la",
|
||||||
|
"Latvian", "lv", "Lingala", "ln",
|
||||||
|
"Lithuanian", "lt", "Macedonian", "mk",
|
||||||
|
"Malagasy", "mg", "Malay", "ms",
|
||||||
|
"Malayalam", "ml", "Maltese", "mt",
|
||||||
|
"Maori", "mi", "Marathi", "mr",
|
||||||
|
"Moldavian", "mo", "Mongolian", "mn",
|
||||||
|
"Montenegrin", "sr-ME", "Nepali", "ne",
|
||||||
|
"Norwegian", "no", "Norwegian (Nynorsk)", "nn",
|
||||||
|
"Occitan", "oc", "Oriya", "or",
|
||||||
|
"Oromo", "om", "Pashto", "ps",
|
||||||
|
"Persian", "fa", "Pirate", "xx-pirate",
|
||||||
|
"Polish", "pl", "Portuguese (Brazil)", "pt-BR",
|
||||||
|
"Portuguese (Portugal)", "pt-PT", "Portuguese", "pt",
|
||||||
|
"Punjabi", "pa", "Quechua", "qu",
|
||||||
|
"Romanian", "ro", "Romansh", "rm",
|
||||||
|
"Russian", "ru", "Scots Gaelic", "gd",
|
||||||
|
"Serbian", "sr", "Serbo-Croatian", "sh",
|
||||||
|
"Sesotho", "st", "Shona", "sn",
|
||||||
|
"Sindhi", "sd", "Sinhalese", "si",
|
||||||
|
"Slovak", "sk", "Slovenian", "sl",
|
||||||
|
"Somali", "so", "Spanish", "es",
|
||||||
|
"Sundanese", "su", "Swahili", "sw",
|
||||||
|
"Swedish", "sv", "Tajik", "tg",
|
||||||
|
"Tamil", "ta", "Tatar", "tt",
|
||||||
|
"Telugu", "te", "Thai", "th",
|
||||||
|
"Tigrinya", "ti", "Tonga", "to",
|
||||||
|
"Turkish", "tr", "Turkmen", "tk",
|
||||||
|
"Twi", "tw", "Uighur", "ug",
|
||||||
|
"Ukrainian", "uk", "Urdu", "ur",
|
||||||
|
"Uzbek", "uz", "Vietnamese", "vi",
|
||||||
|
"Welsh", "cy", "Xhosa", "xh",
|
||||||
|
"Yiddish", "yi", "Yoruba", "yo",
|
||||||
|
"Zulu", "zu"
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($opt eq "dislpay") {
|
||||||
|
print "Supported Languages list:\n";
|
||||||
|
printf("%-22s: %s\n", $_, $sup_lang{$_}) foreach (sort keys %sup_lang);
|
||||||
|
exit 1;
|
||||||
|
} elsif ($opt eq "list") {
|
||||||
|
return %sup_lang;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
Example of Underground wx report:
|
||||||
|
|
||||||
|
|
||||||
|
Weather report for The Landings On The Crow , St Michael .
|
||||||
|
Last Updated on September 6, 9:00 PM
|
||||||
|
the wind was blowing at a speed of 4.9 miles per hour from north north west
|
||||||
|
with wind gusts up to 5.8 miles per hour.
|
||||||
|
The temperature was 72.1 degrees with a dewpoint of 56.5 degrees.
|
||||||
|
The pressure was rising at 29.82 inches of mercury.
|
||||||
|
The relative humidity was 58 percent.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Weather Report
|
||||||
|
|
||||||
|
Last Updated at xx:xx
|
||||||
|
|
||||||
|
**** decision ****
|
||||||
|
The wind was blowing at a speed of
|
||||||
|
"4.9"
|
||||||
|
miles per hour from
|
||||||
|
"north north west" (north+north+west)
|
||||||
|
"north east"
|
||||||
|
"est north east"
|
||||||
|
"east south east"
|
||||||
|
"south east"
|
||||||
|
"south south east"
|
||||||
|
"south south west
|
||||||
|
"south west"
|
||||||
|
"west south west"
|
||||||
|
"west north west:
|
||||||
|
"north west"
|
||||||
|
"north north west"
|
||||||
|
|
||||||
|
with wind guests up to
|
||||||
|
"5.8"
|
||||||
|
miles per hour.
|
||||||
|
--or--
|
||||||
|
The wind was calm.
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
The temperature was
|
||||||
|
"72.1"
|
||||||
|
degrees with a dew point of
|
||||||
|
"56.6"
|
||||||
|
degrees.
|
||||||
|
|
||||||
|
The pressure was
|
||||||
|
raising at
|
||||||
|
falling at
|
||||||
|
steady at
|
||||||
|
|
||||||
|
"29.82"
|
||||||
|
|
||||||
|
inches of mercury.
|
||||||
|
|
||||||
|
The relative humidity was "58" percent.
|
||||||
|
|
||||||
|
The wind was blowing at a speed of
|
||||||
|
with wind guests up to
|
||||||
|
|
||||||
|
|
||||||
|
Need a numbers routine, like time, to setup the temperature, pressure, wind speed.
|
||||||
|
|
||||||
|
Create a script to play gsm combinations via local node.
|
||||||
|
|
||||||
|
Script to take mp3 to gsm
|
||||||
@ -0,0 +1,198 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# tts-audio.sh - allstar Text to Speech
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# This scripts converts the file and calls the google-tts.py script
|
||||||
|
# to convert the text to an audio file (mp3).
|
||||||
|
#
|
||||||
|
#######################
|
||||||
|
# $Id: tts_audio.sh 28 2015-07-27 02:10:47Z w0anm $
|
||||||
|
|
||||||
|
# variables
|
||||||
|
TMPDIR=/tmp/tts
|
||||||
|
PID=$$
|
||||||
|
TMPFILE1=/tmp/tts/tmpfile1${PID}
|
||||||
|
TMPFILE2=/tmp/tts/tmpfile2${PID}
|
||||||
|
TTS_LOCK=$TMPDIR/lock_tts
|
||||||
|
VOL=3
|
||||||
|
|
||||||
|
old_IFS=$IFS
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
# setup lock file
|
||||||
|
readonly PROGNAME=$(basename "$0")
|
||||||
|
readonly LOCKFILE_DIR=$TMPDIR
|
||||||
|
readonly LOCK_FD=200
|
||||||
|
|
||||||
|
## Functions Start
|
||||||
|
|
||||||
|
lock() {
|
||||||
|
local prefix=$1
|
||||||
|
local fd=${2:-$LOCK_FD}
|
||||||
|
local lock_file=$LOCKFILE_DIR/$prefix.lock
|
||||||
|
|
||||||
|
# create lock file
|
||||||
|
eval "exec $fd>$lock_file"
|
||||||
|
|
||||||
|
# aquire the lock
|
||||||
|
flock -n $fd \
|
||||||
|
&& return 0 \
|
||||||
|
|| return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
help() {
|
||||||
|
echo
|
||||||
|
echo "$PROGNAME tts_audio.sh [-v <volume>] filename"
|
||||||
|
echo " Where the -v allows you to set the output volume generated by the script."
|
||||||
|
echo " The accepted values are 0-10, where 0 is the lowest and 10 is the "
|
||||||
|
echo " highest volume setting. If you do not use this option, the default"
|
||||||
|
echo " volume is 3."
|
||||||
|
echo
|
||||||
|
echo "For example:"
|
||||||
|
echo " tts_audio.sh -v 4 /tmp/hello.txt"
|
||||||
|
echo
|
||||||
|
echo "This will create a file called /tmp/hello.ul"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
|
||||||
|
#if lock is present, wait until lock is removed. Should only have
|
||||||
|
# one instance of this program running.
|
||||||
|
|
||||||
|
until lock $PROGNAME ; do
|
||||||
|
sleep 20
|
||||||
|
done
|
||||||
|
|
||||||
|
# Each text line should be less then xx characters. Approach is to
|
||||||
|
# split on periods. If any further splitting, it may cause a pause in the
|
||||||
|
# text speed due the the pause of each line.
|
||||||
|
|
||||||
|
# first split the file using "period".
|
||||||
|
sed 's/\. /\.\n/g' $FILE > $TMPFILE1
|
||||||
|
|
||||||
|
## shorten to 99 characters per line
|
||||||
|
fold -w 99 -s $TMPFILE1 > $TMPFILE2
|
||||||
|
|
||||||
|
# convert text file to an mp3 file
|
||||||
|
line=($(cat $TMPFILE2)) # array
|
||||||
|
|
||||||
|
## need to determine the number of lines in the file.
|
||||||
|
LINES_IN_FILE=`wc -l $TMPFILE2 | awk '{print $1}'`
|
||||||
|
|
||||||
|
for i in `seq 0 $LINES_IN_FILE`
|
||||||
|
do
|
||||||
|
# /usr/local/bin/google_tts.py "${line[$i]}" # may be helpful for debug
|
||||||
|
|
||||||
|
line_count=`echo ${line[$i]} | wc -c`
|
||||||
|
# check to make sure that string is less then 100, if not abort.
|
||||||
|
if [ "$line_count" -gt "100" ] ; then
|
||||||
|
echo "Error, string count is greater than 100 characters. Use the -s option" 2>&1
|
||||||
|
echo "to split lines or shorten the text lines in the file. Aborting..." 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/local/bin/google_tts.py "${line[$i]}" > /dev/null 2>&1
|
||||||
|
if [ ! -f ${TMPDIR}/tts.mp3 ] ; then
|
||||||
|
echo "ERROR, google_tts.py module failed to create mp3 file." 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cp ${TMPDIR}/tts.mp3 ${TMPDIR}/tts_${i}.mp3
|
||||||
|
done
|
||||||
|
|
||||||
|
# now cat all the mp3 files to a single file
|
||||||
|
|
||||||
|
# you need to sort for the proper order tts_1, tts_2 .. tts_10
|
||||||
|
cat `ls ${TMPDIR}/tts_*.mp3 | sort --version-sort` > ${TMPDIR}/audio.mp3
|
||||||
|
|
||||||
|
# now convert the file to a ulaw
|
||||||
|
lame --decode ${TMPDIR}/audio.mp3 ${TMPDIR}/audio.wav &> /dev/null 2>&1
|
||||||
|
if [ ! -f ${TMPDIR}/audio.wav ] ; then
|
||||||
|
echo "Failed to convert mp3 file to wav audio file (lame decode failure)"
|
||||||
|
echo "Check internet access..."
|
||||||
|
echo "Aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sox --volume $VOL -V ${TMPDIR}/audio.wav -r 8000 -c 1 -t ul ${TMPDIR}/audio${PID}.ul &> /dev/null 2>&1
|
||||||
|
if [ ! -f ${TMPDIR}/audio${PID}.ul ] ; then
|
||||||
|
echo "Failed to convert wav file to u-law audio file (sox failure)"
|
||||||
|
echo "Aborting..."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# clean up the mp3, temp, and wave files
|
||||||
|
rm -f ${TMPDIR}/tts*.mp3
|
||||||
|
rm -f ${TMPDIR}/audio.mp3
|
||||||
|
rm -f ${TMPDIR}/audio.wav
|
||||||
|
rm -f ${TMPFILE1}
|
||||||
|
rm -f ${TMPFILE2}
|
||||||
|
|
||||||
|
IFS=$old_IFS
|
||||||
|
mv ${TMPDIR}/audio${PID}.ul ${FILE%.txt}.ul
|
||||||
|
}
|
||||||
|
|
||||||
|
# end of functions...
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# main
|
||||||
|
|
||||||
|
# set an initial value for the flag
|
||||||
|
SPLIT=0
|
||||||
|
|
||||||
|
# read the options
|
||||||
|
TEMP=`getopt -o a::sv: --long arga::,args,argv: -n 'tts_audio.sh' -- "$@"`
|
||||||
|
eval set -- "$TEMP"
|
||||||
|
|
||||||
|
# extract options and their arguments into variables.
|
||||||
|
while true ; do
|
||||||
|
case "$1" in
|
||||||
|
-a|--arga)
|
||||||
|
case "$2" in
|
||||||
|
"") ARG_A='some default value' ; shift 2 ;;
|
||||||
|
*) ARG_A=$2 ; shift 2 ;;
|
||||||
|
esac ;;
|
||||||
|
-s|--split) SPLIT=1 ; shift ;;
|
||||||
|
-v|--vol)
|
||||||
|
case "$2" in
|
||||||
|
"") shift 2 ;;
|
||||||
|
*) VOL=$2 ; shift 2 ;;
|
||||||
|
esac ;;
|
||||||
|
--) shift ; break ;;
|
||||||
|
*) echo "Internal error!" ; exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
FILE=$1
|
||||||
|
|
||||||
|
VOL_ARRAY=(-0.0 -0.05 -0.1 -0.2 -0.3 -0.4 -0.5 -0.6 -0.7 -0.8 -0.9 )
|
||||||
|
# get converted volume
|
||||||
|
VOLCONV=${VOL_ARRAY[$VOL]}
|
||||||
|
|
||||||
|
if [ "$VOLCONV" = "" ] ; then
|
||||||
|
echo "Error in setting the volume. The argument must be an integer value from"
|
||||||
|
echo " 1 through 10, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VOL=$VOLCONV
|
||||||
|
|
||||||
|
# make sure that the temp directory is there
|
||||||
|
if [ ! -d $TMPDIR ] ; then
|
||||||
|
mkdir -p $TMPDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -eq 0 ] ; then
|
||||||
|
echo "No arguments supplied"
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# call main function.
|
||||||
|
main
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
@ -0,0 +1,138 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# tts-audio.sh - allstar Text to Speech
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# This scripts converts the file and calls the google-tts.py script
|
||||||
|
# to convert the text to an audio file (mp3).
|
||||||
|
#
|
||||||
|
#######################
|
||||||
|
# $Id: tts_audio.sh 24 2015-03-27 00:53:24Z w0anm $
|
||||||
|
|
||||||
|
# variables
|
||||||
|
TMPDIR=/tmp/tts
|
||||||
|
PID=$$
|
||||||
|
TMPFILE1=/tmp/tts/tmpfile1${PID}
|
||||||
|
TMPFILE2=/tmp/tts/tmpfile2${PID}
|
||||||
|
TTS_LOCK=$TMPDIR/lock_tts
|
||||||
|
VOL=8
|
||||||
|
|
||||||
|
old_IFS=$IFS
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
# setup lock file
|
||||||
|
readonly PROGNAME=$(basename "$0")
|
||||||
|
readonly LOCKFILE_DIR=$TMPDIR
|
||||||
|
readonly LOCK_FD=200
|
||||||
|
|
||||||
|
## Functions Start
|
||||||
|
|
||||||
|
lock() {
|
||||||
|
local prefix=$1
|
||||||
|
local fd=${2:-$LOCK_FD}
|
||||||
|
local lock_file=$LOCKFILE_DIR/$prefix.lock
|
||||||
|
|
||||||
|
# create lock file
|
||||||
|
eval "exec $fd>$lock_file"
|
||||||
|
|
||||||
|
# aquire the lock
|
||||||
|
flock -n $fd \
|
||||||
|
&& return 0 \
|
||||||
|
|| return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
help() {
|
||||||
|
echo
|
||||||
|
echo "$PROGNAME tts_audio.sh [-v <volume>] filename"
|
||||||
|
echo " Where the -v allows you to set the output volume generated by the script."
|
||||||
|
echo " The accepted values are 0-10, where 0 is the lowest and 10 is the "
|
||||||
|
echo " highest volume setting. If you do not use this option, the default"
|
||||||
|
echo " volume is 3."
|
||||||
|
echo
|
||||||
|
echo "For example:"
|
||||||
|
echo " tts_audio.sh -v 4 /tmp/hello.txt"
|
||||||
|
echo
|
||||||
|
echo "This will create a file called /tmp/hello.ul"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
|
||||||
|
#if lock is present, wait until lock is removed. Should only have
|
||||||
|
# one instance of this program running.
|
||||||
|
|
||||||
|
until lock $PROGNAME ; do
|
||||||
|
sleep 20
|
||||||
|
done
|
||||||
|
|
||||||
|
swift -n Callie -m text -f $FILE -p audio/encoding=ulaw,audio/sampling-rate=8000,audio/volume=$VOL -o ${TMPDIR}/audio${PID}.ul
|
||||||
|
|
||||||
|
if [ ! -f ${TMPDIR}/audio${PID}.ul ] ; then
|
||||||
|
echo "Failed to convert wav file to u-law audio file (sox failure)"
|
||||||
|
echo "Aborting..."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=$old_IFS
|
||||||
|
mv ${TMPDIR}/audio${PID}.ul ${FILE%.txt}.ul
|
||||||
|
}
|
||||||
|
|
||||||
|
# end of functions...
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# main
|
||||||
|
|
||||||
|
# read the options
|
||||||
|
TEMP=`getopt -o a::sv: --long arga::,args,argv: -n 'tts_audio.sh' -- "$@"`
|
||||||
|
eval set -- "$TEMP"
|
||||||
|
|
||||||
|
# extract options and their arguments into variables.
|
||||||
|
while true ; do
|
||||||
|
case "$1" in
|
||||||
|
-a|--arga)
|
||||||
|
case "$2" in
|
||||||
|
"") ARG_A='some default value' ; shift 2 ;;
|
||||||
|
*) ARG_A=$2 ; shift 2 ;;
|
||||||
|
esac ;;
|
||||||
|
-s|--split) SPLIT=1 ; shift ;;
|
||||||
|
-v|--vol)
|
||||||
|
case "$2" in
|
||||||
|
"") shift 2 ;;
|
||||||
|
*) VOL=$2 ; shift 2 ;;
|
||||||
|
esac ;;
|
||||||
|
--) shift ; break ;;
|
||||||
|
*) echo "Internal error!" ; exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
FILE=$1
|
||||||
|
|
||||||
|
# VOL_ARRAY=(-0.0 -0.05 -0.1 -0.2 -0.3 -0.4 -0.5 -0.6 -0.7 -0.8 -0.9 )
|
||||||
|
VOL_ARRAY=(0 10 20 30 40 50 60 70 80 100 120 )
|
||||||
|
# get converted volume
|
||||||
|
VOLCONV=${VOL_ARRAY[$VOL]}
|
||||||
|
|
||||||
|
if [ "$VOLCONV" = "" ] ; then
|
||||||
|
echo "Error in setting the volume. The argument must be an integer value from"
|
||||||
|
echo " 1 through 10, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VOL=$VOLCONV
|
||||||
|
|
||||||
|
# make sure that the temp directory is there
|
||||||
|
if [ ! -d $TMPDIR ] ; then
|
||||||
|
mkdir -p $TMPDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -eq 0 ] ; then
|
||||||
|
echo "No arguments supplied"
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# call main function.
|
||||||
|
main
|
||||||
|
|
||||||
|
exit 0
|
||||||
@ -0,0 +1,144 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# tts-audio.sh - allstar Text to Speech
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# This scripts converts the file and calls the google-tts.py script
|
||||||
|
# to convert the text to an audio file (mp3).
|
||||||
|
#
|
||||||
|
#######################
|
||||||
|
# $Id: tts_audio.sh 24 2015-03-27 00:53:24Z w0anm $
|
||||||
|
|
||||||
|
# variables
|
||||||
|
TMPDIR=/tmp/tts
|
||||||
|
PID=$$
|
||||||
|
TMPFILE1=/tmp/tts/tmpfile1${PID}
|
||||||
|
TMPFILE2=/tmp/tts/tmpfile2${PID}
|
||||||
|
TTS_LOCK=$TMPDIR/lock_tts
|
||||||
|
VOL=8
|
||||||
|
|
||||||
|
old_IFS=$IFS
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
# setup lock file
|
||||||
|
readonly PROGNAME=$(basename "$0")
|
||||||
|
readonly LOCKFILE_DIR=$TMPDIR
|
||||||
|
readonly LOCK_FD=200
|
||||||
|
|
||||||
|
## Functions Start
|
||||||
|
|
||||||
|
lock() {
|
||||||
|
local prefix=$1
|
||||||
|
local fd=${2:-$LOCK_FD}
|
||||||
|
local lock_file=$LOCKFILE_DIR/$prefix.lock
|
||||||
|
|
||||||
|
# create lock file
|
||||||
|
eval "exec $fd>$lock_file"
|
||||||
|
|
||||||
|
# aquire the lock
|
||||||
|
flock -n $fd \
|
||||||
|
&& return 0 \
|
||||||
|
|| return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
help() {
|
||||||
|
echo
|
||||||
|
echo "$PROGNAME tts_audio.sh [-v <volume>] filename"
|
||||||
|
echo " Where the -v allows you to set the output volume generated by the script."
|
||||||
|
echo " The accepted values are 0-10, where 0 is the lowest and 10 is the "
|
||||||
|
echo " highest volume setting. If you do not use this option, the default"
|
||||||
|
echo " volume is 3."
|
||||||
|
echo
|
||||||
|
echo "For example:"
|
||||||
|
echo " tts_audio.sh -v 4 /tmp/hello.txt"
|
||||||
|
echo
|
||||||
|
echo "This will create a file called /tmp/hello.ul"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
|
||||||
|
#if lock is present, wait until lock is removed. Should only have
|
||||||
|
# one instance of this program running.
|
||||||
|
|
||||||
|
until lock $PROGNAME ; do
|
||||||
|
sleep 20
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# FILE=${1%%.*}
|
||||||
|
VOL=.35
|
||||||
|
espeak -s 150 -f $FILE -w ${TMPDIR}/audio.wav
|
||||||
|
sox --volume $VOL -V ${TMPDIR}/audio.wav -r 8000 -c 1 -t ul ${TMPDIR}/audio${PID}.ul &> /dev/null 2>&1
|
||||||
|
|
||||||
|
# swift -n Callie -m text -f $FILE -p audio/encoding=ulaw,audio/sampling-rate=8000,audio/volume=$VOL -o ${TMPDIR}/audio${PID}.ul
|
||||||
|
|
||||||
|
if [ ! -f ${TMPDIR}/audio${PID}.ul ] ; then
|
||||||
|
echo "Failed to convert wav file to u-law audio file (sox failure)"
|
||||||
|
echo "Aborting..."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=$old_IFS
|
||||||
|
mv ${TMPDIR}/audio${PID}.ul ${FILE%.txt}.ul
|
||||||
|
}
|
||||||
|
|
||||||
|
# end of functions...
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# main
|
||||||
|
|
||||||
|
# read the options
|
||||||
|
TEMP=`getopt -o a::sv: --long arga::,args,argv: -n 'tts_audio.sh' -- "$@"`
|
||||||
|
eval set -- "$TEMP"
|
||||||
|
|
||||||
|
# extract options and their arguments into variables.
|
||||||
|
while true ; do
|
||||||
|
case "$1" in
|
||||||
|
-a|--arga)
|
||||||
|
case "$2" in
|
||||||
|
"") ARG_A='some default value' ; shift 2 ;;
|
||||||
|
*) ARG_A=$2 ; shift 2 ;;
|
||||||
|
esac ;;
|
||||||
|
-s|--split) SPLIT=1 ; shift ;;
|
||||||
|
-v|--vol)
|
||||||
|
case "$2" in
|
||||||
|
"") shift 2 ;;
|
||||||
|
*) VOL=$2 ; shift 2 ;;
|
||||||
|
esac ;;
|
||||||
|
--) shift ; break ;;
|
||||||
|
*) echo "Internal error!" ; exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
FILE=$1
|
||||||
|
|
||||||
|
# VOL_ARRAY=(-0.0 -0.05 -0.1 -0.2 -0.3 -0.4 -0.5 -0.6 -0.7 -0.8 -0.9 )
|
||||||
|
VOL_ARRAY=(0 10 20 30 40 50 60 70 80 100 120 )
|
||||||
|
# get converted volume
|
||||||
|
VOLCONV=${VOL_ARRAY[$VOL]}
|
||||||
|
|
||||||
|
if [ "$VOLCONV" = "" ] ; then
|
||||||
|
echo "Error in setting the volume. The argument must be an integer value from"
|
||||||
|
echo " 1 through 10, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VOL=$VOLCONV
|
||||||
|
|
||||||
|
# make sure that the temp directory is there
|
||||||
|
if [ ! -d $TMPDIR ] ; then
|
||||||
|
mkdir -p $TMPDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -eq 0 ] ; then
|
||||||
|
echo "No arguments supplied"
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# call main function.
|
||||||
|
main
|
||||||
|
|
||||||
|
exit 0
|
||||||
@ -0,0 +1,139 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# tts-audio.sh - allstar Text to Speech
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# This scripts converts the file and calls the google-tts.py script
|
||||||
|
# to convert the text to an audio file (mp3).
|
||||||
|
#
|
||||||
|
#######################
|
||||||
|
# $Id: tts_audio.sh 24 2015-03-27 00:53:24Z w0anm $
|
||||||
|
|
||||||
|
# variables
|
||||||
|
TMPDIR=/tmp/tts
|
||||||
|
PID=$$
|
||||||
|
TMPFILE1=/tmp/tts/tmpfile1${PID}
|
||||||
|
TMPFILE2=/tmp/tts/tmpfile2${PID}
|
||||||
|
TTS_LOCK=$TMPDIR/lock_tts
|
||||||
|
VOL=1.5
|
||||||
|
|
||||||
|
old_IFS=$IFS
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
# setup lock file
|
||||||
|
readonly PROGNAME=$(basename "$0")
|
||||||
|
readonly LOCKFILE_DIR=$TMPDIR
|
||||||
|
readonly LOCK_FD=200
|
||||||
|
|
||||||
|
## Functions Start
|
||||||
|
|
||||||
|
lock() {
|
||||||
|
local prefix=$1
|
||||||
|
local fd=${2:-$LOCK_FD}
|
||||||
|
local lock_file=$LOCKFILE_DIR/$prefix.lock
|
||||||
|
|
||||||
|
# create lock file
|
||||||
|
eval "exec $fd>$lock_file"
|
||||||
|
|
||||||
|
# aquire the lock
|
||||||
|
flock -n $fd \
|
||||||
|
&& return 0 \
|
||||||
|
|| return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
help() {
|
||||||
|
echo
|
||||||
|
echo "$PROGNAME tts_audio.sh [-v <volume>] filename"
|
||||||
|
echo " Where the -v allows you to set the output volume generated by the script."
|
||||||
|
echo " The accepted values are 0-10, where 0 is the lowest and 10 is the "
|
||||||
|
echo " highest volume setting. If you do not use this option, the default"
|
||||||
|
echo " volume is 3."
|
||||||
|
echo
|
||||||
|
echo "For example:"
|
||||||
|
echo " tts_audio.sh -v 4 /tmp/hello.txt"
|
||||||
|
echo
|
||||||
|
echo "This will create a file called /tmp/hello.ul"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
|
||||||
|
#if lock is present, wait until lock is removed. Should only have
|
||||||
|
# one instance of this program running.
|
||||||
|
|
||||||
|
until lock $PROGNAME ; do
|
||||||
|
sleep 20
|
||||||
|
done
|
||||||
|
|
||||||
|
## swift -n Callie -m text -f $FILE -p audio/encoding=ulaw,audio/sampling-rate=8000,audio/volume=$VOL -o ${TMPDIR}/audio${PID}.ul
|
||||||
|
/usr/bin/text2wave -F 8000 -scale $VOL -otype ulaw $FILE -o ${TMPDIR}/audio${PID}.ul
|
||||||
|
|
||||||
|
if [ ! -f ${TMPDIR}/audio${PID}.ul ] ; then
|
||||||
|
echo "Failed to convert wav file to u-law audio file (sox failure)"
|
||||||
|
echo "Aborting..."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=$old_IFS
|
||||||
|
mv ${TMPDIR}/audio${PID}.ul ${FILE%.txt}.ul
|
||||||
|
}
|
||||||
|
|
||||||
|
# end of functions...
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# main
|
||||||
|
|
||||||
|
# read the options
|
||||||
|
TEMP=`getopt -o a::sv: --long arga::,args,argv: -n 'tts_audio.sh' -- "$@"`
|
||||||
|
eval set -- "$TEMP"
|
||||||
|
|
||||||
|
# extract options and their arguments into variables.
|
||||||
|
while true ; do
|
||||||
|
case "$1" in
|
||||||
|
-a|--arga)
|
||||||
|
case "$2" in
|
||||||
|
"") ARG_A='some default value' ; shift 2 ;;
|
||||||
|
*) ARG_A=$2 ; shift 2 ;;
|
||||||
|
esac ;;
|
||||||
|
-s|--split) SPLIT=1 ; shift ;;
|
||||||
|
-v|--vol)
|
||||||
|
case "$2" in
|
||||||
|
"") shift 2 ;;
|
||||||
|
*) VOL=$2 ; shift 2 ;;
|
||||||
|
esac ;;
|
||||||
|
--) shift ; break ;;
|
||||||
|
*) echo "Internal error!" ; exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
FILE=$1
|
||||||
|
|
||||||
|
VOL_ARRAY=(-0.0 .2 .4 .6 .8 1.0 1.2 1.4 1.6 1.8 2.0 )
|
||||||
|
# VOL_ARRAY=(0 10 20 30 40 50 60 70 80 100 120 )
|
||||||
|
# get converted volume
|
||||||
|
VOLCONV=${VOL_ARRAY[$VOL]}
|
||||||
|
|
||||||
|
if [ "$VOLCONV" = "" ] ; then
|
||||||
|
echo "Error in setting the volume. The argument must be an integer value from"
|
||||||
|
echo " 1 through 10, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VOL=$VOLCONV
|
||||||
|
|
||||||
|
# make sure that the temp directory is there
|
||||||
|
if [ ! -d $TMPDIR ] ; then
|
||||||
|
mkdir -p $TMPDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -eq 0 ] ; then
|
||||||
|
echo "No arguments supplied"
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# call main function.
|
||||||
|
main
|
||||||
|
|
||||||
|
exit 0
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
# README.txt - allstar w/google tts
|
||||||
|
#
|
||||||
|
# README.txt v0.1
|
||||||
|
# (wx_scripts - release 0.3)
|
||||||
|
# by w0anm
|
||||||
|
|
||||||
|
|
||||||
|
==== Additonal Notes Regarding "tts_audio.sh" Script ====
|
||||||
|
|
||||||
|
I now have a wrapper program that will lock the program so that only one
|
||||||
|
instance can be run at a time to prevent issues with the Text To Speech (TTS).
|
||||||
|
In addiion, For the TTS scripts, it's now a separate script that you can call.
|
||||||
|
It will return the ulaw file name once it's converted. There is one caveat,
|
||||||
|
the line needs to be less then 100 characters. If the sentence goes over
|
||||||
|
100 characters and you are using the -s option, there is a pause (like a
|
||||||
|
period) in the audio. It's important to keep your sentenances short. If
|
||||||
|
you are not using the -s option, then the line that has over 100 characters
|
||||||
|
will not be converted.
|
||||||
|
|
||||||
|
There is also an option to split the text file so that it will split on
|
||||||
|
periods and if the line length is greater that 100. Keep in mind that it
|
||||||
|
the line is split due to being greater that 100, it will have a pause in
|
||||||
|
the audio.
|
||||||
|
|
||||||
|
This script can be used to create other audio files. The syntax is:
|
||||||
|
|
||||||
|
tts_audio.sh [-s] [FILE]
|
||||||
|
|
||||||
|
where -s splits the file at periods and long lines.
|
||||||
|
|
||||||
|
This script will return a path/file to the converted ulaw audio file.
|
||||||
|
|
||||||
|
|
||||||
|
If you run into issues, please let me know.
|
||||||
|
|
||||||
|
73,
|
||||||
|
|
||||||
|
Chris, W0ANM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
blizzard_warn.gsm,BLIZZARD WARNING
|
||||||
|
blizzard_watch.gsm,BLIZZARD WATCH
|
||||||
|
blowing_snow_adv.gsm,BLOWING SNOW ADVISORY
|
||||||
|
civil_danger_warn.gsm,CIVIL DANGER WARNING
|
||||||
|
civil_emergency_msg.gsm,CIVIL EMERGENCY MESSAGE
|
||||||
|
dense_fog_adv.gsm,DENSE FOG ADVISORY
|
||||||
|
evac_immediate.gsm,EVACUATION IMMEDIATE
|
||||||
|
excess_heat_warn.gsm,EXCESSIVE HEAT WARNING
|
||||||
|
excexx_heat_watch.gsm,EXCESSIVE HEAT WATCH
|
||||||
|
flash_flood_warn.gsm,FLASH FLOOD WARNING
|
||||||
|
flood_watch.gsm,FLOOD WATCH
|
||||||
|
freeze_warn.gsm,FREEZE WARNING
|
||||||
|
freeze_driz_adv.gsm,FREEZING DRIZZLE ADVISORY
|
||||||
|
freeze_fog_adv.gsm,FREEZING FOG ADVISORY
|
||||||
|
freeze_rain_adv.gsm,FREEZING RAIN ADVISORY
|
||||||
|
frost_adv.gsm,FROST ADVISORY
|
||||||
|
heat_adv.gsm,HEAT ADVISORY
|
||||||
|
heavy_freez_spray_warn.gsm,HEAVY FREEZING SPRAY WARNING
|
||||||
|
heavy_sleet_warn.gsm,HEAVY SLEET WARNING
|
||||||
|
heavy_snow_warn.gsm,HEAVY SNOW WARNING
|
||||||
|
high_surf_adv.gsm,HIGH SURF ADVISORY
|
||||||
|
high_wind_warn.gsm,HIGH WIND WARNING
|
||||||
|
high_wind_watch.gsm,HIGH WIND WATCH
|
||||||
|
ice_storm_warn.gsm,ICE STORM WARNING
|
||||||
|
lake_effect_snow_adv.gsm,LAKE EFFECT SNOW ADVISORY
|
||||||
|
lake_effect_snow_warn.gsm,LAKE EFFECT SNOW WARNING
|
||||||
|
nuclear_power_plant_warn.gsm,NUCLEAR POWER PLANT WARNING
|
||||||
|
radiolog_hazard_warn.gsm,RADIOLOGICAL HAZARD WARNING
|
||||||
|
sev_thund_warn.gsm,SEVERE THUNDERSTORM WARNING
|
||||||
|
sev_thund_watch.gsm,SEVERE THUNDERSTORM WATCH
|
||||||
|
sleet_adv.gsm,SLEET ADVISORY
|
||||||
|
snow_adv.gsm,SNOW ADVISORY
|
||||||
|
snow_blow_adv.gsm,SNOW AND BLOWING SNOW ADVISORY
|
||||||
|
storm_warn.gsm,STORM WARNING
|
||||||
|
tornado_warn.gsm,TORNADO WARNING
|
||||||
|
tornado_watch.gsm,TORNADO WATCH
|
||||||
|
volcano_warn.gsm,VOLCANO WARNING
|
||||||
|
wind_adv.gsm,WIND ADVISORY
|
||||||
|
wind_chill_warn.gsm,WIND CHILL WARNING
|
||||||
|
wind_chill_watch.gsm,WIND CHILL WATCH
|
||||||
|
winter_storm_warn.gsm,WINTER STORM WARNING
|
||||||
|
winter_store_watch.gsm,WINTER STORM WATCH
|
||||||
|
winter_weather_adv.gsm,WINTER WEATHER ADVISORY
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# clearWxAlert - allstar wxscripts
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# Clears and removes playWxAlertBg lockfiles. This script should be used
|
||||||
|
# when debugging or during a force clear of alerts. The main function
|
||||||
|
# is to remove all of the playWxAlertBg programs, remove all lock files.
|
||||||
|
#
|
||||||
|
########################
|
||||||
|
# $Id: clearWxAlerts 12 2014-12-31 18:23:49Z w0anm $
|
||||||
|
|
||||||
|
# Load config file
|
||||||
|
WEATHER="/usr/local/etc/wx"
|
||||||
|
|
||||||
|
if [ -f ${WEATHER}/wx_scripts.conf ] ; then
|
||||||
|
source ${WEATHER}/wx_scripts.conf
|
||||||
|
else
|
||||||
|
echo "Missing ${WEATHER}/wx_scripts.conf file, aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
WXALERTDIR=${WXALERT_SPOOLDIR}
|
||||||
|
|
||||||
|
# Check if any playWxAlertBg files are running, if so, killem
|
||||||
|
echo -n "Stopping Weather Alert Messages..."
|
||||||
|
killall playWxAlertBg &> /dev/null 2>&1
|
||||||
|
echo " Done."
|
||||||
|
|
||||||
|
|
||||||
|
# cleanup the lock files
|
||||||
|
echo -n "Removing lock files from /tmp..."
|
||||||
|
rm -f /tmp/playWxAlertBg-lock &> /dev/null 2>&1
|
||||||
|
echo " Done."
|
||||||
|
|
||||||
|
# clean up the Alert directories
|
||||||
|
echo -n "Cleaning up the alert weather directories..."
|
||||||
|
rm -f $WXALERTDIR/*/* &> /dev/null 2>&1
|
||||||
|
echo " Done."
|
||||||
|
|
||||||
|
# clean up the tmp Wx Directories
|
||||||
|
echo -n "Removing temporary files in /tmp/wx.."
|
||||||
|
rm -f /tmp/wx/alert/* &> /dev/null 2>&1
|
||||||
|
echo " Done."
|
||||||
|
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Disable weather alert messages
|
||||||
|
# by adding $LOCAL/no_wxalert_msg file
|
||||||
|
# $Id: disable_wx_alertmsg 20 2015-03-08 23:29:23Z w0anm $
|
||||||
|
|
||||||
|
# This script can be call manually, by a cron entry, or by a dtmf sequence
|
||||||
|
# via rpt.conf
|
||||||
|
#
|
||||||
|
#Example of a cron entry:
|
||||||
|
# # enable Wx Alerts
|
||||||
|
# 0 7 * * * (/usr/local/bin/enable_wx_alertmsg &> /dev/null 2>&1))
|
||||||
|
# # disable Wx Alerts
|
||||||
|
# 0 23 * * * (/usr/local/bin/disable_wx_alertmsg &> /dev/null 2>&1))
|
||||||
|
|
||||||
|
#Example of rpt.conf entry:
|
||||||
|
# ; enable/disable alert messages
|
||||||
|
# 880=cmd,/usr/local/bin/disable_wx_alertmsg ; disable wx alert msgs
|
||||||
|
# 881=cmd,/usr/local/bin/enable_wx_alertmsg ; enable wx msgs
|
||||||
|
|
||||||
|
# Load config file
|
||||||
|
|
||||||
|
if [ -f /usr/local/etc/wx/wx_scripts.conf ] ; then
|
||||||
|
source /usr/local/etc/wx/${CUSTOM}/wx_scripts.conf
|
||||||
|
else
|
||||||
|
echo "Missing /usr/local/etc/wx/wx_scripts.conf file, aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f $LOCAL/no_wxalert_msg ] ; then
|
||||||
|
touch $LOCAL/no_wxalert_msg
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f $LOCAL/disable.ul ] ; then
|
||||||
|
# create tts
|
||||||
|
echo "Weather Alert messages disabled." > $LOCAL/disable.txt
|
||||||
|
tts_audio.sh $LOCAL/disable.txt
|
||||||
|
rm -f $LOCAL/disable.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f $LOCAL/disable.ul ] ; then
|
||||||
|
# play
|
||||||
|
asterisk -rx "rpt localplay $NODE1 $LOCAL/disable"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# enable weather alert messages
|
||||||
|
# by adding $LOCAL/no_wxalert_msg file
|
||||||
|
# $Id: enable_wx_alertmsg 20 2015-03-08 23:29:23Z w0anm $
|
||||||
|
|
||||||
|
# This script can be call manually, by a cron entry, or by a dtmf sequence
|
||||||
|
# via rpt.conf
|
||||||
|
#
|
||||||
|
#Example of a cron entry:
|
||||||
|
# # enable Wx Alerts
|
||||||
|
# 0 7 * * * (/usr/local/bin/enable_wx_alertmsg &> /dev/null 2>&1))
|
||||||
|
# # disable Wx Alerts
|
||||||
|
# 0 23 * * * (/usr/local/bin/disable_wx_alertmsg &> /dev/null 2>&1))
|
||||||
|
|
||||||
|
#Example of rpt.conf entry:
|
||||||
|
# ; enable/disable alert messages
|
||||||
|
# 880=cmd,/usr/local/bin/disable_wx_alertmsg ; disable wx alert msgs
|
||||||
|
# 881=cmd,/usr/local/bin/enable_wx_alertmsg ; enable wx msgs
|
||||||
|
|
||||||
|
# Load config file
|
||||||
|
|
||||||
|
if [ -f /usr/local/etc/wx/wx_scripts.conf ] ; then
|
||||||
|
source /usr/local/etc/wx/wx_scripts.conf
|
||||||
|
else
|
||||||
|
echo "Missing /usr/local/etc/wx/wx_scripts.conf file, aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f $LOCAL/no_wxalert_msg ] ; then
|
||||||
|
rm $LOCAL/no_wxalert_msg
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f $LOCAL/enable.ul ] ; then
|
||||||
|
# create tts
|
||||||
|
echo "Weather Alert messages enabled." > $LOCAL/enable.txt
|
||||||
|
tts_audio.sh $LOCAL/enable.txt
|
||||||
|
rm -f $LOCAL/ensable.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f $LOCAL/enable.ul ] ; then
|
||||||
|
# play
|
||||||
|
asterisk -rx "rpt localplay $NODE1 $LOCAL/enable"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
@ -0,0 +1,476 @@
|
|||||||
|
# ew wx alert
|
||||||
|
|
||||||
|
#
|
||||||
|
DEBUG="2" # debug levels 0 = no debug
|
||||||
|
# 1 = save alerts
|
||||||
|
# 2 = detailed info
|
||||||
|
# 3 = special debug only
|
||||||
|
|
||||||
|
|
||||||
|
# sound files
|
||||||
|
SOUND_DIR=/usr/local/share/sound/wx
|
||||||
|
|
||||||
|
|
||||||
|
# Script config location
|
||||||
|
WEATHER="/usr/local/etc/wx"
|
||||||
|
|
||||||
|
# Load config file
|
||||||
|
if [ -f ${WEATHER}/wx_scripts.conf ] ; then
|
||||||
|
source ${WEATHER}/wx_scripts.conf
|
||||||
|
else
|
||||||
|
echo "Missing ${WEATHER}/wx_scripts.conf file, aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# override from config file
|
||||||
|
WXALERT_SPOOLDIR=/tmp/wx_test/alert
|
||||||
|
|
||||||
|
# Check Arguments...
|
||||||
|
# has only one argument, county info
|
||||||
|
if [ "$#" = "1" ] ; then
|
||||||
|
COUNTY=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if no arguments, then error.
|
||||||
|
if [ "$1" = "" ] ; then
|
||||||
|
echo "Missing Argument, need wx underground station id.."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$COUNTY" = "help" ] ; then # If no arguments
|
||||||
|
echo "Usage getWxAlert <county>"
|
||||||
|
echo " where <county>=State County, for example: WIC002"
|
||||||
|
echo " See http://alerts.weather.gov/ for more informaton"
|
||||||
|
echo
|
||||||
|
echo " Or you can edit the wx_scripts.conf file to include the COUNTY variable."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d /tmp/wx_test/alert/$COUNTY ] ; then
|
||||||
|
mkdir -p /tmp/wx_test/alert/$COUNTY
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
####### Functions ######
|
||||||
|
# Send message to LOGFILE
|
||||||
|
function debug2 () {
|
||||||
|
MESSAGE="${0##*/} DEBUG: $@"
|
||||||
|
echo "$MESSAGE"
|
||||||
|
if [ -n "$LOGFILE" ]; then
|
||||||
|
echo "$(date '+%b %d %Y %T %z') $MESSAGE" >> $LOGFILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Send message to LOGFILE without echo to standard
|
||||||
|
function debug3 () {
|
||||||
|
MESSAGE="${0##*/} DEBUG: $@"
|
||||||
|
if [ -n "$LOGFILE" ]; then
|
||||||
|
echo "$(date '+%b %d %Y %T %z') $MESSAGE" >> $LOGFILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# download alert for parsing
|
||||||
|
PLIST="$WEATHER/wx_alert_product.txt" # Product list file and directory
|
||||||
|
# standard
|
||||||
|
#URL="http://alerts.weather.gov/cap/wwaatmget.php?x=" # URL to RSS data
|
||||||
|
URL="https://api.weather.gov/alerts/active.atom?zone="
|
||||||
|
# TEST ONLY
|
||||||
|
# URL="http://raspweb.w0anm.com/wx_test/MNC171_alert.info" # URL to RSS data
|
||||||
|
DATE=`date +%Y.%m.%d.\%H\%M`
|
||||||
|
NO_WXALERT_MSG=$LOCAL/no_wxalert_msg
|
||||||
|
|
||||||
|
# MAIL=/bin/mail # mail binary
|
||||||
|
# MAIL="/usr/local/bin/sendmail_g.pl" # gmail SendMail script
|
||||||
|
# MAIL="/usr/local/bin/sendmail-gm.py" # gmail SendMail script
|
||||||
|
# CRIT_tTYPES=`cat $WEATHER/wx_critical_alerts.txt`
|
||||||
|
NORM_TYPES=`cat $WEATHER/wx_normal_alerts.txt`
|
||||||
|
## NORM_TYPES=`cat $WEATHER/alert_test.txt`
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------- Main program ----------------------
|
||||||
|
|
||||||
|
if [ ! -d $WXALERT_SPOOLDIR/$COUNTY ] ; then
|
||||||
|
mkdir -p $WXALERT_SPOOLDIR/$COUNTY
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d /tmp/wx_test/alert/$COUNTY ] ; then
|
||||||
|
mkdir -p /tmp/wx_test/alert/$COUNTY
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $WXALERT_SPOOLDIR/$COUNTY
|
||||||
|
|
||||||
|
ALERT_DL=""
|
||||||
|
CHKCNT=0
|
||||||
|
# loop until get proper response, if after 5 attempts notify
|
||||||
|
while [ -z "$ALERT_DL" ] ; do
|
||||||
|
|
||||||
|
if [ $CHKCNT -gt 5 ] ; then
|
||||||
|
log "ERROR: $URL is not responding for getWxAlert - ${COUNTY}"
|
||||||
|
log " Possible issue with nws.gov server or internet connection"
|
||||||
|
ls -l /tmp/wx_test/alert/$COUNTY/alert.info
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Alternative method of getting url information:
|
||||||
|
##/usr/bin/lynx -dump $URL$COUNTY > /tmp/wx_test/alert/$COUNTY/alert.info
|
||||||
|
|
||||||
|
# remove old alert.info file
|
||||||
|
if [ -f /tmp/wx_test/alert/$COUNTY/alert.info ] ; then
|
||||||
|
rm /tmp/wx_test/alert/$COUNTY/alert.info
|
||||||
|
fi
|
||||||
|
|
||||||
|
# $WGET -t 10 -w 10 --cache=off --random-wait -q $URL$COUNTY -O - > /tmp/wx_test/alert/$COUNTY/alert.info
|
||||||
|
$WGET --no-cache --no-dns-cache --tries=10 --random-wait -q $URL$COUNTY -O - > /tmp/wx_test/alert/$COUNTY/alert.info
|
||||||
|
# -t 10 retries, -w 10 sec between
|
||||||
|
# turn cache off at server
|
||||||
|
|
||||||
|
# place data in variable to see if contains data
|
||||||
|
ALERT_DL="`head -1 /tmp/wx_test/alert/$COUNTY/alert.info`"
|
||||||
|
let CHKCNT=$CHKCNT+1
|
||||||
|
# delay before retrying
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
# Added for validation of data, test only
|
||||||
|
# cp /tmp/wx_test/alert/$COUNTY/alert.info /tmp/debug/alert.info_$DATE
|
||||||
|
|
||||||
|
#test to see if title duplicates
|
||||||
|
grep "title>" /tmp/wx_test/alert/$COUNTY/alert.info | sed '/<title>/,/<\/title/!d' | sed 's/<title>//' | sed 's/<\/title>//' | egrep -v "Current Watches" > /tmp/wx_test/alert/$COUNTY/alert_watches
|
||||||
|
|
||||||
|
# Attempt to address the issue with duplicate entries using wget and NWS URL.
|
||||||
|
|
||||||
|
NLINES=`wc -l /tmp/wx_test/alert/$COUNTY/alert_watches`
|
||||||
|
|
||||||
|
if [ ! "$NLINES" = 1 ] ; then
|
||||||
|
#get first line
|
||||||
|
FIRSTLINE=`head -1 /tmp/wx_test/alert/$COUNTY/alert_watches`
|
||||||
|
|
||||||
|
# check for dups
|
||||||
|
NDUPS=`grep "$FIRSTLINE" /tmp/wx_test/alert/$COUNTY/alert_watches | wc -l`
|
||||||
|
NUNIQ=`uniq /tmp/wx_test/alert/$COUNTY/alert_watches | wc -l`
|
||||||
|
|
||||||
|
if [ ! "$NDUPS" = "1" ] ; then
|
||||||
|
if [ "$DEBUG" = "3" ] ; then
|
||||||
|
debug3 "NWS alert data is BAD"
|
||||||
|
debug3 " First Line: $FIRSTLINE"
|
||||||
|
debug3 " NDUPS: $NDUPS"
|
||||||
|
debug3 " NUNIQ: $NUNIQ"
|
||||||
|
debug3 " NLINES: $NLINES"
|
||||||
|
debug3 "Exiting.."
|
||||||
|
debug3
|
||||||
|
fi
|
||||||
|
debug3 "NWS alert data is BAD"
|
||||||
|
rm -f /tmp/wx_test/alert/$COUNTY/alert_watches
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$DEBUG" = "3" ] ; then
|
||||||
|
debug3 "NWS alert data is OK"
|
||||||
|
debug3 " First Line: $FIRSTLINE"
|
||||||
|
debug3 " NDUPS: $NDUPS"
|
||||||
|
debug3 " NUNIQ: $NUNIQ"
|
||||||
|
debug3
|
||||||
|
fi
|
||||||
|
|
||||||
|
debug3 "NWS alert data is OK"
|
||||||
|
rm -f /tmp/wx_test/alert/$COUNTY/alert_watches
|
||||||
|
|
||||||
|
## done with test code
|
||||||
|
|
||||||
|
# process the downloaded information
|
||||||
|
cat /tmp/wx_test/alert/$COUNTY/alert.info | \
|
||||||
|
grep "title>" | \
|
||||||
|
sed '/<title>/,/<\/title/!d' | \
|
||||||
|
sed 's/<title>//' | sed 's/<\/title>//' | \
|
||||||
|
egrep -v "Current Watches" > wx_new.txt
|
||||||
|
|
||||||
|
# get full summary URL Link
|
||||||
|
FULL_SUMMARY_URL=`cat /tmp/wx_test/alert/$COUNTY/alert.info | egrep "<id>|</id>" | sed 's/<id>//' | sed 's/<\/id>//' | grep capget | tr -d '\r'`
|
||||||
|
|
||||||
|
# Extract Alert from url information:
|
||||||
|
ALERT=`cat /tmp/wx_test/alert/$COUNTY/alert.info | egrep "<title>|</title>" | sed 's/<title>//' | sed 's/<\/title>//'| sed 's/\(by NWS*\).*/\1/' | sed 's/by NWS//'`
|
||||||
|
|
||||||
|
# Extract Summary from url information:
|
||||||
|
SUMMARY=`cat /tmp/wx_test/alert/$COUNTY/alert.info | egrep "<summary>|</summary>" | sed 's/<summary>//' | sed 's/<\/summary>//'`
|
||||||
|
|
||||||
|
# Debug stuff, print values for $ALERT and SUMMARY
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
echo
|
||||||
|
debug2 "************START**************************"
|
||||||
|
debug2 "NWS_URL=$URL"
|
||||||
|
debug2 "FULL_SUMMARY_URL=$FULL_SUMMARY_URL"
|
||||||
|
debug2 "CHKCNT=$CHKCNT"
|
||||||
|
debug2 "ALERT=$ALERT"
|
||||||
|
debug2 "SUMMARY=$SUMMARY"
|
||||||
|
debug2 "COUNTY=$COUNTY"
|
||||||
|
debug2 "COUNTY_NAME=$COUNTY_NAME"
|
||||||
|
debug2 "VALID_ALERT=$VALID_ALERT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Full_alert
|
||||||
|
echo "$ALERT ... $SUMMARY" > alert_summary.txt
|
||||||
|
#if the download failed, alert_summary.txt has only " ... ", then log and exit.
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
DWNCHK=`cat alert_summary.txt`
|
||||||
|
echo
|
||||||
|
debug2 "dwnload chk:$DWNCHK"
|
||||||
|
fi
|
||||||
|
if [ "`cat alert_summary.txt`" == " ... " ] ; then
|
||||||
|
log "ERROR: Failed to download alert correct data from ${COUNTY}"
|
||||||
|
log " Verify $COUNTY is valid or URL has not changed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#====================================
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
# check if no active watches, if so clean up any alerts and create
|
||||||
|
# no watches message for summary.
|
||||||
|
if ( grep "no active watches" wx_new.txt &> /dev/null ) ; then
|
||||||
|
|
||||||
|
# skip all of this if no_alert file is present indicating audio generated
|
||||||
|
if [ ! -f no_alerts.txt ] ; then
|
||||||
|
rm -f *.ul # Remove all alerts, audio files
|
||||||
|
rm -f alert.txt
|
||||||
|
|
||||||
|
# alert_summary.txt and alert_pre_summary.txt must match, or will
|
||||||
|
# generate an alert
|
||||||
|
##
|
||||||
|
cp alert_summary.txt alert_prev_summary.txt
|
||||||
|
cp wx_new.txt no_alerts.txt # After clean up, create
|
||||||
|
# "no active warnings file
|
||||||
|
|
||||||
|
# no alert
|
||||||
|
# cp $SOUND_DIR/no_alerts.gsm alert_short.gsm
|
||||||
|
|
||||||
|
fi # < if [ -f no_alerts.txt ]
|
||||||
|
exit 0 # Done, now exit.
|
||||||
|
fi
|
||||||
|
log "Checking for Wx Alert updates for $COUNTY"
|
||||||
|
# Skip if files are the same, alerts are active, but nothing has changed.
|
||||||
|
####if ! diff -q alert_summary.txt alert_prev_summary.txt &> /dev/null; then
|
||||||
|
|
||||||
|
# New Alerts are found.
|
||||||
|
log "New Wx Alerts for $COUNTY"
|
||||||
|
cp alert_summary.txt alert_prev_summary.txt # make the files the same now
|
||||||
|
rm -f alert.txt *.raw no_alerts.txt # and remove old alerts
|
||||||
|
# remove email alert file
|
||||||
|
if [ -f /tmp/wx_test/alert/${COUNTY}/email_alert.txt ] ; then
|
||||||
|
rm -f /tmp/wx_test/alert/${COUNTY}/email_alert.txt
|
||||||
|
fi
|
||||||
|
# remove the old plist.txt file.
|
||||||
|
if [ -f plist.txt ] ; then
|
||||||
|
cp plist.txt /tmp/.
|
||||||
|
rm plist.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create the alert file
|
||||||
|
echo "$ALERT" > alert.txt
|
||||||
|
|
||||||
|
# Create the product list which is tested against
|
||||||
|
# if product not found, will leave a null file. This is tested against
|
||||||
|
# at end of script, see ref#1
|
||||||
|
while read PRODUCT; do # Check for alert products
|
||||||
|
# appending the 1st matching, ignore case
|
||||||
|
grep -i -m 1 "^$PRODUCT" wx_new.txt
|
||||||
|
done < $PLIST >> plist.txt # line to alert.txt file
|
||||||
|
|
||||||
|
echo "cat -->"
|
||||||
|
cat plist.txt
|
||||||
|
|
||||||
|
echo "$PLIST"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
####fi
|
||||||
|
#################################################################
|
||||||
|
# Pre Conversions file creation.
|
||||||
|
#################################################################
|
||||||
|
# create pre_alert.txt file (input to post conversion)
|
||||||
|
#
|
||||||
|
|
||||||
|
# check the alert types, critical/normal
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
debug2 "********* WXALERT_BEACON=[$WXALERT_BEACON] **********"
|
||||||
|
fi
|
||||||
|
# Setup TYPES of alerts to trigger on depending upon WXALERT_BEACON Variable
|
||||||
|
if [ "$WXALERT_BEACON" = "C" ] ; then
|
||||||
|
TYPES=$CRIT_TYPES
|
||||||
|
else
|
||||||
|
TYPES=$NORM_TYPES
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set flag
|
||||||
|
CRIT_BEACON_FLAG="N"
|
||||||
|
SAVEIFS=$IFS
|
||||||
|
IFS=$(echo -en "\n\b")
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
debug2 "TYPES= $TYPES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for matching TYPES in alert
|
||||||
|
for TYPE in $TYPES
|
||||||
|
do
|
||||||
|
## added space to avoid the first line being seen as an alert
|
||||||
|
## this may need to be changed as follows:
|
||||||
|
# egrep -v "Current Watches" alert.txt > alert1.txt
|
||||||
|
# mv alert1.txt alert
|
||||||
|
## if grep -i "$TYPE" alert.txt >> /tmp/wx_test/alert/$COUNTY/a_tmp.txt; then # Extract matching alerts
|
||||||
|
if grep -i "$TYPE " alert.txt >> /tmp/wx_test/alert/$COUNTY/a_tmp.txt; then # Extract matching alerts
|
||||||
|
#set up header of the alert file
|
||||||
|
echo "Weather Alert. for $COUNTY_NAME" > /tmp/wx_test/alert/$COUNTY/a_tmp.txt
|
||||||
|
echo ".." >> /tmp/wx_test/alert/$COUNTY/a_tmp.txt
|
||||||
|
log "Get Wx Alert INFO for $COUNTY: $TYPE"
|
||||||
|
# set critical beacon flag, if a match
|
||||||
|
CRIT_BEACON_FLAG="Y"
|
||||||
|
VALID_ALERT=yes
|
||||||
|
else
|
||||||
|
VALID_ALERT=no
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS=$SAVEIFS
|
||||||
|
|
||||||
|
# # rename to pre_alert.txt
|
||||||
|
mv /tmp/wx_test/alert/$COUNTY/a_tmp.txt /tmp/wx_test/alert/$COUNTY/pre_alert.txt
|
||||||
|
#
|
||||||
|
# #############################
|
||||||
|
# # create pre_conv_alert_summmary.txt (input to post conversion)
|
||||||
|
# # insert weather header/trailer to full alert txt
|
||||||
|
# echo ". . Weather Alert Summary for County $COUNTY_NAME." > /tmp/wx_test/alert/$COUNTY/a_tmp.txt
|
||||||
|
# cat alert_summary.txt >> /tmp/wx_test/alert/$COUNTY/a_tmp.txt
|
||||||
|
#
|
||||||
|
# # copy tmp.txt over for post conversion
|
||||||
|
# cp /tmp/wx_test/alert/$COUNTY/a_tmp.txt /tmp/wx_test/alert/$COUNTY/pre_conv_alert_summary.txt
|
||||||
|
#
|
||||||
|
# reset file
|
||||||
|
echo "" > /tmp/wx_test/alert/$COUNTY/full_alert_info.txt
|
||||||
|
# if multiple URL's go through them
|
||||||
|
for URL in $FULL_SUMMARY_URL ; do
|
||||||
|
|
||||||
|
# reset while variables
|
||||||
|
ALERT_DL=""
|
||||||
|
CHKCNT=0
|
||||||
|
|
||||||
|
# loop until get proper response, if after 5 attempts notify
|
||||||
|
while [ -z "$ALERT_DL" ] ; do
|
||||||
|
|
||||||
|
if [ $CHKCNT -gt 5 ] ; then
|
||||||
|
log "ERROR: $URL is not responding for getWxAlert - ${COUNTY}"
|
||||||
|
log " Possible issue with nws.gov server or internet connection"
|
||||||
|
ls -l /tmp/wx_test/alert/$COUNTY/full_alert_info.txt
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Create the raw full Summary File
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
debug2 "FULL_SUMMARY_URL Entry: $URL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create full summary from URL file
|
||||||
|
$WGET -t 10 -w 10 --cache=off --random-wait -q $URL -O - | sed '/<description>/,/<\/description/!d' | \
|
||||||
|
sed 's/<description>//' | \
|
||||||
|
sed 's/<\/description>//' >> /tmp/wx_test/alert/$COUNTY/full_alert_info.txt
|
||||||
|
# -t 10 retries, -w 10 sec between
|
||||||
|
# turn cache off at server
|
||||||
|
# check if anything downloaded
|
||||||
|
ALERT_DL="`tail -1 /tmp/wx_test/alert/$COUNTY/full_alert_info.txt`"
|
||||||
|
echo "ALERT_DL=$ALERT_DL"
|
||||||
|
let CHKCNT=$CHKCNT+1
|
||||||
|
|
||||||
|
echo " " >> /tmp/wx_test/alert/$COUNTY/full_alert_info.txt
|
||||||
|
# copy the full alert prior to appending
|
||||||
|
# url information.
|
||||||
|
# cp /tmp/wx_test/alert/$COUNTY/full_alert_info.txt /tmp/wx_test/alert/$COUNTY/pre_full_alert_info.txt
|
||||||
|
#
|
||||||
|
# echo "For more information:" >> /tmp/wx_test/alert/$COUNTY/full_alert_info.txt
|
||||||
|
# echo $URL >> /tmp/wx_test/alert/$COUNTY/full_alert_info.txt
|
||||||
|
# echo "==================================================================" >> /tmp/wx_test/alert/$COUNTY/full_alert_info.txt
|
||||||
|
# echo " " >> /tmp/wx_test/alert/$COUNTY/full_alert_info.txt
|
||||||
|
#
|
||||||
|
# delay before retrying
|
||||||
|
sleep 4
|
||||||
|
done # while loop
|
||||||
|
done # loop url's
|
||||||
|
|
||||||
|
# additional debug info
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
debug2 "**************************************************************"
|
||||||
|
debug2 "**alert's don't match**"
|
||||||
|
debug2 "=============================================================="
|
||||||
|
debug2 "alert_summary file:"
|
||||||
|
debug2 " /tmp/wx_test/alert/${COUNTY}/alert_summary.txt"
|
||||||
|
debug2 "=============================================================="
|
||||||
|
debug2 "alert_prev_summary.txt file:"
|
||||||
|
debug2 " /tmp/wx_test/alert/${COUNTY}/alert_prev_summary.txt"
|
||||||
|
debug2 "=============================================================="
|
||||||
|
debug2 "pre_full_alert_info.txt file:"
|
||||||
|
debug2 " /tmp/wx_test/alert/${COUNTY}/pre_full_alert_info.txt"
|
||||||
|
debug2 "**************************************************************"
|
||||||
|
debug2
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Create GSM files for the alert. This will be based upon the plist.txt file.
|
||||||
|
# can plist file with Product, if match, then create new gsm list.
|
||||||
|
# Need initial wx_alert message.
|
||||||
|
# then the remaining alerts.
|
||||||
|
set -x
|
||||||
|
|
||||||
|
while read PRODUCT; do # Check for alert products
|
||||||
|
# appending the 1st matching, ignore case
|
||||||
|
# grep -i -m 1 "^$PRODUCT" /usr/local/etc/wx/wx_normal_alerts.txt
|
||||||
|
grep -i -m 1 "$PRODUCT" /usr/local/etc/wx/alert_test.txt | awk 'BEGIN { FS = "," } ; { print $1 }'
|
||||||
|
done < $PLIST >> gsm_list.txt # line to alert.txt file
|
||||||
|
|
||||||
|
# grep -i "blizzard warning" alert_test.txt | awk 'BEGIN { FS = "," } ; { print $1 }'
|
||||||
|
set +x
|
||||||
|
|
||||||
|
|
||||||
|
# check if file exists and size gt zero, if not email/play weather (ref#1)
|
||||||
|
if [ -s plist.txt ]; then
|
||||||
|
# Email Alerts if $EMAIL defined.
|
||||||
|
if [ ! -z "$EMAIL" ] ; then
|
||||||
|
send_email
|
||||||
|
fi
|
||||||
|
# if WXALERT_BEACON is set to Yes, then place playWxAlertBg into
|
||||||
|
# background
|
||||||
|
#
|
||||||
|
# Beacon needs to be Y -or- (beacon C -and- Crit_Beacon flag yes)
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
echo "WXALERT_BEACON = $WXALERT_BEACON, CRIT_BEACON_FLAG=$CRIT_BEACON_FLAG"
|
||||||
|
fi
|
||||||
|
if [ $WXALERT_BEACON = "Y" ] || ([ $WXALERT_BEACON = "C" ] && [ $CRIT_BEACON_FLAG = "Y" ]) ; then
|
||||||
|
# first kill any left over process
|
||||||
|
# get PID and kill it
|
||||||
|
if [ -f $WXALERT_SPOOLDIR/$COUNTY/playWxAlertBg.pid ] ; then
|
||||||
|
kill `cat < playWxAlertBg.pid`
|
||||||
|
fi
|
||||||
|
# if $LOCAL/no_wxalert_msg file is present, remove it to start
|
||||||
|
# new weather alert msg
|
||||||
|
if [ -f $NO_WXALERT_MSG ] ; then
|
||||||
|
rm $NO_WXALERT_MSG
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$VALID_ALERT" = "yes" ] ; then #cjk
|
||||||
|
# call playWxAlert and place in background
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
debug2 "********* Launching Debug Version of playWxAlert **********"
|
||||||
|
bash -x /usr/local/bin/playWxAlertBg $COUNTY 2>&1 | tee /tmp/WX_DEBUG &
|
||||||
|
else
|
||||||
|
log "Launching playWxAlertBg..."
|
||||||
|
/usr/local/bin/playWxAlertBg $COUNTY &
|
||||||
|
fi # debug
|
||||||
|
fi # wxalert beacon
|
||||||
|
fi # valid cjke
|
||||||
|
fi # -s plist.txt
|
||||||
|
## cjk
|
||||||
|
# fi ; # comment out due to the first if command commented.
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,559 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# getWxAlert - allstar wxscripts
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# ---------------
|
||||||
|
# Copyright (C) 2015, 2016 Christopher Kovacs, W0ANM
|
||||||
|
#
|
||||||
|
# This program 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.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||||
|
# ---------------
|
||||||
|
#
|
||||||
|
#####################
|
||||||
|
# $Id: getWxAlert 24 2015-03-27 00:53:24Z w0anm $
|
||||||
|
|
||||||
|
# renice the proceses to a lower priority
|
||||||
|
renice -n 19 -p $$
|
||||||
|
|
||||||
|
DEBUG="0" # debug levels 0 = no debug
|
||||||
|
# 1 = save alerts
|
||||||
|
# 2 = detailed info
|
||||||
|
# 3 = special debug only
|
||||||
|
# Script config location
|
||||||
|
WEATHER="/usr/local/etc/wx"
|
||||||
|
|
||||||
|
# Load config file
|
||||||
|
if [ -f ${WEATHER}/wx_scripts.conf ] ; then
|
||||||
|
source ${WEATHER}/wx_scripts.conf
|
||||||
|
else
|
||||||
|
echo "Missing ${WEATHER}/wx_scripts.conf file, aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check Arguments...
|
||||||
|
# has only one argument, county info
|
||||||
|
if [ "$#" = "1" ] ; then
|
||||||
|
COUNTY=$1
|
||||||
|
COUNTY_NAME=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# has two arguments, county info and county name
|
||||||
|
if [ "$#" = "2" ] ; then
|
||||||
|
COUNTY=$1
|
||||||
|
COUNTY_NAME=$2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if no arguments, then error.
|
||||||
|
if [ "$1" = "" ] ; then
|
||||||
|
echo "Missing Argument, need wx underground station id.."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$COUNTY" = "help" ] ; then # If no arguments
|
||||||
|
echo "Usage getWxAlert <county>"
|
||||||
|
echo " where <county>=State County, for example: WIC002"
|
||||||
|
echo " See http://alerts.weather.gov/ for more informaton"
|
||||||
|
echo
|
||||||
|
echo " Or you can edit the wx_scripts.conf file to include the COUNTY variable."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d /tmp/wx/alert/$COUNTY ] ; then
|
||||||
|
mkdir -p /tmp/wx/alert/$COUNTY
|
||||||
|
fi
|
||||||
|
|
||||||
|
####### Functions ######
|
||||||
|
# Send message to LOGFILE
|
||||||
|
function debug2 () {
|
||||||
|
MESSAGE="${0##*/} DEBUG: $@"
|
||||||
|
echo "$MESSAGE"
|
||||||
|
if [ -n "$LOGFILE" ]; then
|
||||||
|
echo "$(date '+%b %d %Y %T %z') $MESSAGE" >> $LOGFILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Send message to LOGFILE without echo to standard
|
||||||
|
function debug3 () {
|
||||||
|
MESSAGE="${0##*/} DEBUG: $@"
|
||||||
|
if [ -n "$LOGFILE" ]; then
|
||||||
|
echo "$(date '+%b %d %Y %T %z') $MESSAGE" >> $LOGFILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function send_email () {
|
||||||
|
for EADDR in $(echo $EMAIL | sed 's/,/ /g') ; do
|
||||||
|
|
||||||
|
# summary version
|
||||||
|
# $MAIL -s "Weather Alert for $COUNTY_NAME" $EADDR < /tmp/wx/alert/$COUNTY/pre_conv_alert_summary.txt
|
||||||
|
|
||||||
|
# full alert info
|
||||||
|
cp /tmp/wx/alert/$COUNTY/pre_alert.txt /tmp/wx/alert/$COUNTY/email_alert.txt
|
||||||
|
|
||||||
|
# append the alert to the header
|
||||||
|
cat /tmp/wx/alert/$COUNTY/full_alert_info.txt >> /tmp/wx/alert/$COUNTY/email_alert.txt
|
||||||
|
|
||||||
|
# mail it
|
||||||
|
$MAIL -s "Weather Alert for $COUNTY_NAME" -e $EADDR < /tmp/wx/alert/$COUNTY/email_alert.txt
|
||||||
|
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
### ADD TTS CALL in function
|
||||||
|
TextToSpeech () {
|
||||||
|
TTS_PROGRAM="/usr/local/bin/tts_audio.sh -v ${WXVOL} "
|
||||||
|
$TTS_PROGRAM $1
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
echo "TextToSpeech=$1"
|
||||||
|
echo "Converted audio file=${1%.txt}.ul"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
###### End of Functions ######
|
||||||
|
PLIST="$WEATHER/wx_alert_product.txt" # Product list file and directory
|
||||||
|
# standard
|
||||||
|
URL="http://alerts.weather.gov/cap/wwaatmget.php?x=" # URL to RSS data
|
||||||
|
|
||||||
|
# TEST ONLY
|
||||||
|
# URL="http://raspweb.w0anm.com/wx_test/MNC171_alert.info" # URL to RSS data
|
||||||
|
DATE=`date +%Y.%m.%d.\%H\%M`
|
||||||
|
NO_WXALERT_MSG=$LOCAL/no_wxalert_msg
|
||||||
|
|
||||||
|
# MAIL=/bin/mail # mail binary
|
||||||
|
# MAIL="/usr/local/bin/sendmail_g.pl" # gmail SendMail script
|
||||||
|
MAIL="/usr/local/bin/sendmail-gm.py" # gmail SendMail script
|
||||||
|
|
||||||
|
CRIT_TYPES=`cat $WEATHER/wx_critical_alerts.txt`
|
||||||
|
NORM_TYPES=`cat $WEATHER/wx_normal_alerts.txt`
|
||||||
|
|
||||||
|
#----------------------------- Main program ----------------------
|
||||||
|
|
||||||
|
if [ ! -d $WXALERT_SPOOLDIR/$COUNTY ] ; then
|
||||||
|
mkdir -p $WXALERT_SPOOLDIR/$COUNTY
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d /tmp/wx/alert/$COUNTY ] ; then
|
||||||
|
mkdir -p /tmp/wx/alert/$COUNTY
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $WXALERT_SPOOLDIR/$COUNTY
|
||||||
|
|
||||||
|
ALERT_DL=""
|
||||||
|
CHKCNT=0
|
||||||
|
# loop until get proper response, if after 5 attempts notify
|
||||||
|
while [ -z "$ALERT_DL" ] ; do
|
||||||
|
|
||||||
|
if [ $CHKCNT -gt 5 ] ; then
|
||||||
|
log "ERROR: $URL is not responding for getWxAlert - ${COUNTY}"
|
||||||
|
log " Possible issue with nws.gov server or internet connection"
|
||||||
|
ls -l /tmp/wx/alert/$COUNTY/alert.info
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Alternative method of getting url information:
|
||||||
|
##/usr/bin/lynx -dump $URL$COUNTY > /tmp/wx/alert/$COUNTY/alert.info
|
||||||
|
|
||||||
|
# remove old alert.info file
|
||||||
|
if [ -f /tmp/wx/alert/$COUNTY/alert.info ] ; then
|
||||||
|
rm /tmp/wx/alert/$COUNTY/alert.info
|
||||||
|
fi
|
||||||
|
|
||||||
|
# $WGET -t 10 -w 10 --cache=off --random-wait -q $URL$COUNTY -O - > /tmp/wx/alert/$COUNTY/alert.info
|
||||||
|
$WGET --no-cache --no-dns-cache --tries=10 --random-wait -q $URL$COUNTY -O - > /tmp/wx/alert/$COUNTY/alert.info
|
||||||
|
# -t 10 retries, -w 10 sec between
|
||||||
|
# turn cache off at server
|
||||||
|
|
||||||
|
# place data in variable to see if contains data
|
||||||
|
ALERT_DL="`head -1 /tmp/wx/alert/$COUNTY/alert.info`"
|
||||||
|
let CHKCNT=$CHKCNT+1
|
||||||
|
# delay before retrying
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
# Added for validation of data, test only
|
||||||
|
# cp /tmp/wx/alert/$COUNTY/alert.info /tmp/debug/alert.info_$DATE
|
||||||
|
|
||||||
|
#test to see if title duplicates
|
||||||
|
grep "title>" /tmp/wx/alert/$COUNTY/alert.info | sed '/<title>/,/<\/title/!d' | sed 's/<title>//' | sed 's/<\/title>//' | egrep -v "Current Watches" > /tmp/wx/alert/$COUNTY/alert_watches
|
||||||
|
|
||||||
|
# Attempt to address the issue with duplicate entries using wget and NWS URL.
|
||||||
|
|
||||||
|
NLINES=`wc -l /tmp/wx/alert/$COUNTY/alert_watches`
|
||||||
|
|
||||||
|
if [ ! "$NLINES" = 1 ] ; then
|
||||||
|
#get first line
|
||||||
|
FIRSTLINE=`head -1 /tmp/wx/alert/$COUNTY/alert_watches`
|
||||||
|
|
||||||
|
# check for dups
|
||||||
|
NDUPS=`grep "$FIRSTLINE" /tmp/wx/alert/$COUNTY/alert_watches | wc -l`
|
||||||
|
NUNIQ=`uniq /tmp/wx/alert/$COUNTY/alert_watches | wc -l`
|
||||||
|
|
||||||
|
if [ ! "$NDUPS" = "1" ] ; then
|
||||||
|
if [ "$DEBUG" = "3" ] ; then
|
||||||
|
debug3 "NWS alert data is BAD"
|
||||||
|
debug3 " First Line: $FIRSTLINE"
|
||||||
|
debug3 " NDUPS: $NDUPS"
|
||||||
|
debug3 " NUNIQ: $NUNIQ"
|
||||||
|
debug3 " NLINES: $NLINES"
|
||||||
|
debug3 "Exiting.."
|
||||||
|
debug3
|
||||||
|
fi
|
||||||
|
debug3 "NWS alert data is BAD"
|
||||||
|
rm -f /tmp/wx/alert/$COUNTY/alert_watches
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$DEBUG" = "3" ] ; then
|
||||||
|
debug3 "NWS alert data is OK"
|
||||||
|
debug3 " First Line: $FIRSTLINE"
|
||||||
|
debug3 " NDUPS: $NDUPS"
|
||||||
|
debug3 " NUNIQ: $NUNIQ"
|
||||||
|
debug3
|
||||||
|
fi
|
||||||
|
|
||||||
|
debug3 "NWS alert data is OK"
|
||||||
|
rm -f /tmp/wx/alert/$COUNTY/alert_watches
|
||||||
|
|
||||||
|
## done with test code
|
||||||
|
|
||||||
|
# process the downloaded information
|
||||||
|
cat /tmp/wx/alert/$COUNTY/alert.info | \
|
||||||
|
grep "title>" | \
|
||||||
|
sed '/<title>/,/<\/title/!d' | \
|
||||||
|
sed 's/<title>//' | sed 's/<\/title>//' | \
|
||||||
|
egrep -v "Current Watches" > wx_new.txt
|
||||||
|
|
||||||
|
# get full summary URL Link
|
||||||
|
FULL_SUMMARY_URL=`cat /tmp/wx/alert/$COUNTY/alert.info | egrep "<id>|</id>" | sed 's/<id>//' | sed 's/<\/id>//' | grep capget | tr -d '\r'`
|
||||||
|
|
||||||
|
# Extract Alert from url information:
|
||||||
|
ALERT=`cat /tmp/wx/alert/$COUNTY/alert.info | egrep "<title>|</title>" | sed 's/<title>//' | sed 's/<\/title>//'| sed 's/\(by NWS*\).*/\1/' | sed 's/by NWS//'`
|
||||||
|
|
||||||
|
# Extract Summary from url information:
|
||||||
|
SUMMARY=`cat /tmp/wx/alert/$COUNTY/alert.info | egrep "<summary>|</summary>" | sed 's/<summary>//' | sed 's/<\/summary>//'`
|
||||||
|
|
||||||
|
# Debug stuff, print values for $ALERT and SUMMARY
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
echo
|
||||||
|
debug2 "************START**************************"
|
||||||
|
debug2 "NWS_URL=$URL"
|
||||||
|
debug2 "FULL_SUMMARY_URL=$FULL_SUMMARY_URL"
|
||||||
|
debug2 "CHKCNT=$CHKCNT"
|
||||||
|
debug2 "ALERT=$ALERT"
|
||||||
|
debug2 "SUMMARY=$SUMMARY"
|
||||||
|
debug2 "COUNTY=$COUNTY"
|
||||||
|
debug2 "COUNTY_NAME=$COUNTY_NAME"
|
||||||
|
debug2 "VALID_ALERT=$VALID_ALERT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Full_alert
|
||||||
|
echo "$ALERT ... $SUMMARY" > alert_summary.txt
|
||||||
|
|
||||||
|
#if the download failed, alert_summary.txt has only " ... ", then log and exit.
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
DWNCHK=`cat alert_summary.txt`
|
||||||
|
echo
|
||||||
|
debug2 "dwnload chk:$DWNCHK"
|
||||||
|
fi
|
||||||
|
if [ "`cat alert_summary.txt`" == " ... " ] ; then
|
||||||
|
log "ERROR: Failed to download alert correct data from ${COUNTY}"
|
||||||
|
log " Verify $COUNTY is valid or URL has not changed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if no active watches, if so clean up any alerts and create
|
||||||
|
# no watches message for summary.
|
||||||
|
if ( grep "no active watches" wx_new.txt &> /dev/null ) ; then
|
||||||
|
|
||||||
|
# skip all of this if no_alert file is present indicating audio generated
|
||||||
|
if [ ! -f no_alerts.txt ] ; then
|
||||||
|
rm -f *.ul # Remove all alerts, audio files
|
||||||
|
rm -f alert.txt
|
||||||
|
|
||||||
|
# alert_summary.txt and alert_pre_summary.txt must match, or will
|
||||||
|
# generate an alert
|
||||||
|
##
|
||||||
|
cp alert_summary.txt alert_prev_summary.txt
|
||||||
|
cp wx_new.txt no_alerts.txt # After clean up, create
|
||||||
|
# "no active warnings file
|
||||||
|
|
||||||
|
# setup the no warnings message, append file with county info, the
|
||||||
|
# create audio
|
||||||
|
##
|
||||||
|
echo "for $COUNTY_NAME" >> no_alerts.txt
|
||||||
|
|
||||||
|
## TTS - change
|
||||||
|
TextToSpeech no_alerts.txt
|
||||||
|
mv no_alerts.ul alert_short.ul
|
||||||
|
cp alert_short.ul alert_full.ul
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# save a history of alerts
|
||||||
|
# mv over to saved directory
|
||||||
|
# Save alert Information
|
||||||
|
|
||||||
|
if [ "$DEBUG" = "1" ] || [ "$DEBUG" = "2" ] ; then
|
||||||
|
if [ ! -f alert.txt ] && [ -f /tmp/wx/alert/$COUNTY/pre_conv_alert_summary.txt ] ; then
|
||||||
|
# make sure directory is created
|
||||||
|
if [ ! -d saved/$DATE ] ; then
|
||||||
|
mkdir -p saved/$DATE
|
||||||
|
fi
|
||||||
|
# now save files
|
||||||
|
cp /tmp/wx/alert/$COUNTY/*.txt saved/$DATE/.
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi # < if [ -f no_alerts.txt ]
|
||||||
|
exit 0 # Done, now exit.
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Checking for Wx Alert updates for $COUNTY"
|
||||||
|
# Skip if files are the same, alerts are active, but nothing has changed.
|
||||||
|
if ! diff -q alert_summary.txt alert_prev_summary.txt &> /dev/null; then
|
||||||
|
|
||||||
|
# New Alerts are found.
|
||||||
|
log "New Wx Alerts for $COUNTY"
|
||||||
|
cp alert_summary.txt alert_prev_summary.txt # make the files the same now
|
||||||
|
rm -f alert.txt *.raw no_alerts.txt # and remove old alerts
|
||||||
|
# remove email alert file
|
||||||
|
if [ -f /tmp/wx/alert/${COUNTY}/email_alert.txt ] ; then
|
||||||
|
rm -f /tmp/wx/alert/${COUNTY}/email_alert.txt
|
||||||
|
fi
|
||||||
|
# remove the old plist.txt file.
|
||||||
|
if [ -f plist.txt ] ; then
|
||||||
|
cp plist.txt /tmp/.
|
||||||
|
rm plist.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create the alert file
|
||||||
|
echo "$ALERT" > alert.txt
|
||||||
|
|
||||||
|
# Create the product list which is tested against
|
||||||
|
# if product not found, will leave a null file. This is tested against
|
||||||
|
# at end of script, see ref#1
|
||||||
|
while read PRODUCT; do # Check for alert products
|
||||||
|
# appending the 1st matching, ignore case
|
||||||
|
grep -i -m 1 "^$PRODUCT" wx_new.txt
|
||||||
|
done < $PLIST >> plist.txt # line to alert.txt file
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
# Pre Conversions file creation.
|
||||||
|
#################################################################
|
||||||
|
# create pre_alert.txt file (input to post conversion)
|
||||||
|
#
|
||||||
|
|
||||||
|
# check the alert types, critical/normal
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
debug2 "********* WXALERT_BEACON=[$WXALERT_BEACON] **********"
|
||||||
|
fi
|
||||||
|
# Setup TYPES of alerts to trigger on depending upon WXALERT_BEACON Variable
|
||||||
|
if [ "$WXALERT_BEACON" = "C" ] ; then
|
||||||
|
TYPES=$CRIT_TYPES
|
||||||
|
else
|
||||||
|
TYPES=$NORM_TYPES
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set flag
|
||||||
|
CRIT_BEACON_FLAG="N"
|
||||||
|
SAVEIFS=$IFS
|
||||||
|
IFS=$(echo -en "\n\b")
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
debug2 "TYPES= $TYPES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for matching TYPES in alert
|
||||||
|
for TYPE in $TYPES
|
||||||
|
do
|
||||||
|
## added space to avoid the first line being seen as an alert
|
||||||
|
## this may need to be changed as follows:
|
||||||
|
# egrep -v "Current Watches" alert.txt > alert1.txt
|
||||||
|
# mv alert1.txt alert
|
||||||
|
## if grep -i "$TYPE" alert.txt >> /tmp/wx/alert/$COUNTY/a_tmp.txt; then # Extract matching alerts
|
||||||
|
|
||||||
|
if grep -i "$TYPE " alert.txt >> /tmp/wx/alert/$COUNTY/a_tmp.txt; then # Extract matching alerts
|
||||||
|
#set up header of the alert file
|
||||||
|
echo "Weather Alert. for $COUNTY_NAME" > /tmp/wx/alert/$COUNTY/a_tmp.txt
|
||||||
|
echo ".." >> /tmp/wx/alert/$COUNTY/a_tmp.txt
|
||||||
|
log "Get Wx Alert INFO for $COUNTY: $TYPE"
|
||||||
|
# set critical beacon flag, if a match
|
||||||
|
CRIT_BEACON_FLAG="Y"
|
||||||
|
VALID_ALERT=yes
|
||||||
|
else
|
||||||
|
VALID_ALERT=no
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS=$SAVEIFS
|
||||||
|
|
||||||
|
# rename to pre_alert.txt
|
||||||
|
mv /tmp/wx/alert/$COUNTY/a_tmp.txt /tmp/wx/alert/$COUNTY/pre_alert.txt
|
||||||
|
|
||||||
|
#############################
|
||||||
|
# create pre_conv_alert_summmary.txt (input to post conversion)
|
||||||
|
# insert weather header/trailer to full alert txt
|
||||||
|
echo ". . Weather Alert Summary for County $COUNTY_NAME." > /tmp/wx/alert/$COUNTY/a_tmp.txt
|
||||||
|
cat alert_summary.txt >> /tmp/wx/alert/$COUNTY/a_tmp.txt
|
||||||
|
|
||||||
|
# copy tmp.txt over for post conversion
|
||||||
|
cp /tmp/wx/alert/$COUNTY/a_tmp.txt /tmp/wx/alert/$COUNTY/pre_conv_alert_summary.txt
|
||||||
|
|
||||||
|
# reset file
|
||||||
|
echo "" > /tmp/wx/alert/$COUNTY/full_alert_info.txt
|
||||||
|
|
||||||
|
# if multiple URL's go through them
|
||||||
|
for URL in $FULL_SUMMARY_URL ; do
|
||||||
|
|
||||||
|
# reset while variables
|
||||||
|
ALERT_DL=""
|
||||||
|
CHKCNT=0
|
||||||
|
|
||||||
|
# loop until get proper response, if after 5 attempts notify
|
||||||
|
while [ -z "$ALERT_DL" ] ; do
|
||||||
|
|
||||||
|
if [ $CHKCNT -gt 5 ] ; then
|
||||||
|
log "ERROR: $URL is not responding for getWxAlert - ${COUNTY}"
|
||||||
|
log " Possible issue with nws.gov server or internet connection"
|
||||||
|
ls -l /tmp/wx/alert/$COUNTY/full_alert_info.txt
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Create the raw full Summary File
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
debug2 "FULL_SUMMARY_URL Entry: $URL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create full summary from URL file
|
||||||
|
$WGET -t 10 -w 10 --cache=off --random-wait -q $URL -O - | sed '/<description>/,/<\/description/!d' | \
|
||||||
|
sed 's/<description>//' | \
|
||||||
|
sed 's/<\/description>//' >> /tmp/wx/alert/$COUNTY/full_alert_info.txt
|
||||||
|
# -t 10 retries, -w 10 sec between
|
||||||
|
# turn cache off at server
|
||||||
|
# check if anything downloaded
|
||||||
|
ALERT_DL="`tail -1 /tmp/wx/alert/$COUNTY/full_alert_info.txt`"
|
||||||
|
echo "ALERT_DL=$ALERT_DL"
|
||||||
|
let CHKCNT=$CHKCNT+1
|
||||||
|
|
||||||
|
echo " " >> /tmp/wx/alert/$COUNTY/full_alert_info.txt
|
||||||
|
# copy the full alert prior to appending
|
||||||
|
# url information.
|
||||||
|
cp /tmp/wx/alert/$COUNTY/full_alert_info.txt /tmp/wx/alert/$COUNTY/pre_full_alert_info.txt
|
||||||
|
|
||||||
|
echo "For more information:" >> /tmp/wx/alert/$COUNTY/full_alert_info.txt
|
||||||
|
echo $URL >> /tmp/wx/alert/$COUNTY/full_alert_info.txt
|
||||||
|
echo "==================================================================" >> /tmp/wx/alert/$COUNTY/full_alert_info.txt
|
||||||
|
echo " " >> /tmp/wx/alert/$COUNTY/full_alert_info.txt
|
||||||
|
|
||||||
|
# delay before retrying
|
||||||
|
sleep 4
|
||||||
|
done # while loop
|
||||||
|
|
||||||
|
done # loop url's
|
||||||
|
|
||||||
|
# additional debug info
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
debug2 "**************************************************************"
|
||||||
|
debug2 "**alert's don't match**"
|
||||||
|
debug2 "=============================================================="
|
||||||
|
debug2 "alert_summary file:"
|
||||||
|
debug2 " /tmp/wx/alert/${COUNTY}/alert_summary.txt"
|
||||||
|
debug2 "=============================================================="
|
||||||
|
debug2 "alert_prev_summary.txt file:"
|
||||||
|
debug2 " /tmp/wx/alert/${COUNTY}/alert_prev_summary.txt"
|
||||||
|
debug2 "=============================================================="
|
||||||
|
debug2 "pre_full_alert_info.txt file:"
|
||||||
|
debug2 " /tmp/wx/alert/${COUNTY}/pre_full_alert_info.txt"
|
||||||
|
debug2 "**************************************************************"
|
||||||
|
debug2
|
||||||
|
fi
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
# Post Conversions
|
||||||
|
# You must edit wxtext_conv.sed file to perform the post conversion.
|
||||||
|
#################################################################
|
||||||
|
|
||||||
|
#############################
|
||||||
|
# pre_alert txt file to conv_alert.txt
|
||||||
|
sed -f ${WEATHER}/wxtext_conv.sed /tmp/wx/alert/$COUNTY/pre_alert.txt > conv_alert.txt
|
||||||
|
# conv_alert summary txt file to conv_alert_summary.txt
|
||||||
|
sed -f ${WEATHER}/wxtext_conv.sed /tmp/wx/alert/$COUNTY/pre_conv_alert_summary.txt > conv_alert_summary.txt
|
||||||
|
|
||||||
|
# full alert text
|
||||||
|
if [ "$FULL_ALERT" = "Y" ] ; then
|
||||||
|
#############################
|
||||||
|
# pre_full_alert_info file to conv
|
||||||
|
sed -f ${WEATHER}/wxtext_conv.sed /tmp/wx/alert/$COUNTY/pre_full_alert_info.txt > conv_full_alert_info.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
# create the audio files
|
||||||
|
#################################################################
|
||||||
|
|
||||||
|
## TTS
|
||||||
|
TextToSpeech conv_alert.txt
|
||||||
|
mv conv_alert.ul alert_short.ul
|
||||||
|
cp alert_short.ul alert_full.ul
|
||||||
|
|
||||||
|
# full alert text
|
||||||
|
if [ "$FULL_ALERT" = "Y" ] ; then
|
||||||
|
TextToSpeech conv_full_alert_info.txt
|
||||||
|
mv conv_full_alert_info.ul alert_full.ul
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
#clean up
|
||||||
|
rm -f /tmp/wx/alert/$COUNTY/a_tmp.txt
|
||||||
|
|
||||||
|
# check if file exists and size gt zero, if not email/play weather (ref#1)
|
||||||
|
if [ -s plist.txt ]; then
|
||||||
|
# Email Alerts if $EMAIL defined.
|
||||||
|
if [ ! -z "$EMAIL" ] ; then
|
||||||
|
send_email
|
||||||
|
fi
|
||||||
|
# if WXALERT_BEACON is set to Yes, then place playWxAlertBg into
|
||||||
|
# background
|
||||||
|
#
|
||||||
|
# Beacon needs to be Y -or- (beacon C -and- Crit_Beacon flag yes)
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
echo "WXALERT_BEACON = $WXALERT_BEACON, CRIT_BEACON_FLAG=$CRIT_BEACON_FLAG"
|
||||||
|
fi
|
||||||
|
if [ $WXALERT_BEACON = "Y" ] || ([ $WXALERT_BEACON = "C" ] && [ $CRIT_BEACON_FLAG = "Y" ]) ; then
|
||||||
|
# first kill any left over process
|
||||||
|
# get PID and kill it
|
||||||
|
if [ -f $WXALERT_SPOOLDIR/$COUNTY/playWxAlertBg.pid ] ; then
|
||||||
|
kill `cat < playWxAlertBg.pid`
|
||||||
|
fi
|
||||||
|
# if $LOCAL/no_wxalert_msg file is present, remove it to start
|
||||||
|
# new weather alert msg
|
||||||
|
if [ -f $NO_WXALERT_MSG ] ; then
|
||||||
|
rm $NO_WXALERT_MSG
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$VALID_ALERT" = "yes" ] ; then
|
||||||
|
# call playWxAlert and place in background
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
debug2 "********* Launching Debug Version of playWxAlert **********"
|
||||||
|
bash -x /usr/local/bin/playWxAlertBg $COUNTY 2>&1 | tee /tmp/WX_DEBUG &
|
||||||
|
else
|
||||||
|
log "Launching playWxAlertBg..."
|
||||||
|
/usr/local/bin/playWxAlertBg $COUNTY &
|
||||||
|
fi # debug
|
||||||
|
fi # Valid Alert
|
||||||
|
fi # wxalert beacon
|
||||||
|
fi # -s plist.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
@ -0,0 +1,153 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# playWxAlertBg - allstar wxscripts
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# Play weather alerts Announcements. This will automatically stop when
|
||||||
|
# alert is cancelled.
|
||||||
|
# Normally, placed in background from getWxAlert.
|
||||||
|
#
|
||||||
|
#######################
|
||||||
|
# $Id: playWxAlertBg 19 2015-02-19 22:03:53Z w0anm $
|
||||||
|
|
||||||
|
# My process id
|
||||||
|
MYPROC=$$
|
||||||
|
|
||||||
|
WEATHER="/usr/local/etc/wx"
|
||||||
|
|
||||||
|
# Load config file
|
||||||
|
if [ -f ${WEATHER}/wx_scripts.conf ] ; then
|
||||||
|
source ${WEATHER}/wx_scripts.conf
|
||||||
|
else
|
||||||
|
echo "Missing ${WEATHER}/wx_scripts.conf file, aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# multiple zone support.
|
||||||
|
# if COUNTY not an argument, then error.
|
||||||
|
if [ "$1" = "" ] ; then
|
||||||
|
echo "Missing Argument, need wx underground station id.."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
COUNTY=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if argument is not a directory, abort and do nothing. send error
|
||||||
|
if [ ! -d /tmp/wx/alert/$COUNTY ] ; then
|
||||||
|
# msg to log file.
|
||||||
|
log "COUNTY directory $COUNTY is not present, aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WXALERT_TEXT=${WXALERT_SPOOLDIR}/$COUNTY/alert.txt
|
||||||
|
NO_WXALERT_MSG=$LOCAL/no_wxalert_msg
|
||||||
|
|
||||||
|
# store the PID
|
||||||
|
echo "$$" > $WXALERT_SPOOLDIR/$COUNTY/playWxAlertBg.pid
|
||||||
|
|
||||||
|
##########
|
||||||
|
PlayMsg () {
|
||||||
|
|
||||||
|
#log "Playing Wx Alert (${SLEEPTIME}s) for $COUNTY"
|
||||||
|
log "Mode - $PLAYBACK_MODE - $Msg"
|
||||||
|
|
||||||
|
/usr/sbin/asterisk -rx "rpt $PLAYBACK_MODE $NODE1 /tmp/wx/alert/$COUNTY/alert_short" &> /dev/null 2>&1
|
||||||
|
|
||||||
|
} # end PlayMsg
|
||||||
|
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# Main Program
|
||||||
|
|
||||||
|
# Run's in background, called by getWxAlert
|
||||||
|
|
||||||
|
while [ -f $WXALERT_TEXT ] ; do
|
||||||
|
# check if lock file is present. If so, wait for file to be
|
||||||
|
# removed, this prevents alert announcements from simultaneioulsy
|
||||||
|
# being sent.
|
||||||
|
# if NO_WXALERT file is present, skip playing msg
|
||||||
|
if [ ! -f $NO_WXALERT_MSG ] ; then
|
||||||
|
while [ -f /tmp/playWxAlertBg-lock ] ; do
|
||||||
|
sleep 30
|
||||||
|
done
|
||||||
|
|
||||||
|
# set lock file
|
||||||
|
echo $MYPROC > /tmp/playWxAlertBg-lock
|
||||||
|
|
||||||
|
Msg="Playing Wx Alert (initial) for $COUNTY"
|
||||||
|
PlayMsg
|
||||||
|
|
||||||
|
# clear lock file
|
||||||
|
rm /tmp/playWxAlertBg-lock
|
||||||
|
else
|
||||||
|
log "Skipping Wx Alert (initial) for $COUNTY, $NO_WXALERT_MSG present"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# play time is initial, 5m, 10m, 30m, 30m, 30m, then every 60m
|
||||||
|
for SLEEPTIME in $SLEEPTIME_SEQ ; do
|
||||||
|
sleep $SLEEPTIME
|
||||||
|
if [ ! -f $WXALERT_TEXT ] || [ $SLEEPTIME = "0" ] ; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check to see if you should output an alert msg
|
||||||
|
if [ ! -f $NO_WXALERT_MSG ] ; then
|
||||||
|
# check if lock file is present. If so, wait for file to be
|
||||||
|
# removed, this prevents alert announcements from simultaneioulsy
|
||||||
|
# being sent.
|
||||||
|
while [ -f /tmp/playWxAlertBg-lock ] ; do
|
||||||
|
sleep 30
|
||||||
|
done
|
||||||
|
# set lock file
|
||||||
|
echo $MYPROC > /tmp/playWxAlertBg-lock
|
||||||
|
|
||||||
|
Msg="Playing Wx Alert (${SLEEPTIME}s) for $COUNTY"
|
||||||
|
PlayMsg
|
||||||
|
|
||||||
|
# clear lock file
|
||||||
|
rm /tmp/playWxAlertBg-lock
|
||||||
|
else
|
||||||
|
log "Skipping Wx Alert (${SLEEPTIME}s) for $COUNTY, $NO_WXALERT_MSG present"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
while [ -f $WXALERT_TEXT ] ; do
|
||||||
|
EXTENDEDTIME=3600
|
||||||
|
sleep $EXTENDEDTIME
|
||||||
|
if [ ! -f $WXALERT_TEXT ] ; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check to see if you should output an alert msg
|
||||||
|
if [ ! -f $NO_WXALERT_MSG ] ; then
|
||||||
|
# check if lock file is present.
|
||||||
|
while [ -f /tmp/playWxAlertBg-lock ] ; do
|
||||||
|
sleep 30
|
||||||
|
done
|
||||||
|
# set lock file
|
||||||
|
echo $MYPROC > /tmp/playWxAlertBg-lock
|
||||||
|
|
||||||
|
# if SLEEPTIME is 0, then don't play alert, we are done.
|
||||||
|
if [ "$SLEEPTIME" -ne "0" ] ; then
|
||||||
|
Msg="Playing Wx Alert (${EXTENDEDTIME}s) for $COUNTY"
|
||||||
|
PlayMsg
|
||||||
|
fi
|
||||||
|
|
||||||
|
# clear lock file
|
||||||
|
rm /tmp/playWxAlertBg-lock
|
||||||
|
else
|
||||||
|
log "Skipping Wx Alert (${EXTENDEDTIME}) for $COUNTY, $NO_WXALERT_MSG present"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
# remove PID file
|
||||||
|
rm $WXALERT_SPOOLDIR/$COUNTY/playWxAlertBg.pid
|
||||||
|
|
||||||
|
log "Alert over for $COUNTY"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
#!/usr/bin/python2
|
||||||
|
#
|
||||||
|
# sendmail-gm.py - allstar wxscripts
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# This script allows a user to send mail using their gmail account. This is
|
||||||
|
# used to send weather alert messages if desired.
|
||||||
|
#
|
||||||
|
# you will need to edit the file to include your gmail account information.
|
||||||
|
# Keep in mind that this is open text and anyone that reads this file can gain
|
||||||
|
# access to your gmail account.
|
||||||
|
#
|
||||||
|
#####################
|
||||||
|
# $Id: sendmail-gm.py 15 2015-01-07 23:59:43Z w0anm $
|
||||||
|
|
||||||
|
import sys, getopt
|
||||||
|
import smtplib
|
||||||
|
import ConfigParser
|
||||||
|
|
||||||
|
Subject = ''
|
||||||
|
Email_Addr = ''
|
||||||
|
ConfigFile = '/usr/local/etc/.sendmail.cfg'
|
||||||
|
|
||||||
|
# arguments
|
||||||
|
def main(argv):
|
||||||
|
Subject = 'test message'
|
||||||
|
Email_Addr = ''
|
||||||
|
Inputfile = ''
|
||||||
|
|
||||||
|
try:
|
||||||
|
opts, args = getopt.getopt(argv,"hs:e:i:")
|
||||||
|
except getopt.GetoptError:
|
||||||
|
print '\nsendmail.py -s [<subject>] -e <Email_Addr> [-i <inputfile>]'
|
||||||
|
sys.exit(2)
|
||||||
|
for opt, arg in opts:
|
||||||
|
if opt == '-h':
|
||||||
|
print '\nsendmail.py -s <subject> -e <Email_Addr> [-i <inputfile>]'
|
||||||
|
sys.exit()
|
||||||
|
elif opt in ("-s"):
|
||||||
|
Subject = arg
|
||||||
|
elif opt in ("-e"):
|
||||||
|
Email_Addr = arg
|
||||||
|
elif opt in ("-i"):
|
||||||
|
Inputfile = arg
|
||||||
|
|
||||||
|
|
||||||
|
# get the configuration values
|
||||||
|
config = ConfigParser.RawConfigParser()
|
||||||
|
config = ConfigParser.RawConfigParser(allow_no_value=True)
|
||||||
|
config.read(ConfigFile)
|
||||||
|
|
||||||
|
gmail_user = config.get('gmail_send', 'user')
|
||||||
|
gmail_pwd = config.get('gmail_send', 'password')
|
||||||
|
gmail_from= config.get('gmail_send', 'from')
|
||||||
|
|
||||||
|
TO = [Email_Addr] #must be a list
|
||||||
|
TEXT=''
|
||||||
|
|
||||||
|
# if inputfile defined, then skip standard in
|
||||||
|
if Inputfile == '':
|
||||||
|
data = sys.stdin.readline()
|
||||||
|
lines=''
|
||||||
|
while data:
|
||||||
|
lines=lines + data
|
||||||
|
data = sys.stdin.readline()
|
||||||
|
|
||||||
|
else:
|
||||||
|
f = open(Inputfile)
|
||||||
|
data= f.readline()
|
||||||
|
lines=''
|
||||||
|
while data:
|
||||||
|
lines=lines + data
|
||||||
|
data = f.readline()
|
||||||
|
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
TEXT=lines
|
||||||
|
|
||||||
|
# Prepare actual message
|
||||||
|
message = """\From: %s\nTo: %s\nSubject: %s\n\n%s
|
||||||
|
""" % (gmail_from, ", ".join(TO), Subject, TEXT)
|
||||||
|
try:
|
||||||
|
#server = smtplib.SMTP(SERVER)
|
||||||
|
server = smtplib.SMTP("smtp.gmail.com", 587) #or port 465 doesn't seem to work!
|
||||||
|
server.ehlo()
|
||||||
|
server.starttls()
|
||||||
|
server.login(gmail_user, gmail_pwd)
|
||||||
|
server.sendmail(gmail_from, TO, message)
|
||||||
|
#server.quit()
|
||||||
|
server.close()
|
||||||
|
print 'successfully sent the mail'
|
||||||
|
except:
|
||||||
|
print "failed to send mail"
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(sys.argv[1:])
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
[gmail_send]
|
||||||
|
user = xxxxxx@gmail.com
|
||||||
|
password = xxxxxxxxxx
|
||||||
|
from = xxxxxx@gmail.com
|
||||||
|
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
911 TELEPHONE OUTAGE
|
||||||
|
AIR STAGNATION ADVISORY
|
||||||
|
ASHFALL ADVISORY
|
||||||
|
AVALANCHE WARNING
|
||||||
|
AVALANCHE WATCH
|
||||||
|
BLIZZARD WARNING
|
||||||
|
BLIZZARD WATCH
|
||||||
|
BLOWING DUST ADVISORY
|
||||||
|
BLOWING SNOW ADVISORY
|
||||||
|
CHILD ABDUCTION EMERGENCY
|
||||||
|
CIVIL DANGER WARNING
|
||||||
|
CIVIL EMERGENCY MESSAGE
|
||||||
|
COASTAL FLOOD STATEMENT
|
||||||
|
COASTAL FLOOD WARNING
|
||||||
|
COASTAL FLOOD WATCH
|
||||||
|
DENSE FOG ADVISORY
|
||||||
|
DENSE SMOKE ADVISORY
|
||||||
|
DUST STORM WARNING
|
||||||
|
EARTHQUAKE WARNING
|
||||||
|
EVACUATION IMMEDIATE
|
||||||
|
EXCESSIVE HEAT WARNING
|
||||||
|
EXCESSIVE HEAT WATCH
|
||||||
|
FIRE DANGER STATEMENT
|
||||||
|
FIRE WARNING
|
||||||
|
FIRE WEATHER WATCH
|
||||||
|
FLASH FLOOD STATEMENT
|
||||||
|
FLASH FLOOD WARNING
|
||||||
|
FLASH FLOOD WATCH
|
||||||
|
FLOOD STATEMENT
|
||||||
|
FLOOD WARNING
|
||||||
|
FLOOD WATCH
|
||||||
|
FREEZE WARNING
|
||||||
|
FREEZE WATCH
|
||||||
|
FREEZING DRIZZLE ADVISORY
|
||||||
|
FREEZING FOG ADVISORY
|
||||||
|
FREEZING RAIN ADVISORY
|
||||||
|
FROST ADVISORY
|
||||||
|
GALE WARNING
|
||||||
|
HAZARDOUS MATERIALS WARNING
|
||||||
|
HAZARDOUS WEATHER OUTLOOK
|
||||||
|
HEAT ADVISORY
|
||||||
|
HEAVY FREEZING SPRAY WARNING
|
||||||
|
HEAVY SLEET WARNING
|
||||||
|
HEAVY SNOW WARNING
|
||||||
|
HIGH SURF ADVISORY
|
||||||
|
HIGH SURF WARNING
|
||||||
|
HIGH WIND WARNING
|
||||||
|
HIGH WIND WATCH
|
||||||
|
HURRICANE LOCAL STATEMENT
|
||||||
|
HURRICANE WATCH
|
||||||
|
ICE STORM WARNING
|
||||||
|
INLAND HURRICANE WIND WATCH
|
||||||
|
INLAND TROPICAL STORM WARNING
|
||||||
|
INLAND TROPICAL STORM WATCH
|
||||||
|
LAKE EFFECT SNOW ADVISORY
|
||||||
|
LAKE EFFECT SNOW WARNING
|
||||||
|
LAKE EFFECT SNOW WATCH
|
||||||
|
LAKESHORE FLOOD STATEMENT
|
||||||
|
LAKESHORE FLOOD WARNING
|
||||||
|
LAKESHORE FLOOD WATCH
|
||||||
|
LAKE WIND ADVISORY
|
||||||
|
LAW ENFORCEMENT WARNING
|
||||||
|
LOCAL AREA EMERGENCY
|
||||||
|
MARINE WEATHER STATEMENT
|
||||||
|
NUCLEAR POWER PLANT WARNING
|
||||||
|
RADIOLOGICAL HAZARD WARNING
|
||||||
|
RED FLAG WARNING
|
||||||
|
SEVERE THUNDERSTORM WARNING
|
||||||
|
SEVERE THUNDERSTORM WATCH
|
||||||
|
SEVERE WEATHER STATEMENT
|
||||||
|
SHELTER IN PLACE WARNING
|
||||||
|
SHORT TERM FORECAST
|
||||||
|
SLEET ADVISORY
|
||||||
|
SMALL CRAFT ADVISORY
|
||||||
|
SNOW ADVISORY
|
||||||
|
SNOW AND BLOWING SNOW ADVISORY
|
||||||
|
SPECIAL MARINE WARNING
|
||||||
|
SPECIAL WEATHER STATEMENT
|
||||||
|
STORM WARNING
|
||||||
|
TORNADO WARNING
|
||||||
|
TORNADO WATCH
|
||||||
|
TROPICAL STORM WARNING
|
||||||
|
TROPICAL STORM WATCH
|
||||||
|
TSUNAMI WATCH
|
||||||
|
TYPHOON LOCAL STATEMENT
|
||||||
|
TYPHOON WATCH
|
||||||
|
VOLCANO WARNING
|
||||||
|
WIND ADVISORY
|
||||||
|
WIND CHILL ADVISORY
|
||||||
|
WIND CHILL WARNING
|
||||||
|
WIND CHILL WATCH
|
||||||
|
WINTER STORM WARNING
|
||||||
|
WINTER STORM WATCH
|
||||||
|
WINTER WEATHER ADVISORY
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
AVALANCHE WARNING
|
||||||
|
AVALANCHE WATCH
|
||||||
|
BLIZZARD WARNING
|
||||||
|
BLIZZARD WATCH
|
||||||
|
CHILD ABDUCTION EMERGENCY
|
||||||
|
CIVIL DANGER WARNING
|
||||||
|
CIVIL EMERGENCY MESSAGE
|
||||||
|
COASTAL FLOOD STATEMENT
|
||||||
|
COASTAL FLOOD WARNING
|
||||||
|
COASTAL FLOOD WATCH
|
||||||
|
DUST STORM WARNING
|
||||||
|
EARTHQUAKE WARNING
|
||||||
|
EVACUATION IMMEDIATE
|
||||||
|
EXCESSIVE HEAT WARNING
|
||||||
|
EXCESSIVE HEAT WATCH
|
||||||
|
FIRE DANGER STATEMENT
|
||||||
|
FIRE WARNING
|
||||||
|
FIRE WEATHER WATCH
|
||||||
|
FLASH FLOOD STATEMENT
|
||||||
|
FLASH FLOOD WARNING
|
||||||
|
FLASH FLOOD WATCH
|
||||||
|
FLOOD STATEMENT
|
||||||
|
FLOOD WARNING
|
||||||
|
FLOOD WATCH
|
||||||
|
FREEZE WARNING
|
||||||
|
FREEZE WATCH
|
||||||
|
GALE WARNING
|
||||||
|
HAZARDOUS MATERIALS WARNING
|
||||||
|
HAZARDOUS WEATHER OUTLOOK
|
||||||
|
HEAVY FREEZING SPRAY WARNING
|
||||||
|
HEAVY SLEET WARNING
|
||||||
|
HEAVY SNOW WARNING
|
||||||
|
HIGH SURF WARNING
|
||||||
|
HIGH WIND WARNING
|
||||||
|
HIGH WIND WATCH
|
||||||
|
HURRICANE LOCAL STATEMENT
|
||||||
|
HURRICANE WATCH
|
||||||
|
ICE STORM WARNING
|
||||||
|
INLAND HURRICANE WIND WATCH
|
||||||
|
INLAND TROPICAL STORM WARNING
|
||||||
|
INLAND TROPICAL STORM WATCH
|
||||||
|
LAKE EFFECT SNOW WARNING
|
||||||
|
LAKE EFFECT SNOW WATCH
|
||||||
|
LAKESHORE FLOOD WARNING
|
||||||
|
LAKESHORE FLOOD WATCH
|
||||||
|
LAW ENFORCEMENT WARNING
|
||||||
|
LOCAL AREA EMERGENCY
|
||||||
|
NUCLEAR POWER PLANT WARNING
|
||||||
|
RADIOLOGICAL HAZARD WARNING
|
||||||
|
SEVERE THUNDERSTORM WARNING
|
||||||
|
SEVERE THUNDERSTORM WATCH
|
||||||
|
STORM WARNING
|
||||||
|
TORNADO WARNING
|
||||||
|
TORNADO WATCH
|
||||||
|
TROPICAL STORM WARNING
|
||||||
|
TROPICAL STORM WATCH
|
||||||
|
TSUNAMI WATCH
|
||||||
|
TYPHOON WATCH
|
||||||
|
VOLCANO WARNING
|
||||||
|
WIND CHILL WARNING
|
||||||
|
WINTER STORM WARNING
|
||||||
|
WINTER STORM WATCH
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
SEVERE THUNDERSTORM WARNING
|
||||||
|
TORNADO WARNING
|
||||||
|
TORNADO WATCH
|
||||||
|
ICE STORM WARNING
|
||||||
|
NUCLEAR POWER PLANT WARNING
|
||||||
|
EVACUATION IMMEDIATE
|
||||||
|
VOLCANO WARNING
|
||||||
|
WIND CHILL WARNING
|
||||||
|
WINTER STORM WARNING
|
||||||
|
EMERGENCY
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
BLIZZARD WARNING
|
||||||
|
BLIZZARD WATCH
|
||||||
|
BLOWING SNOW ADVISORY
|
||||||
|
CIVIL DANGER WARNING
|
||||||
|
CIVIL EMERGENCY MESSAGE
|
||||||
|
DENSE FOG ADVISORY
|
||||||
|
EVACUATION IMMEDIATE
|
||||||
|
EXCESSIVE HEAT WARNING
|
||||||
|
EXCESSIVE HEAT WATCH
|
||||||
|
FIRE WARNING
|
||||||
|
FLASH FLOOD WARNING
|
||||||
|
FLOOD WARNING
|
||||||
|
FLOOD WATCH
|
||||||
|
FREEZE WARNING
|
||||||
|
FREEZE WATCH
|
||||||
|
FREEZING DRIZZLE ADVISORY
|
||||||
|
FREEZING FOG ADVISORY
|
||||||
|
FREEZING RAIN ADVISORY
|
||||||
|
FROST ADVISORY
|
||||||
|
HEAT ADVISORY
|
||||||
|
HEAVY FREEZING SPRAY WARNING
|
||||||
|
HEAVY SLEET WARNING
|
||||||
|
HEAVY SNOW WARNING
|
||||||
|
HIGH SURF ADVISORY
|
||||||
|
HIGH WIND WARNING
|
||||||
|
HIGH WIND WATCH
|
||||||
|
ICE STORM WARNING
|
||||||
|
LAKE EFFECT SNOW ADVISORY
|
||||||
|
LAKE EFFECT SNOW WARNING
|
||||||
|
NUCLEAR POWER PLANT WARNING
|
||||||
|
OUTAGE
|
||||||
|
RADIOLOGICAL HAZARD WARNING
|
||||||
|
SEVERE THUNDERSTORM WARNING
|
||||||
|
SEVERE THUNDERSTORM WATCH
|
||||||
|
SLEET ADVISORY
|
||||||
|
SNOW ADVISORY
|
||||||
|
SNOW AND BLOWING SNOW ADVISORY
|
||||||
|
STORM WARNING
|
||||||
|
TORNADO WARNING
|
||||||
|
TORNADO WATCH
|
||||||
|
VOLCANO WARNING
|
||||||
|
WIND ADVISORY
|
||||||
|
WIND CHILL ADVISORY
|
||||||
|
WIND CHILL WARNING
|
||||||
|
WIND CHILL WATCH
|
||||||
|
WINTER STORM WARNING
|
||||||
|
WINTER STORM WATCH
|
||||||
|
WINTER WEATHER ADVISORY
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
s/Minneapolis-St./Minneapolis Saint/g
|
||||||
|
s/ EST/ /g
|
||||||
|
s/ est/ /g
|
||||||
|
s/ EDT/ /g
|
||||||
|
s/ edt/ /g
|
||||||
|
s/ CST/ /g
|
||||||
|
s/ cst/ /g
|
||||||
|
s/ CDT/ /g
|
||||||
|
s/ cdt/ /g
|
||||||
|
s/ MST/ /g
|
||||||
|
s/ mst/ /g
|
||||||
|
s/ MDT/ /g
|
||||||
|
s/ mdt/ /g
|
||||||
|
s/ MPH/ miles per hour /g
|
||||||
|
s/ mph/ miles per hour /g
|
||||||
|
s/ MPH./ miles per hour /g
|
||||||
|
s/ mph./ miles per hour /g
|
||||||
|
s/ AM / A M /g
|
||||||
|
s/ PM / P M /g
|
||||||
|
s/ WIND / wend /g
|
||||||
|
s/WIND /wend /g
|
||||||
|
s/Wind /wend /g
|
||||||
|
s/ wind / wend /g
|
||||||
|
s/ Wind / wend /g
|
||||||
|
s/ wind/ wend/g
|
||||||
|
s/ winds/ wends/g
|
||||||
|
s/winds /wends /g
|
||||||
|
s/wind /wend /g
|
||||||
|
s/NWS/National Weather Service/g
|
||||||
|
s/nws/National Weather Service/g
|
||||||
|
s/ PST/ /g
|
||||||
|
s/ pst/ /g
|
||||||
|
s/ PDT/ /g
|
||||||
|
s/ pdt/ /g
|
||||||
@ -0,0 +1,230 @@
|
|||||||
|
Weather Scripts
|
||||||
|
|
||||||
|
Wx_Config_Readme.txt
|
||||||
|
by w0anm
|
||||||
|
( $Id: Wx_Config_Readme.txt 9 2014-12-22 23:47:16Z w0anm $)
|
||||||
|
|
||||||
|
============================================================================
|
||||||
|
| IMPORTANT NOTICE! |
|
||||||
|
| |
|
||||||
|
| No matter what the Weather Alerts are indicating, the information |
|
||||||
|
| gathered and presented here may NOT be accurate. You MUST use your own |
|
||||||
|
| judgement to determine your best course of action in any given |
|
||||||
|
| circumstance! The are many reasons WHY the data here may not be accurate, |
|
||||||
|
| including, but not limited to, software problems, network problems, and or |
|
||||||
|
| hardware problems. The Weather Alerts and other Weather information should |
|
||||||
|
| NOT be used to make any determination of actual current conditions, it is |
|
||||||
|
| merely an indication of what the software is seeing as a result of it's |
|
||||||
|
| attempts to read publicly available data sources. These data sources may |
|
||||||
|
| be unavailable, unreachable, or innacurate. Please check other sources to |
|
||||||
|
| verify any information presented here. |
|
||||||
|
============================================================================
|
||||||
|
|
||||||
|
This document will explain how to configure the weather scripts.
|
||||||
|
|
||||||
|
Before configuring the weather scripts, you will need some addtional
|
||||||
|
information from the National Weather Service (NWS) and Weather Underground
|
||||||
|
depending what options you choose during the configuration.
|
||||||
|
|
||||||
|
==Alerts==
|
||||||
|
|
||||||
|
The weather alert scripts will allow you to get short alert messages via
|
||||||
|
your node audio.
|
||||||
|
|
||||||
|
You will need to have the NWS County number information to setup the Weather
|
||||||
|
Alerts. Refer to the following URL:
|
||||||
|
|
||||||
|
http://www.weather.gov/alerts
|
||||||
|
|
||||||
|
Select the "Warnings By State" under "Active Alerts". Select the County List
|
||||||
|
listed by the desired state. You will see the "County Code", now pick from the
|
||||||
|
various State Counties displayed and write this "Count Code" down for reference.
|
||||||
|
|
||||||
|
For example, under Minnesota you wil find - Wright. The county code for
|
||||||
|
this county is MNC171. If you want to be alerted on multiple areas, make a
|
||||||
|
note of those counties and you can re-execute the script and enter the
|
||||||
|
additional counties. You will use the “Zone Code” for the configuration script.
|
||||||
|
|
||||||
|
|
||||||
|
==NWS Weather Forecasts==
|
||||||
|
|
||||||
|
The weather forecast scripts will allow you to get your NWS weather forecast
|
||||||
|
messages by a DTMF sequence and will announce the weather conditions
|
||||||
|
via your node audio.
|
||||||
|
|
||||||
|
You will need to have the NWS Weather Zone ID information prior to running
|
||||||
|
this script.
|
||||||
|
|
||||||
|
Finding the Zonde ID is simlar to getting the County Code. This information can be found at:
|
||||||
|
|
||||||
|
Refer to the following URL:
|
||||||
|
|
||||||
|
http://www.weather.gov/alerts
|
||||||
|
|
||||||
|
Select the "Warnings By State" under "Active Alerts". Select the "Zone List"
|
||||||
|
listed by the desired state. You will see the "Zone Code", now pick from the
|
||||||
|
various State Counties displayed and write this Zone Code down for reference.
|
||||||
|
|
||||||
|
For example, Under Minnesota you wil find - Wright. The Zone code for
|
||||||
|
this county is MNZ059. If you want to to have forecast for other areas,
|
||||||
|
make a note of those counties and you can re-execute the script and enter the
|
||||||
|
additional counties. You will use the “Zone Code” for the configuration script.
|
||||||
|
|
||||||
|
|
||||||
|
==Underground Weather Reports==
|
||||||
|
|
||||||
|
The Underground weather report scripts will allow you to get current weather
|
||||||
|
conditions based upon Weather Underground stations by a dtmf sequence and
|
||||||
|
will announce the weather conditions via your node audio.
|
||||||
|
|
||||||
|
You will need to have the Underground Weather station ID information prior
|
||||||
|
to running this script. Refer to the URL below:
|
||||||
|
|
||||||
|
http://www.wunderground.com/wundermap/
|
||||||
|
|
||||||
|
Browse the map for your local area. You will see the Station ID's of various
|
||||||
|
weather stations. Once you select one on the map, you will find the station ID.
|
||||||
|
This will be begin K, then two letter state abbreviation, and location. For
|
||||||
|
example:
|
||||||
|
|
||||||
|
KMNSTMIC3
|
||||||
|
|
||||||
|
When selecting the desired station and review the captured information to make
|
||||||
|
sure that this has all of the values you want to capture. For example, some
|
||||||
|
stations do not include precipitation. I prefer the “rapid fire” stations
|
||||||
|
since they update most frequently. You will use the “Station ID” for the
|
||||||
|
configuration script.
|
||||||
|
|
||||||
|
For more information, refer to:
|
||||||
|
http://www.w0anm.com/dokuwiki/doku.php?id=irlp:wx_scripts_doc
|
||||||
|
|
||||||
|
|
||||||
|
===Configuration Script===
|
||||||
|
|
||||||
|
The configuration script is called "wx_config.sh" and can be run many times.
|
||||||
|
This script will allow you to select the desired weather scripts that you want
|
||||||
|
to use, see above. It will also prompt you for the required weather codes
|
||||||
|
such as County Codes, Zone Code/ID, and Underground Weather Station ID.
|
||||||
|
|
||||||
|
The "wx_config.sh" script is located in /usr/local/bin/Weather. To
|
||||||
|
configure the weather scripts, change directories and execute the script:
|
||||||
|
|
||||||
|
cd /usr/local/bin/Weather
|
||||||
|
./wx_config.sh
|
||||||
|
|
||||||
|
|
||||||
|
You will see an Important Notice and you will need to ackowledge this
|
||||||
|
notice.
|
||||||
|
|
||||||
|
You will then be prompted for which setup scripts you would like to
|
||||||
|
setup or update.
|
||||||
|
|
||||||
|
Each setup area will update "root" cron and add an entry. In unix, there is
|
||||||
|
a background process (or daemon) running that will execute scripts at a
|
||||||
|
specified time or times. This is how the weather scripts get information
|
||||||
|
from the weather sites. The "wx_config.sh" script will create these entries.
|
||||||
|
|
||||||
|
If you add the same code, the script is will check and will not add an entry if
|
||||||
|
one is already present.
|
||||||
|
|
||||||
|
In the last part of the execution of the script, you will be prompted for
|
||||||
|
your node number and if you want the alerts to be sent over the node
|
||||||
|
automatically when they occur.
|
||||||
|
|
||||||
|
This can be change by re-executing the script.
|
||||||
|
|
||||||
|
|
||||||
|
===Stanza Modification===
|
||||||
|
|
||||||
|
Once the "wx_config.sh" script is executed, you will need to modify the
|
||||||
|
rpt.conf Stanza to select the desired DTMF sequences to play the Weather
|
||||||
|
Forecast, Weather Report, or Alerts. The file that needs to be edited is
|
||||||
|
"/etc/asterisk/rpt.conf"
|
||||||
|
|
||||||
|
Below is an example for my node. Please update dtmf sequence to your
|
||||||
|
node/site requriements.
|
||||||
|
|
||||||
|
Under Node [functions]:
|
||||||
|
|
||||||
|
[functions]
|
||||||
|
|
||||||
|
; Play local wx report, *986
|
||||||
|
986=localplay,/tmp/wx/wxreport_ug/KMNROGER1/cur_WxRpt_ug
|
||||||
|
; Play local wx alert, *987
|
||||||
|
987=localplay,/tmp/wx/alert/MNC171/alert_short
|
||||||
|
; Play local wx forecast, *988
|
||||||
|
988=localplay,/tmp/wx/forecast/MNZ059/wx_forecast
|
||||||
|
|
||||||
|
|
||||||
|
===Operation===
|
||||||
|
|
||||||
|
To play a underground weather report, key your transmitter and enter your
|
||||||
|
dtmf sequence that you selected. You should hear the report being
|
||||||
|
transmitted, for example:
|
||||||
|
|
||||||
|
Weather report for North Ridge , Rogers .
|
||||||
|
Last Updated on September 18, 8:45 PM CDT,
|
||||||
|
the wind was blowing at a speed of 1.0 miles per hour from south south east
|
||||||
|
with wind gusts up to 1.0 miles per hour.
|
||||||
|
The temperature was 65.6 degrees with a dewpoint of 51.3 degrees.
|
||||||
|
The pressure was at 29.92 inches of mercury.
|
||||||
|
The relative humidity was 60 percent.
|
||||||
|
|
||||||
|
You can also play from the command line by entering:
|
||||||
|
|
||||||
|
asterisk -rx "rpt fun <node_number> <dtmf_sequence>"
|
||||||
|
|
||||||
|
for example:
|
||||||
|
|
||||||
|
asterisk -rs "rpt fun 29062 *987"
|
||||||
|
|
||||||
|
|
||||||
|
To play the weather forecast, key your transmitter and enter your
|
||||||
|
dtmf sequence that you selected. You should hear the report being
|
||||||
|
transmitted, for example:
|
||||||
|
|
||||||
|
Weather forecast for
|
||||||
|
wright-
|
||||||
|
including the cities of. . . monticello
|
||||||
|
405 p m thu sep 18 2014
|
||||||
|
. tonight. . . warmer. partly cloudy. lows in the upper 50's. south
|
||||||
|
winds 10 to 15 miles per hour .
|
||||||
|
. friday. . . cloudy with a 40 percent chance of showers and
|
||||||
|
thunderstorms. highs in the upper 70's. south winds 10 to 15 miles per hour
|
||||||
|
. friday night. . . partly cloudy with a 30 percent chance of showers
|
||||||
|
and thunderstorms. lows in the lower 60's. southwest winds 5 to
|
||||||
|
10 miles per hour .
|
||||||
|
. saturday. . . partly cloudy. highs in the upper 70's. northwest
|
||||||
|
winds 10 to 15 miles per hour .
|
||||||
|
. saturday night. . . cooler. mostly clear. lows in the lower 50's.
|
||||||
|
northwest winds 5 to 10 miles per hour .
|
||||||
|
. sunday. . . mostly sunny. highs in the upper 60's.
|
||||||
|
. sunday night. . . clear. lows in the upper 40's.
|
||||||
|
. monday. . . sunny. highs in the upper 60's.
|
||||||
|
. monday night. . . clear. lows in the upper 40's.
|
||||||
|
. tuesday. . . sunny. highs around 70.
|
||||||
|
. tuesday night. . . mostly clear. lows around 50.
|
||||||
|
. wednesday. . . mostly sunny. highs in the upper 60's.
|
||||||
|
. wednesday night. . . partly cloudy. lows in the mid 50's.
|
||||||
|
. thursday. . . mostly cloudy with a slight chance of showers with
|
||||||
|
isolated thunderstorms. highs around 70. chance of rain
|
||||||
|
20 percent.
|
||||||
|
|
||||||
|
You can also play from the command line by entering:
|
||||||
|
|
||||||
|
asterisk -rx "rpt fun <node_number> <dtmf_sequence>"
|
||||||
|
|
||||||
|
for example:
|
||||||
|
|
||||||
|
asterisk -rs "rpt fun 29062 *986"
|
||||||
|
|
||||||
|
The weather alerts are automatic, if enabled. They will alert when there
|
||||||
|
is a weather alert and stop sending when the weather alert is over or expired.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-----------------NOTE-------------------
|
||||||
|
|
||||||
|
You can run this script multiple times to add additional weather stations
|
||||||
|
to your crontab or features.
|
||||||
|
|
||||||
@ -0,0 +1,817 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# wx_config.sh - allstar wxscripts
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# This script configures the wx scripts and creates a wx_scripts.conf file
|
||||||
|
#
|
||||||
|
######################
|
||||||
|
# $Id: wx_config.sh 27 2015-05-11 02:07:28Z w0anm $
|
||||||
|
|
||||||
|
###
|
||||||
|
# Add wx_script.conf info on metric/press/percp
|
||||||
|
|
||||||
|
WEATHER=/usr/local/etc/wx
|
||||||
|
MODULE_INS=no
|
||||||
|
|
||||||
|
IFS=$(echo -en "\n\b")
|
||||||
|
|
||||||
|
# functions
|
||||||
|
# ckyorn function with defaults
|
||||||
|
ckyorn () {
|
||||||
|
return=0
|
||||||
|
if [ "$1" = "y" ] ; then
|
||||||
|
def="y"
|
||||||
|
sec="n"
|
||||||
|
else
|
||||||
|
def="n"
|
||||||
|
sec="y"
|
||||||
|
fi
|
||||||
|
|
||||||
|
while [ $return -eq 0 ]
|
||||||
|
do
|
||||||
|
read -e -p "([$def],$sec): ? " answer
|
||||||
|
case "$answer" in
|
||||||
|
"" ) # default
|
||||||
|
printf "$def"
|
||||||
|
return=1 ;;
|
||||||
|
[Yy]) # yes
|
||||||
|
printf "y"
|
||||||
|
return=1
|
||||||
|
;;
|
||||||
|
[Nn] ) # no
|
||||||
|
printf "n"
|
||||||
|
return=1
|
||||||
|
;;
|
||||||
|
*) printf " ERROR: Please enter y, n or return. " >&2
|
||||||
|
printf ""
|
||||||
|
return=0 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
###################################################
|
||||||
|
|
||||||
|
|
||||||
|
wxAlertSetup () {
|
||||||
|
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Weather Alert Setup
|
||||||
|
|
||||||
|
You will need to have the NWS County number information to setup the Weather
|
||||||
|
Alerts. Refer to the following URL:
|
||||||
|
|
||||||
|
http://www.weather.gov/alerts
|
||||||
|
|
||||||
|
Select the "Warnings By State" under "Active Alerts". Select the County List
|
||||||
|
listed by the desired state. You will see the "County Code", now pick from the
|
||||||
|
various State Counties displayed and write this "County Code" down for reference.
|
||||||
|
|
||||||
|
For example, under Minnesota you will find - Wright. The County Code for
|
||||||
|
this county is MNC171. If you want to be alerted on multiple areas, make a
|
||||||
|
note of those counties and you can re-execute the script and enter the
|
||||||
|
additional counties.
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
# enter NWS County number
|
||||||
|
echo
|
||||||
|
echo "Please enter the National Weather Service County for your area"
|
||||||
|
echo -n " (for example, MNC171): "
|
||||||
|
read var_tmp
|
||||||
|
NWS_COUNTY="`echo \$var_tmp | tr '[:lower:]' '[:upper:]'`"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo -n "Entry your county name: "
|
||||||
|
read COUNTY_NAME
|
||||||
|
|
||||||
|
# save old cron file
|
||||||
|
|
||||||
|
# setup crontab entry for new entry
|
||||||
|
#check if entry is present, if so, skip.
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo " Checking/Adding crontab entry for user root..."
|
||||||
|
echo
|
||||||
|
if ( ! crontab -l | grep $NWS_COUNTY ) ; then
|
||||||
|
|
||||||
|
echo " Adding crontab entry..."
|
||||||
|
|
||||||
|
# create crontab enties
|
||||||
|
cat > crontab_entry << _EOF
|
||||||
|
# NWS Alert for $NWS_COUNTY in $COUNTY_NAME
|
||||||
|
2,16,30,44 * * * * (/usr/local/bin/getWxAlert $NWS_COUNTY "$COUNTY_NAME" &> /dev/null 2>&1)
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
# append entry to cron
|
||||||
|
# now append this file to the crontab entry
|
||||||
|
crontab -l -u root | cat - crontab_entry > new_cron
|
||||||
|
crontab -u root new_cron
|
||||||
|
# cleanup
|
||||||
|
rm -f crontab_entry new_cron
|
||||||
|
echo " Entry Added..."
|
||||||
|
echo
|
||||||
|
WX_ALERT=yes
|
||||||
|
MODULE_INS=yes
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Crontab already has entry for ${NWS_COUNTY}.. (see above)"
|
||||||
|
echo
|
||||||
|
WX_ALERT=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "--------"
|
||||||
|
echo -n "Press any key to continue..."
|
||||||
|
read ANS
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
wxReportSetup () {
|
||||||
|
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Weather Underground Report Setup
|
||||||
|
|
||||||
|
You will need to have the Underground Weather station ID information prior
|
||||||
|
to running this script. Refer to the URL below:
|
||||||
|
http://www.wunderground.com/wundermap/
|
||||||
|
|
||||||
|
Browse the map for your local area. You will see the Station ID's of various
|
||||||
|
weather stations. Once you select one on the map, you will find the station ID.
|
||||||
|
This will be begin K, then two letter state abbreviation, and location. For
|
||||||
|
example:
|
||||||
|
example:
|
||||||
|
|
||||||
|
KMNROGER1
|
||||||
|
|
||||||
|
When selecting the desired station and review the captured information to make
|
||||||
|
sure that this has all of the values you want to capture. For example, some
|
||||||
|
stations do not include precipitation. I prefer the “rapid fire” stations
|
||||||
|
since they update most frequently. You will use the “Station ID” for the
|
||||||
|
configuration file.
|
||||||
|
|
||||||
|
For more information, refer to:
|
||||||
|
http://www.w0anm.com/dokuwiki/doku.php?id=irlp:wx_scripts_doc
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
|
||||||
|
echo "Please enter the Underground Weather Station ID"
|
||||||
|
echo -n " (for example, KMNROGER1): "
|
||||||
|
read var_tmp
|
||||||
|
|
||||||
|
UG_STN_N="`echo \$var_tmp | tr '[:lower:]' '[:upper:]'`"
|
||||||
|
|
||||||
|
#check if entry is present, if so, skip.
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo " Checking/Adding crontab entry for user root..."
|
||||||
|
echo
|
||||||
|
if ( ! crontab -l | grep $UG_STN_N ) ; then
|
||||||
|
|
||||||
|
echo " Adding crontab entry..."
|
||||||
|
|
||||||
|
# create crontab enties
|
||||||
|
cat > crontab_entry << _EOF
|
||||||
|
# Underground Weather for station: $UG_STN_N
|
||||||
|
3,18,31,48 * * * * (/usr/local/bin/getWxRpt_ug $UG_STN_N &> /dev/null 2>&1)
|
||||||
|
|
||||||
|
# Underground Weather (pressure trends) for station: $UG_STN_N
|
||||||
|
0 */6 * * * (/usr/local/bin/trend $UG_STN_N &> /dev/null 2>&1)
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
# now append this file to the crontab entry
|
||||||
|
crontab -l -u root | cat - crontab_entry > new_cron
|
||||||
|
crontab -u root new_cron
|
||||||
|
# cleanup
|
||||||
|
rm -f crontab_entry new_cron
|
||||||
|
echo " Entry Added..."
|
||||||
|
echo
|
||||||
|
WX_REPORT=yes
|
||||||
|
MODULE_INS=yes
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Crontab already has entry for ${UG_STN_N}.. (see above)"
|
||||||
|
echo
|
||||||
|
WX_REPORT=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "--------"
|
||||||
|
echo -n "Press any key to continue..."
|
||||||
|
read ANS
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxForecastSetup () {
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Weather Forecast Setup
|
||||||
|
|
||||||
|
You will need to have the NWS Weather Zone ID information prior to running this script.
|
||||||
|
|
||||||
|
Refer to the following URL:
|
||||||
|
|
||||||
|
http://www.weather.gov/alerts
|
||||||
|
|
||||||
|
Select the "Warnings By State" under "Active Alerts". Select the "Zone List"
|
||||||
|
listed by the desired state. You will see the "Zone Code", now pick from the
|
||||||
|
various State Counties displayed and write this Zone Code down for reference.
|
||||||
|
|
||||||
|
For example, Under Minnesota you will find - Wright. The Zone Code for
|
||||||
|
this county is MNZ059. If you want to to have forecast for other areas,
|
||||||
|
make a note of those counties and you can re-execute the script and enter the
|
||||||
|
additional counties.
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Please enter the NWS Zone forecast ID "
|
||||||
|
echo -n " (for example, MNZ059): "
|
||||||
|
read var_tmp
|
||||||
|
NWS_ZONE="`echo \$var_tmp | tr '[:lower:]' '[:upper:]'`"
|
||||||
|
|
||||||
|
#check if entry is present, if so, skip.
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo " Checking/Adding crontab entry for user root..."
|
||||||
|
echo
|
||||||
|
if ( ! crontab -l | grep $NWS_ZONE ) ; then
|
||||||
|
|
||||||
|
echo " Adding crontab entry..."
|
||||||
|
|
||||||
|
# create crontab enties
|
||||||
|
cat > crontab_entry << _EOF
|
||||||
|
# National Wx Service Forecast based on Zone: $NWS_ZONE
|
||||||
|
5,21,41 * * * * (/usr/local/bin/getWxFor $NWS_ZONE &> /dev/null 2>&1)
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
# now append this file to the crontab entry
|
||||||
|
crontab -l -u root | cat - crontab_entry > new_cron
|
||||||
|
crontab -u root new_cron
|
||||||
|
# cleanup
|
||||||
|
rm -f crontab_entry new_cron
|
||||||
|
echo " Entry Added..."
|
||||||
|
echo
|
||||||
|
WX_FORECAST=yes
|
||||||
|
MODULE_INS=yes
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Crontab already has entry for ${NWS_ZONE}.. (see above)"
|
||||||
|
echo
|
||||||
|
WX_FORECAST=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "--------"
|
||||||
|
echo -n "Press any key to continue..."
|
||||||
|
read ANS
|
||||||
|
}
|
||||||
|
|
||||||
|
dtmf_sequence () {
|
||||||
|
dtmf_type=$1
|
||||||
|
|
||||||
|
if [ "$RPT_STANZA" = "DIRECT" ] ; then
|
||||||
|
RPT_FILE=/etc/asterisk/rpt.conf
|
||||||
|
else
|
||||||
|
RPT_FILE=/usr/local/etc/asterisk_tpl/rpt.conf_tpl
|
||||||
|
fi
|
||||||
|
|
||||||
|
OK=1
|
||||||
|
while [ "$OK" = "1" ] ; do
|
||||||
|
echo -n "Input dtmf sequence for $dtmf_type :"
|
||||||
|
read DTMF_SEQ
|
||||||
|
if (grep "^${DTMF_SEQ}" ${RPT_FILE}) ; then
|
||||||
|
echo "sequence already used..."
|
||||||
|
OK=1
|
||||||
|
else
|
||||||
|
#echo "${DTMF_SEQ}"
|
||||||
|
OK=0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## end of functions
|
||||||
|
########################################################################
|
||||||
|
## main
|
||||||
|
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
Weather configuration script...
|
||||||
|
|
||||||
|
============================================================================
|
||||||
|
| IMPORTANT NOTICE! |
|
||||||
|
| |
|
||||||
|
| No matter what the Weather Alerts are indicating, the information |
|
||||||
|
| gathered and presented here may NOT be accurate. You MUST use your own |
|
||||||
|
| judgement to determine your best course of action in any given |
|
||||||
|
| circumstance! The are many reasons WHY the data here may not be accurate, |
|
||||||
|
| including, but not limited to, software problems, network problems, and or |
|
||||||
|
| hardware problems. The Weather Alerts and other Weather information should |
|
||||||
|
| NOT be used to make any determination of actual current conditions, it is |
|
||||||
|
| merely an indication of what the software is seeing as a result of it's |
|
||||||
|
| attempts to read publicly available data sources. These data sources may |
|
||||||
|
| be unavailable, unreachable, or inaccurate. Please check other sources to |
|
||||||
|
| verify any information presented here. |
|
||||||
|
============================================================================
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
echo -n "Do you understand and acknowledge the above notice " ; ANS=$(ckyorn n)
|
||||||
|
if [ "$ANS" = "n" ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# select the scripts to be installed
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Weather Scripts
|
||||||
|
|
||||||
|
This program will configure your node to gather weather information base upon
|
||||||
|
the NWS and Weather Underground web sites. You can configure Weather Alerts,
|
||||||
|
Weather Forecasts, and current local Weather Underground weather station
|
||||||
|
reports. You can select all of these options or just the ones you want to use.
|
||||||
|
|
||||||
|
You will be prompted for entering various information that the Weather Scripts
|
||||||
|
use to gather information. You can run this script as many times as you wish
|
||||||
|
to setup alerts, forecasts, and local weather reporting.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
_EOF
|
||||||
|
echo "Do you wish to setup, reconfigure, or add additional reporting area's for"
|
||||||
|
echo -n "the weather scripts (answering 'n' will exit script): "
|
||||||
|
|
||||||
|
ANS=$(ckyorn y)
|
||||||
|
if [ "$ANS" = "n" ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Weather Alert Scripts
|
||||||
|
|
||||||
|
These scripts will allow you to get short alert messages via your node audio.
|
||||||
|
Various Alert criteria can be specified such as Winter Advisories, Tornado
|
||||||
|
Warnings, etc. Please refer to documentation for further information.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
echo "Do you wish to add or add additional county weather alerts to your"
|
||||||
|
echo -n "node: " ; ANS=$(ckyorn n)
|
||||||
|
|
||||||
|
if [ "$ANS" = "y" ] ; then wxAlertSetup ; fi
|
||||||
|
|
||||||
|
# do you want weather reports?
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Underground Weather Report Scripts
|
||||||
|
|
||||||
|
These scripts will to get current weather conditions based upon downloaded
|
||||||
|
Weather Underground station information. This information is then available
|
||||||
|
to you by entering a DTMF sequence to announce the weather conditions via
|
||||||
|
your node audio.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
echo -n "Do you wish to add or add additional weather reports: " ; ANS=$(ckyorn n)
|
||||||
|
if [ "$ANS" = "y" ] ; then wxReportSetup ; fi
|
||||||
|
|
||||||
|
# do you want weather forecasts?
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Weather Forecast Scripts
|
||||||
|
|
||||||
|
This script will allow you to get your NWS weather forecast messages based
|
||||||
|
upon downloaded NWS zone information. This information then is available
|
||||||
|
to you by entering a DTMF sequence to announce the weather forecast via
|
||||||
|
your node audio.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Do you wish to add or add additional weather forecasts:
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
ANS=$(ckyorn n)
|
||||||
|
if [ "$ANS" = "y" ] ; then wxForecastSetup ; fi
|
||||||
|
|
||||||
|
# verify the selections and information
|
||||||
|
|
||||||
|
if [ -f $WEATHER/wx_scripts.conf ] ; then
|
||||||
|
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Script Configuration
|
||||||
|
|
||||||
|
The scripts have already been configured. If you choose, you can change
|
||||||
|
your weather configurations. this selection allows you to change the
|
||||||
|
audio volue, weather units of measure (metric/us), and email (Gmail)
|
||||||
|
support.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
echo -n "Do you want to reconfigure the weather scripts " ; ANS=$(ckyorn n)
|
||||||
|
echo
|
||||||
|
if [ "$ANS" = "n" ] ; then
|
||||||
|
RECONF=no
|
||||||
|
else
|
||||||
|
RECONF=yes
|
||||||
|
cp $WEATHER/wx_scripts.conf $WEATHER/wx_scripts.conf_SAVE
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Script Configuration
|
||||||
|
|
||||||
|
The wx scripts will need to configure your node settings such as units
|
||||||
|
of meassure, audio volume, email support.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
RECONF=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
# setup the wx_configuration script, if needed.
|
||||||
|
if [ "$RECONF" = yes ] ; then
|
||||||
|
|
||||||
|
if [ -f $WEATHER/wx_scripts.conf ] ; then
|
||||||
|
source $WEATHER/wx_scripts.conf
|
||||||
|
else
|
||||||
|
WXVOL="3"
|
||||||
|
UNITS=US
|
||||||
|
PRES_UNITS=IN
|
||||||
|
RAIN_UNITS=IN
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make working copy
|
||||||
|
cp $WEATHER/wx_scripts.conf_tpl /tmp/wx_scripts.tmp
|
||||||
|
|
||||||
|
CUR_VOL=$WXVOL
|
||||||
|
|
||||||
|
echo -n "Enter the volume setting for ulaw files [$CUR_VOL] :"
|
||||||
|
read ANS
|
||||||
|
if [ -z "$ANS" ]; then
|
||||||
|
WXVOL=$CUR_VOL
|
||||||
|
else
|
||||||
|
WXVOL=$ANS
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Vol, change the WXVOL in the wx_scripts.tmp file
|
||||||
|
sed "s/_WXVOL_/${WXVOL}/g" /tmp/wx_scripts.tmp > /tmp/wx_scripts.tmp1
|
||||||
|
mv /tmp/wx_scripts.tmp1 /tmp/wx_scripts.tmp
|
||||||
|
|
||||||
|
# Configure wx_config.conf file
|
||||||
|
# (wxalert beacon, report output - metric or US units)
|
||||||
|
|
||||||
|
# check if configured by looking at cron entries. if not, skip
|
||||||
|
if ( crontab -l | grep getWxAlert &> /dev/null) ; then
|
||||||
|
# Alert Beacon
|
||||||
|
echo
|
||||||
|
echo -n "Do you want to enable over the air weather alerts " ; ANS=$(ckyorn y)
|
||||||
|
|
||||||
|
if [ "$ANS" = "n" ] ; then
|
||||||
|
sed 's/_WXALERT_BEACON_/N/g' /tmp/wx_scripts.tmp > /tmp/wx_scripts.tmp1
|
||||||
|
else
|
||||||
|
sed 's/_WXALERT_BEACON_/Y/g' /tmp/wx_scripts.tmp > /tmp/wx_scripts.tmp1
|
||||||
|
fi
|
||||||
|
mv /tmp/wx_scripts.tmp1 /tmp/wx_scripts.tmp
|
||||||
|
|
||||||
|
# Email Setup/Change
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
Optionally, you can send alert information to your cell phone or email account, using a Gmail account. This will provide further information about the alert
|
||||||
|
and can be sent to several email accounts.
|
||||||
|
|
||||||
|
This will require a Gmail account with known account name and password.
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
echo -n "Do you wish to setup email alerts with Gmail "
|
||||||
|
ANS=$(ckyorn n)
|
||||||
|
if [ "$ANS" = "y" ] ; then
|
||||||
|
# prompt for Gmail account, password, and email addresses for
|
||||||
|
# wx alerts.
|
||||||
|
VAL=1
|
||||||
|
while [ "$VAL" = "1" ] ; do
|
||||||
|
echo
|
||||||
|
echo -n "Enter Gmail Account User's email (acctname@gmail.com): "
|
||||||
|
read user
|
||||||
|
echo
|
||||||
|
echo -n "Enter Gmail Account Password: "
|
||||||
|
read password
|
||||||
|
echo
|
||||||
|
echo -n "Enter the email address that the alerts are to be sent: "
|
||||||
|
read Email
|
||||||
|
echo
|
||||||
|
echo " Gmail Acount User: $user"
|
||||||
|
echo " Gmail Account Password: $password"
|
||||||
|
echo " Email Address for Alerts: $Email"
|
||||||
|
echo
|
||||||
|
echo -n "Is the information above correct: " ; ANS=$(ckyorn n)
|
||||||
|
if [ "$ANS" = "y" ] ; then
|
||||||
|
# break out.
|
||||||
|
VAL=0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cat > /usr/local/etc/.sendmail.cfg << _EOF
|
||||||
|
[gmail_send]
|
||||||
|
user = $user
|
||||||
|
password = $password
|
||||||
|
from = $user
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
# cjk
|
||||||
|
# now modify the EMAIL entry in the wx_scripts.conf file
|
||||||
|
sed "s/#EMAIL=\"_EMAIL_\"/EMAIL=\"${Email}\"/g" /tmp/wx_scripts.tmp > /tmp/wx_scripts.tmp1
|
||||||
|
mv /tmp/wx_scripts.tmp1 /tmp/wx_scripts.tmp
|
||||||
|
|
||||||
|
fi # gmail account
|
||||||
|
|
||||||
|
fi # Weather Alert end
|
||||||
|
|
||||||
|
|
||||||
|
clear
|
||||||
|
# Weather Reports
|
||||||
|
# check crontab if user is using ug_wx_reports.
|
||||||
|
# if so, prompt for units, if not, skip
|
||||||
|
if ( crontab -l | grep getWxRpt_ug &> /dev/null) ; then
|
||||||
|
# Units
|
||||||
|
if [ "$UNITS" = "US" ] ; then
|
||||||
|
DEF=y
|
||||||
|
else
|
||||||
|
DEF=n
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "For weather reports, do you want to use US units"
|
||||||
|
echo -n " (Answer 'n' for Metric): "; ANS=$(ckyorn $DEF)
|
||||||
|
|
||||||
|
# USE METRIC for metric or US
|
||||||
|
if [ "$ANS" = "y" ] ; then
|
||||||
|
UNITS=US
|
||||||
|
PRES_UNITS=IN
|
||||||
|
RAIN_UNITS=IN
|
||||||
|
else
|
||||||
|
UNITS=METRIC
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$UNITS" = "METRIC" ] ; then
|
||||||
|
# need pressure units
|
||||||
|
echo " 1 - Pressure in Hectopascals"
|
||||||
|
echo " 2 - Pressure in Inches of Mercury"
|
||||||
|
echo " 3 - Pressure in Millibars of Mercury"
|
||||||
|
echo
|
||||||
|
echo -n "Select number for selection (1-3): "
|
||||||
|
VAL=1
|
||||||
|
while [ "$VAL" = "1" ] ; do
|
||||||
|
read ANS
|
||||||
|
case "$ANS" in
|
||||||
|
1) PRES_UNITS=HPA
|
||||||
|
VAL=0
|
||||||
|
;;
|
||||||
|
2) PRES_UNITS=IN
|
||||||
|
VAL=0
|
||||||
|
;;
|
||||||
|
3) PRES_UNITS=MB
|
||||||
|
VAL=0
|
||||||
|
;;
|
||||||
|
*) echo "Invalid selection, enter 1,2,or 3"
|
||||||
|
VAL=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# need Rain units
|
||||||
|
echo " 1 - Precipitation in Inches"
|
||||||
|
echo " 2 - Precipitation in Centimeters"
|
||||||
|
echo " 3 - Precipitation in Millimeters"
|
||||||
|
echo
|
||||||
|
echo -n "Select number for selection (1-3): "
|
||||||
|
VAL=1
|
||||||
|
while [ "$VAL" = "1" ] ; do
|
||||||
|
read ANS
|
||||||
|
case "$ANS" in
|
||||||
|
1) RAIN_UNITS=IN
|
||||||
|
VAL=0
|
||||||
|
;;
|
||||||
|
2) RAIN_UNITS=CM
|
||||||
|
VAL=0
|
||||||
|
;;
|
||||||
|
3) RAIN_UNITS=MM
|
||||||
|
VAL=0
|
||||||
|
;;
|
||||||
|
*) echo "Invalid Selection, enter 1,2,or 4"
|
||||||
|
VAL=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Units
|
||||||
|
sed "s/_UNITS_/${UNITS}/g" /tmp/wx_scripts.tmp > /tmp/wx_scripts.tmp1
|
||||||
|
mv /tmp/wx_scripts.tmp1 /tmp/wx_scripts.tmp
|
||||||
|
|
||||||
|
# Pressure
|
||||||
|
sed "s/_PRES_/${PRES_UNITS}/g" /tmp/wx_scripts.tmp > /tmp/wx_scripts.tmp1
|
||||||
|
mv /tmp/wx_scripts.tmp1 /tmp/wx_scripts.tmp
|
||||||
|
|
||||||
|
# Rain
|
||||||
|
sed "s/_RAIN_/${RAIN_UNITS}/g" /tmp/wx_scripts.tmp > /tmp/wx_scripts.tmp1
|
||||||
|
mv /tmp/wx_scripts.tmp1 /tmp/wx_scripts.tmp
|
||||||
|
|
||||||
|
|
||||||
|
fi ; # end of wx report config changes
|
||||||
|
|
||||||
|
|
||||||
|
# save old cron file
|
||||||
|
|
||||||
|
# Move to final resting place
|
||||||
|
mv /tmp/wx_scripts.tmp $WEATHER/wx_scripts.conf
|
||||||
|
|
||||||
|
fi ; # end of config
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
# Stanza Modification
|
||||||
|
# /etc/asterisk/rpt.conf info
|
||||||
|
if [ "$MODULE_INS" = yes ] ; then
|
||||||
|
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------
|
||||||
|
Stanza Modification
|
||||||
|
You will need to edit the /etc/asterisk/rpt.conf file to include the
|
||||||
|
localplay entries under your node's functions stanza. This can be done
|
||||||
|
a number of ways. You can manually edit the /etc/asterisk/rpt.conf file,
|
||||||
|
you can automatically updated the asterisk templates or automatically
|
||||||
|
modify the /etc/asterisk/rpt.conf file. If you are using the
|
||||||
|
node-config.sh script and you would like to continue the automation
|
||||||
|
which that script provides, it is recommend that you use automatically
|
||||||
|
update the templates.
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
# '
|
||||||
|
VAL=1
|
||||||
|
while [ "$VAL" = "1" ] ; do
|
||||||
|
echo "1) Manually Edit"
|
||||||
|
echo "2) Automatically update the asterisk template file"
|
||||||
|
echo "3) Automatically update the /etc/asterisk/rpt.conf file"
|
||||||
|
echo
|
||||||
|
echo -n "Select number (1,2,or 3): "
|
||||||
|
read ANS
|
||||||
|
case "$ANS" in
|
||||||
|
1) RPT_STANZA=MANUAL
|
||||||
|
VAL=0
|
||||||
|
;;
|
||||||
|
2) RPT_STANZA=TEMPLATE
|
||||||
|
VAL=0
|
||||||
|
;;
|
||||||
|
3) RPT_STANZA=DIRECT
|
||||||
|
VAL=0
|
||||||
|
;;
|
||||||
|
*) echo "Invalid selection, enter 1,2,or 3"
|
||||||
|
VAL=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Enter the DTMF Sequences and crate the temp file. This will be used to add to the rpt.conf,
|
||||||
|
# template, or just print out as an example depending on the RPT_STANZA variable.
|
||||||
|
|
||||||
|
if [ "$WX_ALERT" = "yes" ] ; then
|
||||||
|
dtmf_sequence "${NWS_COUNTY} alert announcement"
|
||||||
|
# wx alert
|
||||||
|
cat << _EOF >> /tmp/rpt_config.tmp
|
||||||
|
|
||||||
|
; Play local wx alert, *${DTMF_SEQ}
|
||||||
|
${DTMF_SEQ}=localplay,/tmp/wx/alert/${NWS_COUNTY}/alert_short
|
||||||
|
_EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$WX_REPORT" = "yes" ] ; then
|
||||||
|
dtmf_sequence "${UG_STN_N} report announcement"
|
||||||
|
# wx report
|
||||||
|
cat << _EOF >> /tmp/rpt_config.tmp
|
||||||
|
|
||||||
|
; Play local wx report, *${DTMF_SEQ}
|
||||||
|
${DTMF_SEQ}=localplay,/tmp/wx/wxreport_ug/${UG_STN_N}/cur_WxRpt_ug
|
||||||
|
_EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$WX_FORECAST" = "yes" ] ; then
|
||||||
|
dtmf_sequence "${NWS_ZONE} forecast announcement"
|
||||||
|
# wx forecast
|
||||||
|
cat << _EOF >> /tmp/rpt_config.tmp
|
||||||
|
|
||||||
|
; Play local wx forecast, *${DTMF_SEQ}
|
||||||
|
${DTMF_SEQ}=localplay,/tmp/wx/forecast/${NWS_ZONE}/wx_forecast
|
||||||
|
_EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Manual Edit
|
||||||
|
if [ "$RPT_STANZA" = "MANUAL" ] ; then
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------
|
||||||
|
Manually Editing /etc/asterisk/rpt.conf
|
||||||
|
You will need to edit the /etc/asterisk/rpt.conf file to include the
|
||||||
|
localplay entries under your node's functions stanza.
|
||||||
|
|
||||||
|
Please manually update the /etc/asterisk/rpt.conf file under the stanza
|
||||||
|
[functions] as shown below:
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
cat /tmp/rpt_config.tmp
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo -n "Press any key to continue..." ; read ANS
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# update template file
|
||||||
|
if [ "$RPT_STANZA" = "TEMPLATE" ] ; then
|
||||||
|
RPT_FILE=/usr/local/etc/asterisk_tpl/rpt.conf_tpl
|
||||||
|
echo "Update template file..."
|
||||||
|
sed -e '/^; Weather Script Functions/r /tmp/rpt_config.tmp' ${RPT_FILE} > /tmp/rpt.conf_new
|
||||||
|
mv /tmp/rpt.conf_new ${RPT_FILE}
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
----------------------------------------
|
||||||
|
Updating Templates
|
||||||
|
The node-config.sh script will now be executed, please answer the default
|
||||||
|
values except for the first prompt. This will update the rpt.conf file
|
||||||
|
during execution.
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
echo -n "Do you which to execute the node-config.sh now :" ; ANS=$(ckyorn n)
|
||||||
|
if [ "$ANS" = "y" ] ; then
|
||||||
|
/usr/local/sbin/node-config.sh
|
||||||
|
else
|
||||||
|
echo "You will need to execute the node-config.sh script manually to update"
|
||||||
|
echo "the rpt.conf file"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo -n "Press any key to continue..."; read ANS
|
||||||
|
fi ; # end of template update
|
||||||
|
|
||||||
|
# update actual rpt.conf file
|
||||||
|
if [ "$RPT_STANZA" = "DIRECT" ] ; then
|
||||||
|
RPT_FILE=/etc/asterisk/rpt.conf
|
||||||
|
sed -e '/^; Weather Script Functions/r /tmp/rpt_config.tmp' ${RPT_FILE} > /tmp/rpt.conf_new
|
||||||
|
mv /tmp/rpt.conf_new ${RPT_FILE}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "rpt.conf edit is completed..."
|
||||||
|
|
||||||
|
# Do you use asterisk_tmpl (node-config.sh scripts)?
|
||||||
|
# if yes, modify the templates, then run node-config.sh
|
||||||
|
# else, backup rtp.conf and edit (sed) rtp.conf.
|
||||||
|
# Need to get DTMF codes for each of the modules installed.
|
||||||
|
|
||||||
|
|
||||||
|
fi ; # end of module edits
|
||||||
|
|
||||||
|
# clean up...
|
||||||
|
|
||||||
|
rm -f /tmp/rpt_config.tmp
|
||||||
|
|
||||||
|
clear
|
||||||
|
cat << _EOF
|
||||||
|
|
||||||
|
|
||||||
|
-----------------NOTE-------------------
|
||||||
|
|
||||||
|
You can run this script multiple times to add additional weather stations
|
||||||
|
to your crontab or features.
|
||||||
|
|
||||||
|
The weather information will not be available until the cron jobs have
|
||||||
|
downloaded the weather information from the websites. This can take up
|
||||||
|
20 minutes.
|
||||||
|
|
||||||
|
----------------------------------------
|
||||||
|
Setup/Update Completed
|
||||||
|
----------------------------------------
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
exit
|
||||||
@ -0,0 +1,133 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# wx_scripts.conf - allstar wxscripts
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# Weather Script Configuration File. Sets up the variables used by the various weather scripts.
|
||||||
|
#
|
||||||
|
##############################
|
||||||
|
# $Id: wx_scripts.conf_ 24 2015-03-27 00:53:24Z w0anm $
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# #
|
||||||
|
# DO NOT EDIT THIS FILE, this is a template and will be used to #
|
||||||
|
# generate a new wx_scripts.conf file, #
|
||||||
|
# #
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
UNITS=_UNITS_ # USE METRIC for metric or US
|
||||||
|
|
||||||
|
PRES_UNITS=_PRES_ # HPA=hPa (or hectopascals)
|
||||||
|
# IN=Inches of Mercury
|
||||||
|
# MB=Millibars of Mercury
|
||||||
|
|
||||||
|
RAIN_UNITS=_RAIN_ # IN=inches
|
||||||
|
# CM=centimeters
|
||||||
|
# MM=millimeters
|
||||||
|
|
||||||
|
WXVOL="_WXVOL_" # Volume control to adjust ulaw output file
|
||||||
|
# integer 1-10, were 10 is highest volume
|
||||||
|
|
||||||
|
# Playback Mode
|
||||||
|
PLAYBACK_MODE=LOCAL # Choices --> LOCAL -or-
|
||||||
|
# ALLPLAYBACK
|
||||||
|
|
||||||
|
# Email address to where Alert notices will be sent. Must have email
|
||||||
|
# configured correctly. If not used, leave commented out.
|
||||||
|
#EMAIL="_EMAIL_"
|
||||||
|
|
||||||
|
# Play Weather Alert Beacon
|
||||||
|
WXALERT_BEACON="_WXALERT_BEACON_" # Play weather alert message
|
||||||
|
# "C" = critical alerts only
|
||||||
|
# "Y" = yes, "N" = no
|
||||||
|
|
||||||
|
FULL_ALERT="N" # Alert Summary, Full or Truncated
|
||||||
|
# "Y" - Full alert info
|
||||||
|
# "N" - No (truncated)
|
||||||
|
|
||||||
|
# Sleeptime sequence for weather alerts.
|
||||||
|
# This squence is the initial time when the beacons will be sent out
|
||||||
|
# when a new alert or an alert revision has occured. The time is in
|
||||||
|
# seconds. If you use a value of "0", it will stop further alerts
|
||||||
|
# until a new alert, revised alert.
|
||||||
|
# below show sequence is 5m, 10m, 30m 30m, then every hour
|
||||||
|
SLEEPTIME_SEQ="300 600 1800 1800"
|
||||||
|
|
||||||
|
# below shows sequence is 5m, 10m, 30m, 30m, then stop futher messages:
|
||||||
|
# SLEEPTIME_SEQ="300 600 1800 1800 0"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# No editing required from this point.
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/vendor_perl:/usr/bin/core_perl
|
||||||
|
|
||||||
|
WGET="/usr/bin/wget"
|
||||||
|
|
||||||
|
# Directories used by weather scripts:
|
||||||
|
|
||||||
|
WX_LOGDIR=/tmp/wx/log/asterisk/wx
|
||||||
|
LOGFILE=${WX_LOGDIR}/wx_messages
|
||||||
|
|
||||||
|
WXDIR="/tmp/wx"
|
||||||
|
|
||||||
|
# Weather Alert Specific Variables
|
||||||
|
# Alert spool directory
|
||||||
|
WXALERT_SPOOLDIR="$WXDIR/alert" # Location for raw audio and data
|
||||||
|
|
||||||
|
# Weather Forcast Specific Variables
|
||||||
|
# Forcast spool directory
|
||||||
|
WXFOR_SPOOLDIR="$WXDIR/forecast"
|
||||||
|
|
||||||
|
LOCAL=/tmp/wx/local
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
#
|
||||||
|
# Standard Script Opening
|
||||||
|
#
|
||||||
|
# Make sure we are user asterisk!!!
|
||||||
|
# if [ `/usr/bin/whoami` != "asterisk" ] ; then
|
||||||
|
# echo "${0##*/} must be run as user \"asterisk\"!"
|
||||||
|
# exit 1
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# Create Spool directory (WXALERT_SPOOLDIR)
|
||||||
|
if [ ! -d $WXALERT_SPOOLDIR ] ; then
|
||||||
|
mkdir -p $WXALERT_SPOOLDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create local directory if not preset
|
||||||
|
if [ ! -d $LOCAL ] ; then
|
||||||
|
mkdir -p $LOCAL
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d $WX_LOGDIR ] ; then
|
||||||
|
mkdir -p $WX_LOGDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$PLAYBACKMODE" = "ALLPLAYBACK" ] ; then
|
||||||
|
# all play back
|
||||||
|
PLAYBACK_MODE="playback"
|
||||||
|
else
|
||||||
|
# local play back
|
||||||
|
PLAYBACK_MODE="localplay"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# common functions:
|
||||||
|
#
|
||||||
|
########################################################################
|
||||||
|
#
|
||||||
|
# Convenience functions
|
||||||
|
#
|
||||||
|
# Send message to LOGFILE
|
||||||
|
function log () {
|
||||||
|
MESSAGE="${0##*/}: $@"
|
||||||
|
echo "$MESSAGE"
|
||||||
|
if [ -n "$LOGFILE" ]; then
|
||||||
|
echo "`date '+%b %d %Y %T %z'` $MESSAGE" >> $LOGFILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# END Common Functions
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# getWxFor - allstar wxscripts
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# This script gets the NWS zone forecast and converts to audio file
|
||||||
|
#
|
||||||
|
#####################
|
||||||
|
# $Id: getWxFor 24 2015-03-27 00:53:24Z w0anm $
|
||||||
|
|
||||||
|
# renice the proceses to a lower priority
|
||||||
|
renice -n 19 -p $$
|
||||||
|
|
||||||
|
WEATHER="/usr/local/etc/wx"
|
||||||
|
|
||||||
|
# Load config file
|
||||||
|
|
||||||
|
if [ -f ${WEATHER}/wx_scripts.conf ] ; then
|
||||||
|
source ${WEATHER}/wx_scripts.conf
|
||||||
|
else
|
||||||
|
echo "Missing ${WEATHER}/wx_scripts.conf file, aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if ZONE not an argument, then error.
|
||||||
|
if [ "$1" = "" ] ; then
|
||||||
|
echo "Missing Argument, need wx underground station id.."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
ZONE_FOR=$1
|
||||||
|
fi
|
||||||
|
if [ ! -d $WXFOR_SPOOLDIR/$ZONE_FOR ] ; then
|
||||||
|
mkdir -p $WXFOR_SPOOLDIR/$ZONE_FOR
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Local noaa forecast text link
|
||||||
|
# setup ZONE_FOR variable to convert to lower case and extract state
|
||||||
|
LC_ZONE=`echo $ZONE_FOR | tr 'A-Z' 'a-z'`
|
||||||
|
STATE=`echo $LC_ZONE | awk 'BEGIN { FS="z" } { print $1} '`
|
||||||
|
|
||||||
|
# set URL for wget. This is the url where the forcasts originate.
|
||||||
|
URL="http://weather.noaa.gov/pub/data/forecasts/zone/${STATE}/${LC_ZONE}.txt"
|
||||||
|
|
||||||
|
WX_TXT="wx_forecast.txt"
|
||||||
|
WX_TXT_TMP="wx_forecast.tmp"
|
||||||
|
WX_TXT_TMP2="wx_forecast2.tmp"
|
||||||
|
|
||||||
|
### ADD TTS CALL in function
|
||||||
|
TextToSpeech () {
|
||||||
|
TTS_PROGRAM="/usr/local/bin/tts_audio.sh -v ${WXVOL} "
|
||||||
|
$TTS_PROGRAM $1
|
||||||
|
if [ "$DEBUG" = "2" ] ; then
|
||||||
|
echo "TextToSpeech=$1"
|
||||||
|
echo "Converted audio file=${1%.txt}.ul"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
###### End of Functions ######
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------- Main program -----------------------------
|
||||||
|
|
||||||
|
cd $WXFOR_SPOOLDIR/$ZONE_FOR
|
||||||
|
$WGET -q $URL -O - > $WX_TXT_TMP
|
||||||
|
|
||||||
|
# delete the first 10 lines before converting
|
||||||
|
TOTAL_LINE=`wc $WX_TXT_TMP | awk '{print $1}'`
|
||||||
|
LINE_DISP=`expr $TOTAL_LINE - 8`
|
||||||
|
|
||||||
|
# sed -f ${WEATHER}/wxtext_conv.sed $WX_TXT_TMP > $WX_TXT
|
||||||
|
|
||||||
|
tail -${LINE_DISP} $WX_TXT_TMP | sed "s/\./\. /g ; s/0S/0's/g ; s/\$\$\$/. . /g" | sed -f ${WEATHER}/wxtext_conv.sed > $WX_TXT
|
||||||
|
|
||||||
|
|
||||||
|
# Do standard conversion..
|
||||||
|
# first convert to lower case
|
||||||
|
cat $WX_TXT | tr 'A-Z' 'a-z' > $WX_TXT_TMP
|
||||||
|
|
||||||
|
sed -f ${WEATHER}/wxtext_conv.sed $WX_TXT_TMP > $WX_TXT_TMP2
|
||||||
|
|
||||||
|
# add heater and cat file
|
||||||
|
echo "Weather forecast for " > $WX_TXT_TMP
|
||||||
|
cat $WX_TXT_TMP $WX_TXT_TMP2 > $WX_TXT
|
||||||
|
|
||||||
|
# clean up temp files
|
||||||
|
rm $WX_TXT_TMP $WX_TXT_TMP2
|
||||||
|
|
||||||
|
# convert
|
||||||
|
|
||||||
|
TextToSpeech $WX_TXT forecast.ul
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
# EOF
|
||||||
@ -0,0 +1,476 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# getWxRpt_ug - allstar wxscripts
|
||||||
|
#
|
||||||
|
# by w0anm
|
||||||
|
#
|
||||||
|
# This script pulls from local underground weather stations and converts
|
||||||
|
# to audio using online google text to speech converter.
|
||||||
|
#
|
||||||
|
# ---------------
|
||||||
|
# Copyright (C) 2015, 2016 Christopher Kovacs, W0ANM
|
||||||
|
#
|
||||||
|
# This program 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.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||||
|
# ---------------
|
||||||
|
|
||||||
|
######################
|
||||||
|
# get wx report
|
||||||
|
|
||||||
|
# renice the proceses to a lower priority
|
||||||
|
renice -n 19 -p $$
|
||||||
|
|
||||||
|
WEATHER=/usr/local/etc/wx
|
||||||
|
|
||||||
|
# get date info for last update information
|
||||||
|
DATE=`date +%Y.%m.%d.\%H\%M`
|
||||||
|
|
||||||
|
# sound files
|
||||||
|
SOUND_DIR=/usr/local/share/sound/wx
|
||||||
|
|
||||||
|
# Load config file
|
||||||
|
if [ -f ${WEATHER}/wx_scripts.conf ] ; then
|
||||||
|
source ${WEATHER}/wx_scripts.conf
|
||||||
|
else
|
||||||
|
echo "Missing ${WEATHER}/wx_scripts.conf file, aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# System
|
||||||
|
# PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/vendor_perl:/usr/bin/core_perl
|
||||||
|
|
||||||
|
# wget source location
|
||||||
|
WGET="/usr/bin/wget"
|
||||||
|
|
||||||
|
# if Weather Underground _STN not an argument, then error.
|
||||||
|
if [ "$1" = "" ] ; then
|
||||||
|
echo "Missing Argument, need wx underground station id.."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
WX_UNDERGRND_STN=${1^^}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Various files and directories
|
||||||
|
# sound creation directory
|
||||||
|
UG_WX_SOUND_DIR=/tmp/wx/wxreport_ug/${WX_UNDERGRND_STN}
|
||||||
|
|
||||||
|
# WX script directory
|
||||||
|
UG_WX_DIR=/usr/local/etc/wx
|
||||||
|
|
||||||
|
# tmp directory
|
||||||
|
UG_WX_WRKING_DIR=/tmp/wx/wxreport_ug/${WX_UNDERGRND_STN}
|
||||||
|
|
||||||
|
# make sure custom audio wx directory is created
|
||||||
|
if [ ! -d $UG_WX_SOUND_DIR ] ; then
|
||||||
|
mkdir -p $UG_WX_SOUND_DIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make sure custom working wx directory is created
|
||||||
|
if [ ! -d $UG_WX_WRKING_DIR ] ; then
|
||||||
|
mkdir -p $UG_WX_WRKING_DIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
# parsing_list.txt file lists weather items to capture
|
||||||
|
P_LIST=$UG_WX_DIR/parsing_list.txt
|
||||||
|
|
||||||
|
# weather underground web information. ID value is important
|
||||||
|
# ID set from wx_scripts.conf
|
||||||
|
URL="http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=${WX_UNDERGRND_STN}"
|
||||||
|
|
||||||
|
if [ -f "${UG_WX_SOUND_DIR}/cur_WxRpt_ug.gsm" ] ; then
|
||||||
|
rm ${UG_WX_SOUND_DIR}/cur_WxRpt_ug.gsm
|
||||||
|
fi
|
||||||
|
|
||||||
|
number_conversion () {
|
||||||
|
# debug=yes
|
||||||
|
cnumb=$1
|
||||||
|
gsmfile_out=/tmp/numbers.gsm
|
||||||
|
|
||||||
|
if [ -f "$gsmfile_out" ] ; then
|
||||||
|
rm -f $gsmfile_out
|
||||||
|
fi
|
||||||
|
|
||||||
|
# strip off minus
|
||||||
|
if [ "${cnumb:0:1}" = "-" ] ; then
|
||||||
|
minus="true"
|
||||||
|
cnumb=${cnumb/#-/}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# find dec position and create an array called "dig"
|
||||||
|
size=${#cnumb}
|
||||||
|
for digit in `seq 0 $size` ; do
|
||||||
|
# check if decimal and get position
|
||||||
|
if [ "${cnumb:$digit:1}" = "." ] ; then
|
||||||
|
dec_position=$digit
|
||||||
|
fi
|
||||||
|
dig[$digit]=${cnumb:$digit:1}
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -z "$dec_position" ] ; then
|
||||||
|
# strip it.
|
||||||
|
decimal=yes
|
||||||
|
decimal_val=${cnumb#*.}
|
||||||
|
cnumb=${cnumb%.*}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if minus, start with "minus" in gsm
|
||||||
|
if [ "$minus" = "true" ] ; then
|
||||||
|
cat $SOUND_DIR/minus.gsm >> $gsmfile_out
|
||||||
|
fi
|
||||||
|
|
||||||
|
# convert hundreds
|
||||||
|
if [ "$(($cnumb))" -gt "100" ] ; then
|
||||||
|
tmp_cnumb=$(echo "${cnumb}-100" | bc -l) ;
|
||||||
|
cat $SOUND_DIR/1.gsm hundred.gsm >> $gsmfile_out
|
||||||
|
else
|
||||||
|
tmp_cnumb=$cnumb
|
||||||
|
fi
|
||||||
|
|
||||||
|
# convert tens and ones
|
||||||
|
if [ "$(($tmp_cnumb))" -lt "20" ] ; then
|
||||||
|
cat $SOUND_DIR/${tmp_cnumb}.gsm >> $gsmfile_out
|
||||||
|
|
||||||
|
else
|
||||||
|
tmp_cnumb10=${tmp_cnumb:0:1}
|
||||||
|
cnumb1=${tmp_cnumb:1:1}
|
||||||
|
cnumb10=$(echo "${tmp_cnumb10}*10" | bc -l)
|
||||||
|
cat $SOUND_DIR/${cnumb10}.gsm >> $gsmfile_out
|
||||||
|
# if number is 0 then no output (like 30)
|
||||||
|
if [ ${cnumb1} != "0" ] ; then
|
||||||
|
cat $SOUND_DIR/${cnumb1}.gsm >> $gsmfile_out
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create decimal gsm output
|
||||||
|
if [ ! -z "$dec_position" ] ; then
|
||||||
|
# get dec values
|
||||||
|
end=$(expr $size - 1)
|
||||||
|
for digit in `seq $dec_position $end` ; do
|
||||||
|
if [ "${dig[$digit]}" = "." ] ; then
|
||||||
|
cat $SOUND_DIR/point.gsm >> $gsmfile_out
|
||||||
|
else
|
||||||
|
cat $SOUND_DIR/${dig[$digit]}.gsm >> $gsmfile_out
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$debug" = "yes" ] ; then
|
||||||
|
echo "minus=$minus"
|
||||||
|
echo "Tens - cnumb10 --> [${cnumb10}]"
|
||||||
|
echo "Ones - cnumb1 --> [${cnumb1}]"
|
||||||
|
|
||||||
|
# display the array
|
||||||
|
if [ ! -z "$dec_position" ] ; then
|
||||||
|
end=$(expr $size - 1)
|
||||||
|
for digit in `seq $dec_position $end` ; do
|
||||||
|
echo "-------------------------------"
|
||||||
|
echo "dig array --> ${dig[$digit]}"
|
||||||
|
if [ "${dig[$digit]}" = "." ] ; then
|
||||||
|
echo "."
|
||||||
|
fi
|
||||||
|
echo "decimal($digit) -> ${dig[$digit]}"
|
||||||
|
echo "-------------------------------"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------- Main program -----------------------------
|
||||||
|
|
||||||
|
# clean up first
|
||||||
|
rm -f $UG_WX_PTREND/var.src $UG_WX_WRKING_DIR/var.src $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt $UG_WX_SOUND_DIR/conv_current_wx.txt
|
||||||
|
|
||||||
|
# Get weather information
|
||||||
|
|
||||||
|
# copy file for saytime
|
||||||
|
if [ -f ${UG_WX_SOUND_DIR}/${WX_UNDERGRND_STN}.xml ] ; then
|
||||||
|
cp ${UG_WX_SOUND_DIR}/${WX_UNDERGRND_STN}.xml ${UG_WX_SOUND_DIR}/${WX_UNDERGRND_STN}_saytemp.xml
|
||||||
|
fi
|
||||||
|
|
||||||
|
$WGET -q $URL -O - > ${UG_WX_SOUND_DIR}/${WX_UNDERGRND_STN}.xml
|
||||||
|
|
||||||
|
# parse the list and extract the variables
|
||||||
|
for ITEM in `cat "$P_LIST" | awk '{ print $1 }'`
|
||||||
|
do
|
||||||
|
VARIABLE=`grep -m 1 $ITEM ${UG_WX_SOUND_DIR}/${WX_UNDERGRND_STN}.xml | awk 'BEGIN { FS = "<" } { print $2 } ' | sed 's/>/ /g' | awk '{ print $1}'`
|
||||||
|
|
||||||
|
VALUE=`grep -m 1 $ITEM ${UG_WX_SOUND_DIR}/${WX_UNDERGRND_STN}.xml | awk ' BEGIN { FS = "/" } { print $1 }'| awk 'BEGIN { FS = ">" } { print $2 } ' | awk ' BEGIN { FS = "<" } { print $1 }'`
|
||||||
|
|
||||||
|
echo "${VARIABLE}=\"${VALUE}\"" >> $UG_WX_WRKING_DIR/var.src
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
# initialize the variables (import them)
|
||||||
|
source $UG_WX_WRKING_DIR/var.src
|
||||||
|
|
||||||
|
# Save current pressure and get current pressure trend for pressure info
|
||||||
|
cur_pressure_mb=$pressure_mb
|
||||||
|
cur_pressure_in=$pressure_in
|
||||||
|
|
||||||
|
if [ -f $UG_WX_WRKING_DIR/old_pressure.var ] ; then
|
||||||
|
# get old "saved pressure_in/pressure_mb" value, for pressure trends
|
||||||
|
# this is created by crontab every 6 hours.
|
||||||
|
source $UG_WX_WRKING_DIR/old_pressure.var
|
||||||
|
|
||||||
|
# convert to integer (may change to *100)
|
||||||
|
cur_pressure=$(echo "${cur_pressure_mb}*100" | bc)
|
||||||
|
pressure=$(echo "${pressure_mb}*100" | bc)
|
||||||
|
|
||||||
|
# convert to integer
|
||||||
|
cur_pressure=${cur_pressure/\.*}
|
||||||
|
pressure=${pressure/\.*}
|
||||||
|
|
||||||
|
# see if pressure is rising or falling...
|
||||||
|
if [ $cur_pressure -gt $pressure ]; then
|
||||||
|
pressure_trend="rising"
|
||||||
|
pressure_trend_gsm="rising_at.gsm"
|
||||||
|
fi
|
||||||
|
if [ $cur_pressure -lt $pressure ]; then
|
||||||
|
pressure_trend="falling"
|
||||||
|
pressure_trend_gsm="falling_at.gsm"
|
||||||
|
fi
|
||||||
|
if [ $cur_pressure -eq $pressure ]; then
|
||||||
|
pressure_trend="steady"
|
||||||
|
pressure_trend_gsm="steady_at.gsm"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Build the wx report...
|
||||||
|
# Intro info and time recorded
|
||||||
|
echo "Weather report for $neighborhood , $city . " > $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
cat $SOUND_DIR/currentwxrpt.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
|
||||||
|
|
||||||
|
## # Drop time zone information (using awk)
|
||||||
|
## echo "$observation_time" | awk '{ print $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7}' >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
|
||||||
|
## # Current Conditions (tnx to w0OTM)
|
||||||
|
## if [ ! -z "$weather" ] ; then
|
||||||
|
## echo "The current sky conditions are $weather." >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
## fi
|
||||||
|
|
||||||
|
# Wind Info
|
||||||
|
if [ "$wind_string" = "Calm" ] ; then
|
||||||
|
echo "the wind was calm." >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
cat $SOUND_DIR/wind_was_calm.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
##echo "wind_string=$wind_string, wind_mph=$wind_mph, wind_gust_mph=$wind_gust_mph"
|
||||||
|
else
|
||||||
|
case $wind_dir in
|
||||||
|
|
||||||
|
NNE) wind_dir="north north east"
|
||||||
|
wind_dir_gsm=NNE.gsm
|
||||||
|
;;
|
||||||
|
NE) wind_dir="north east"
|
||||||
|
wind_dir_gsm=NE.gsm
|
||||||
|
;;
|
||||||
|
|
||||||
|
ENE) wind_dir="east north east"
|
||||||
|
wind_dir_gsm=ENE.gsm
|
||||||
|
;;
|
||||||
|
|
||||||
|
ESE) wind_dir="east south east"
|
||||||
|
wind_dir_gsm=ESE.gsm
|
||||||
|
;;
|
||||||
|
SE) wind_dir="south east"
|
||||||
|
wind_dir_gsm=SE.gsm
|
||||||
|
;;
|
||||||
|
SSE) wind_dir="south south east"
|
||||||
|
wind_dir_gsm=SSE.gsm
|
||||||
|
;;
|
||||||
|
|
||||||
|
SSW) wind_dir="south south west"
|
||||||
|
wind_dir_gsm=SSW.gsm
|
||||||
|
;;
|
||||||
|
SW) wind_dir="south west"
|
||||||
|
wind_dir_gsm=SW.gsm
|
||||||
|
;;
|
||||||
|
WSW) wind_dir="west south west"
|
||||||
|
wind_dir_gsm=WSW.gsm
|
||||||
|
;;
|
||||||
|
|
||||||
|
WNW) wind_dir="west north west"
|
||||||
|
wind_dir_gsm=WNW.gsm
|
||||||
|
;;
|
||||||
|
NW) wind_dir="north west"
|
||||||
|
wind_dir_gsm=NW.gsm
|
||||||
|
;;
|
||||||
|
NNW) wind_dir="north north west"
|
||||||
|
wind_dir_gsm=NNW.gsm
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#convert from MPH to KPH since underground only uses mph in xml
|
||||||
|
|
||||||
|
wind_kph=$(echo "$wind_mph * 1.6" | bc)
|
||||||
|
wind_gust_kph=$(echo "$wind_gust_mph * 1.6" | bc)
|
||||||
|
|
||||||
|
# Wind speed
|
||||||
|
if [ "$UNITS" = "METRIC" ] ; then
|
||||||
|
# Wind speed in KPH
|
||||||
|
echo "the wind was blowing at a speed of ${wind_kph} kilometers per hour" >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
echo "from ${wind_dir}" >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
# drop the decimal in wind_gusts_kph when testing
|
||||||
|
if [ ${wind_gust_kph%%.*} -ge 0 ] ; then
|
||||||
|
echo "with wind gusts up to ${wind_gust_kph} kilomenters per hour. " >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Wind speed in MPH
|
||||||
|
echo "the wind was blowing at a speed of ${wind_mph} miles per hour from ${wind_dir}" >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
#gsm conv
|
||||||
|
echo 1
|
||||||
|
number_conversion $wind_mph
|
||||||
|
cat $SOUND_DIR/windwasblowing.gsm /tmp/numbers.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
cat $SOUND_DIR/mph_from.gsm $SOUND_DIR/${wind_dir_gsm} >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
# drop the decimal in wind_gusts_mph when testing
|
||||||
|
if [ ${wind_gust_mph%%.*} -ge 0 ] ; then
|
||||||
|
echo "with wind gusts up to ${wind_gust_mph} miles per hour. " >> $UG_WX_SOUND_DIR_DIR/cur_WxRpt_ug.txt
|
||||||
|
#gsm conv
|
||||||
|
echo 2
|
||||||
|
number_conversion $wind_gust_mph
|
||||||
|
cat $SOUND_DIR/with_wind_gusts_up.gsm /tmp/numbers.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
cat $SOUND_DIR/mph.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Temp and Dewpoint Info
|
||||||
|
if [ "$UNITS" = "METRIC" ] ; then
|
||||||
|
# Temp and Dewpoint Info in Celsius
|
||||||
|
echo "The temperature was ${temp_c} degrees Celsius with a dewpoint of ${dewpoint_c} degrees." >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
|
||||||
|
# Windchill
|
||||||
|
if [ ${windchill_c} ] ; then
|
||||||
|
echo "The wind chill was at ${windchill_c} degrees Celsius." >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Temp and Dewpoint Info Farenheit
|
||||||
|
echo "The temperature was ${temp_f} degrees with a dewpoint of ${dewpoint_f} degrees." >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
#gsm conv
|
||||||
|
echo 3
|
||||||
|
number_conversion ${temp_f}
|
||||||
|
cat $SOUND_DIR/temperature_was.gsm /tmp/numbers.gsm $SOUND_DIR/degrees.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
echo 3a
|
||||||
|
number_conversion ${dewpoint_f}
|
||||||
|
cat $SOUND_DIR/with_dew_point_of.gsm /tmp/numbers.gsm $SOUND_DIR/degrees.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
|
||||||
|
# Windchill
|
||||||
|
if [ "${windchill_f}" ] ; then
|
||||||
|
echo "The wind chill was at ${windchill_f} degrees." >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
#gsm conv
|
||||||
|
echo 4
|
||||||
|
number_conversion ${windchill_f}
|
||||||
|
cat $SOUND_DIR/windchillat.gsm /tmp/numbers.gsm $SOUND_DIR/degrees.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Presure Info
|
||||||
|
case "$PRES_UNITS" in
|
||||||
|
|
||||||
|
HPA) #convert millibar to HPA
|
||||||
|
echo "The pressure was ${pressure_trend} at ${cur_pressure_mb} hectopascal. " >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
;;
|
||||||
|
|
||||||
|
MB) # Pressure in millibars
|
||||||
|
pressure_mb_Hg=$(echo "$cur_pressure_mb * .75" | bc)
|
||||||
|
echo "The pressure was ${pressure_trend} at ${pressure_mb_Hg} millibars of mercury. " >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
;;
|
||||||
|
|
||||||
|
IN) # Pressure in inches
|
||||||
|
echo "The pressure was ${pressure_trend} at ${cur_pressure_in} inches of mercury. " >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
#gsm conv
|
||||||
|
echo 5
|
||||||
|
|
||||||
|
number_conversion $cur_pressure_in
|
||||||
|
cat $SOUND_DIR/pressure_was.gsm $SOUND_DIR/${pressure_trend_gsm} /tmp/numbers.gsm $SOUND_DIR/in_of_mercury.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Humidity info
|
||||||
|
# remove tailing % if present, some stations report this.
|
||||||
|
echo "The relative humidity was ${relative_humidity%\%} percent." >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
number_conversion ${relative_humidity%\%}
|
||||||
|
cat $SOUND_DIR/relative_humidity.gsm /tmp/numbers.gsm $SOUND_DIR/percent.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
|
||||||
|
# Precipatation Data
|
||||||
|
case "$RAIN_UNITS" in
|
||||||
|
|
||||||
|
CM) # Precipitation Data in cm
|
||||||
|
if [ "${precip_today_metric%%.*}" -ge 0 ] ; then
|
||||||
|
if [ "$precip_today_metric" == "0.0 cm" -o "$precip_today_metric" == " " -o "$precip_today_metric" == "" ] ; then
|
||||||
|
# echo "No precipitation was recorded, " >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
PREC=NR
|
||||||
|
else
|
||||||
|
echo "Total precipitation today was ${precip_today_metric% cm} centimeters , " >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
echo "precipitation in the last hour was ${precip_1hr_metric} centimeters." >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
MM) # Precipitation data in mm
|
||||||
|
if [ "${precip_today_metric%%.*}" -ge 0 ] ; then
|
||||||
|
if [ "$precip_today_metric" == "0.0 cm" -o "$precip_today_metric" == " " -o "$precip_today_metric" == "" ] ; then
|
||||||
|
# echo "No precipitation was recorded, " >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
PREC=NR
|
||||||
|
else
|
||||||
|
# convert to MM
|
||||||
|
precip_today_mm=$(echo "${precip_today_metric% cm} * 10" | bc)
|
||||||
|
precip_1hr_mm=$(echo "$precip_1hr_metric * 10" | bc)
|
||||||
|
echo "Total precipitation today was ${precip_today_mm} millimeters " >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
echo "precipitation in the last hour was ${precip_1hr_mm} millimeters." >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
IN) # Precipatation Data in inches
|
||||||
|
if [ "${precip_today_in%%.*}" -ge 0 ] ; then
|
||||||
|
if [ "$precip_today_in" == "0.00" ] || [ "$precip_today_in" == " " ] || [ "$precip_today_in" == "" ] ; then
|
||||||
|
# echo "No precipitation was recorded, " >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
PREC=NR
|
||||||
|
else
|
||||||
|
echo "Total precipitation today was ${precip_today_in} inches" >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
echo "precipitation in the last hour was ${precip_1hr_in} inches." >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
# gsm
|
||||||
|
number_conversion ${precip_today_in}
|
||||||
|
cat $SOUND_DIR/total_prec_today.gsm /tmp/numbers.gsm $SOUND_DIR/inches.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
number_conversion ${precip_1hr_in}
|
||||||
|
cat $SOUND_DIR/prec_last_hr.gsm /tmp/numbers.gsm $SOUND_DIR/inches.gsm >> $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# store current pressure
|
||||||
|
|
||||||
|
echo "# Last Updated: $DATE" > $UG_WX_WRKING_DIR/saved_pressure.var
|
||||||
|
echo "pressure_mb=$cur_pressure_mb" >> $UG_WX_WRKING_DIR/saved_pressure.var
|
||||||
|
echo "pressure_in=$cur_pressure_in" >> $UG_WX_WRKING_DIR/saved_pressure.var
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# create the audio file
|
||||||
|
|
||||||
|
# convert text to audio
|
||||||
|
# converted file will be the same file prefix but ext will be .ul
|
||||||
|
# CONV_FILE=$UG_WX_SOUND_DIR/cur_WxRpt_ug.ul
|
||||||
|
|
||||||
|
# $TTS_PROGRAM $UG_WX_SOUND_DIR/cur_WxRpt_ug.txt
|
||||||
|
|
||||||
|
# convert gsm to ul
|
||||||
|
sox -V2 $UG_WX_SOUND_DIR/cur_WxRpt_ug.gsm -r 8000 -c 1 -t ul $UG_WX_SOUND_DIR/cur_WxRpt_ug.ul
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
neighborhood
|
||||||
|
city
|
||||||
|
state
|
||||||
|
elevation
|
||||||
|
observation_time
|
||||||
|
temperature_string
|
||||||
|
temp_c
|
||||||
|
temp_f
|
||||||
|
relative_humidity
|
||||||
|
wind_string
|
||||||
|
wind_dir
|
||||||
|
wind_degrees
|
||||||
|
wind_mph
|
||||||
|
wind_gust_mph
|
||||||
|
pressure_mb
|
||||||
|
pressure_in
|
||||||
|
dewpoint_f
|
||||||
|
dewpoint_c
|
||||||
|
heat_index_c
|
||||||
|
heat_index_f
|
||||||
|
windchill_c
|
||||||
|
windchill_f
|
||||||
|
precip_1hr_in
|
||||||
|
precip_1hr_metric
|
||||||
|
precip_today_in
|
||||||
|
precip_today_metric
|
||||||
|
<weather>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,72 @@
|
|||||||
|
0.gsm "zero"
|
||||||
|
100.gsm "hundred"
|
||||||
|
10.gsm "ten"
|
||||||
|
11.gsm "eleven"
|
||||||
|
12.gsm "twelve"
|
||||||
|
13.gsm "thirteen"
|
||||||
|
14.gsm "fourteen"
|
||||||
|
15.gsm "fifteen"
|
||||||
|
16.gsm "sixteen"
|
||||||
|
17.gsm "seventeen"
|
||||||
|
18.gsm "eighteen"
|
||||||
|
19.gsm "nineteen"
|
||||||
|
1.gsm "one"
|
||||||
|
20.gsm "twenty"
|
||||||
|
2.gsm "two"
|
||||||
|
30.gsm "thirty"
|
||||||
|
3.gsm "three"
|
||||||
|
40.gsm "forty"
|
||||||
|
4.gsm "four"
|
||||||
|
50.gsm "fifty"
|
||||||
|
5.gsm "five"
|
||||||
|
60.gsm "sixty"
|
||||||
|
6.gsm "six"
|
||||||
|
70.gsm "seventy"
|
||||||
|
7.gsm "seven"
|
||||||
|
80.gsm "eighty"
|
||||||
|
8.gsm "eight"
|
||||||
|
90.gsm "ninety"
|
||||||
|
9.gsm "nine"
|
||||||
|
currentwxrpt.gsm "Current underground weather report"
|
||||||
|
degrees.gsm "degrees"
|
||||||
|
degrees_with_dew_point_of.gsma "Degrees with a dew point of"
|
||||||
|
deg_with_dew_point_of.gsm "Degrees with a dew point of"
|
||||||
|
ENE.gsm "east north east"
|
||||||
|
ESE.gsm "east south east"
|
||||||
|
falling_at.gsm "falling at"
|
||||||
|
hundred.gsm "hundred"
|
||||||
|
inches.gsm "inches"
|
||||||
|
in_of_mercury.gsm "inches of mercury"
|
||||||
|
minus.gsm "minus"
|
||||||
|
mph_from.gsm "miles per hour from"
|
||||||
|
mph.gsm "miles per hour"
|
||||||
|
NE.gsm "north east"
|
||||||
|
NNE.gsm "north north east"
|
||||||
|
NNW.gsm "north north west"
|
||||||
|
NW.gsm "north west"
|
||||||
|
percent.gsm "percent"
|
||||||
|
point.gsm "point"
|
||||||
|
prec_last_hr.gsm "precipitation in the last hour was"
|
||||||
|
pressure_was.gsm "the pressure was"
|
||||||
|
relative_humidity.gsm "the relative humidity was"
|
||||||
|
rising_at.gsm "rising at"
|
||||||
|
SE.gsm "south east"
|
||||||
|
silence1.gsm <silence for 1 sec>
|
||||||
|
silence2.gsm <silence for 2 sec>
|
||||||
|
sounds.txt (this file)
|
||||||
|
SSE.gsm "south south east"
|
||||||
|
SSW.gsm "south south west"
|
||||||
|
steady_at.gsm "steady at"
|
||||||
|
SW.gsm "South West"
|
||||||
|
temperature_is.gsm "the temperature is"
|
||||||
|
temperature_was.gsm "the temperature was"
|
||||||
|
temp_was.gsm "the temperature was"
|
||||||
|
thousand.gsm "thousand"
|
||||||
|
total_prec_today.gsm "Total precipitation today was"
|
||||||
|
windchillat.gsm "the wind chill was at"
|
||||||
|
windwasblowing.gsm "the wind was blowing at a speed of"
|
||||||
|
wind_was_calm.gsm "the wins was calm"
|
||||||
|
with_dew_point_of.gsm "with the dew point of"
|
||||||
|
with_wind_gusts_up.gsm "with wind gusts up to"
|
||||||
|
WNW.gsm "west north west"
|
||||||
|
WSW.gsm "west south west"
|
||||||
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue