#!/bin/bash # By Linc 10/1/2004 # Find the latest script at http://linc.homeunix.org:8080/scripts/bashpodder # Revision 1.1 09/13/2006 - Many Contributers! # If you use this and have made improvements or have comments # drop me an email at linc dot fessenden at gmail dot com # I'd appreciate it! # Additions by John Clayton 09/12/2009 # Stripped out the features I would never use (like playlists). # The script only downloads the first show in each feed, and # skipping it if already downloaded. I added some output to # look at whatever is downloading. # Contact me at notyalcnhoj at gmail dot com if you have any # feedback. if [ ! -f ./podcast.log ] then touch podcast.log fi # Make script crontab friendly: cd $(dirname $0) # Delete any temp file: rm -f temp.log # Read the bp.conf file and wget any url not already in the podcast.log file: while read podcast do seenfirst=0 file=$(xsltproc parse_enclosure.xsl $podcast 2> /dev/null || wget -q $podcast -O - | tr '\r' '\n' | tr \' \" | sed -n 's/.*url="\([^"]*\)".*/\1/p') for url in $file do if [ "$seenfirst" -ne 1 ] then echo $url >> temp.log if ! grep "$url" podcast.log > /dev/null then echo "Downloading:" echo $url wget -t 10 -U BashPodder -c -q -O $(echo "$url" | awk -F'/' {'print $NF'} | awk -F'=' {'print $NF'} | awk -F'?' {'print $1'}) "$url" let "seenfirst += 1" else let "seenfirst += 1" fi fi done done < bp.conf # Move dynamically created log file to permanent log file: cat podcast.log >> temp.log sort temp.log | uniq > podcast.log rm temp.log