# playnews v0.11 - WA3DSP 06/2017
#
# Script to download ARRL News or ARN and divide into 2.5 minute segments with breaks.
# Includes voice messages before play, at breaks, and after play.
# This script can be configured for global playback!
# DO NOT run this on a multi-node connected circuit without consideration.
# Change MODE to localplay for strictly local node play.
#
# This code is written to work on the hamvoip.org BBB/RPi2 Allstar releases
# All required packages are pre-installed on those systems.
#
# For proper operation holdofftelem in rpt.conf should either not be defined or
# defined as =0  This stops keyups from delaying the news during its playing
#
# You can run this script from a cron job or from the command line at least
# 15 minutes before the defined run time (TIME value) but it can be scheduled
# anytime within 24 hours prior to the run time.
#
# cron example -
#
# Prime news for play every Tuesday at 8:30PM - actual playtime set by defined
# comand line TIME parameter. If Playtime is 9PM (2100)
# This would send pre warnings at 8:50 and 8:55 PM.
#
# Start a cron job every tuesday at 8:30 PM to run at 9 PM the same day
# and play ARRL news on node 40000, globally
#
# 30 20 * * 2 /etc/asterisk/playnews ARRL 21:00 40000 G &> /dev/null 2>&1
#
# Play ARN news on Thursday at 7PM on node 40000, Start playnews at 6 PM, Play locally
#
# 00 18 * * 4 /etc/asterisk/playnews ARN 19:00 40000 L &> /dev/null 2>&1

# The audio files ARRLstart5, ARRLstart10, ARRLstart, ARRLcontinue, ARRLstop
# and ARNstart, ARNstart10, ARNstart, ARNcontinue, ARNstop
# are supplied but could be customized for your needs. The audio
# files must be in the directory defined by VOICEDIR
#
# ARRLstart10 or ARNstart10   - voice message at ten minutes before start
# ARRLstart5 or ARNstart5     - voice message at five minutes before start
# ARRLstart or ARNstart       - voice message at start of play
# ARRLcontinue or ARNcontinue - voice message at breaks
# ARRLstop or ARNstop         - voice message at end of play
#
# V0.11 - Changed to separate playnews.ini file to specify
# URL's
#
# V0.10 - Again changed URL's
#
#
# V0.9 update
#
#   - Changed ARRL URL to blubrry.com
#
# v0.8 update
#
#   - added check for downloaded MP3 filesize. Playnews will not
#     play if size is less than 100K. On holidays ARRL only has
#     small html file that gets downloaded.
#
# v0.7 updates
#
#   - Added TMPDIR user settable variable
#
# v0.6 updates
#   - Now requires that all parameters be entered
#     except mode which defualts to global
#   - More parameter checking added
#   - Time can be set to "NOW" for immediate start
#
#   Command line format - playnews ARRL|ARN 21:00|NOW 40000 L|G
#   Options are ARRL or ARN news, specific 24 hour time or "NOW"
#   and local "L" or Global "G" play modes.
#
#   DO NOT use the the "NOW" time parameter in a cron !!!


