######################################## # Get Amateur Radio Newsline (Podcast) # ######################################## # It used to be very simple. The latest editon was always available at: # ftp://ftp.arnewsline.org/quincy/News/news.mp3 # In 2011 the Newsline website was revamped to support RSS. This is great # for users, but less straight forward for automated downloading. # The latest newsline can now be found here: # http://arnewsline.org/storage/audio/news.mp3 /usr/bin/lynx -source http://www.arnewsline.org > ardump || error echo " Download Completed" line=`cat ardump | grep -i mp3 | head -n1` f=1 while true ; do arfile=`echo $line | cut -d"\"" -f$f` if [ -z `echo $arfile | grep -i mp3` ]; then let f+=1 else break fi done echo "Found :- $arfile in index text." arfile=`echo $arfile | cut -d "/" -f4` # arfile=`cat ardump | grep -i mp3 | head -n1 | cut -d"\"" -f6 | cut -d"/" -f4` echo -n "File to download = "$arfile /usr/bin/wget http://www.arnewsline.org/storage/audio/$arfile > /dev/null 2>&1 || error echo " Download Completed" edition=${arfile:4:4} echo "Edition number determined to be - <"$edition">" writelog "Download AR Newsline Edition-$edition ... [ COMPLETED ]" echo "Located "$NEWS"/"$arfile" -" echo " Saving as "$NEWS"/arnl.mp3 for playback." mv $arfile arnl.mp3 rm -f ardump if [ "$archive" = "yes" ]; then echo " Saving copy to archives - [ Checking ]" if [ -f $archiveloc/$arfile ] ; then echo "ERROR.. "$arfile" already archived!" echo " Script aborting..." writelog "News Archive ERROR - "$arfile" - Programme Exists" exit 1 fi cp arnl.mp3 $archiveloc/$arfile # Archive the audio program writelog "News Archive "$arfile" ... [ COMPLETED ]" fi echo " Processing $arfile Completed..." ;; # # To Do: # Break the file into 2.5 min chunks for over the air play back (allow # time out timers to reset. # # http://mp3splt.sourceforge.net # #http://mp3splt.sourceforge.net/mp3splt_page/documentation/man.html # # -t TIME[>MIN_TIME] # Time mode. This option will create an indefinite number of smaller # files with a fixed time length specified by TIME (which has the same # format described above). It is useful to split long files into smaller # (for example with the time length of a CD). Adjust option (-a) can be # used to adjust splitpoints with silence detection. >MIN_TIME can be used # to specify the theoretical minimum track length of the last segment; it # allows avoiding to create very small files as the last segment. Make # sure to quote the argument when using MIN_TIME - "TIME>MIN_TIME". mp3splt -t 2.3 -a -gap=30 -O 0.0 -o segment@n news.mp3 ########################################################################## # Play back script starts here: # # Uses irlp keying binaries: # # ftp://irlp.net/pub/irlpv2.0/Bin_ARM.tgz # # Or direct gpio calls with wiring pi: # # https://github.com/WiringPi/WiringPi # ########################################### key #gpio write 17 1 mpg123 segment01.mp3 unkey #gpio write 17 0 sleep 1 key #gpio write 17 1 mpg123 segment02.mp3 unkey #gpio write 17 0 # etc