#!/bin/bash # 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 number=`expr index "$podcast" @` podcastURL=${podcast:$number} file=$(wget -q $podcastURL -O - | tr '\r' '\n' | tr \' \" | sed -n 's/.*url="\([^"]*\)".*/\1/p') for url in $file do echo $url >> temp.log if ! grep "$url" podcast.log > /dev/null then datadir=${podcast:0:$number-1} if test ! -d $datadir then mkdir $datadir fi wget -q -P $datadir "$url" i="1" while [ $i -ne 0 ] do i=`expr index "$url" \/` url=${url:$i} done printf "../"$datadir"/"$url\\n >> "All_M3U"/$datadir".m3u" printf "../"$datadir"/"$url\\n >> "All_M3U"/$(date +%Y-%m-%d).m3u 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