#!/bin/bash # By Linc 10/1/2004 # Find the latest script at http://linc.homeunix.org:8080/scripts/bashpodder # Last revision 10/23/2004 - The Lee Colleton/Wari Wahab/Dann Washko version. # 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! # Modified & simplified 11/08/2004 by jagelado at http://www.informediario.com # based on contribs by Clay_England and Rodrigo_Stulzer #VARS # default values. Maybe wanna change path. # path=~ log=podcast.log conf=bp.conf # Quickie change to make the script more cron friendly # Contributed by Wari Wahab workdir=`dirname $0` cd $workdir # datadir is the directory you want the audio files to be put into # I used a date string which will create a new directory every day # Changed to iso date format as suggested by Lee Colleton! # Updated to work on OSX by Dann Washko datadir=$path`date +%Y-%m-%d` echo "downloading podcasts to..." echo $datadir # test for temporary file and delete if it exists if test -f temp.data then rm temp.data fi # test for existance of data directory and create if not there if test ! -d $datadir then mkdir $datadir fi # test for existance of log file and create if not there if test ! -f podcast.log then touch podcast.log fi # Read the conf file for rss feeds you wish to grab audio from # Used the sed line from Rodrigo Stulzer to better take care of # non-standard rss. (JCE) IFS_T=${IFS} IFS=' ' I=0 while read url do for url in $(wget -q ${url} -O - | sed 's/ /dev/null then wget -q -P ${datadir} ${url} echo ${url} >> ${log} fi #save all urls for uptodate log file #if -l flag is thrown if [ "${lt}" == "set" ]; then NEWLOG[${I}]=${url} ((I += 1)) fi done done < ${conf} IFS=${IFS_T} #Write a new log file containing only urls in current rss feeds. #if -l flag is thrown. echo "writing podcasts downloaded to log..." if [ "${lt}" == "set" ]; then /bin/rm ${log} for urllog in "${NEWLOG[@]}"; do echo ${urllog} >> ${log} done fi # That's it! # Oh yeah, you probably want an m3u playlist (at least I do) ls $datadir | grep -v m3u > $datadir/podcast.m3u