updated README
[bashpodder] / bashpodder
1 #!/bin/bash
2 # By Linc 10/1/2004
3 # Find the latest script at http://lincgeek.org/bashpodder
4 # Revision 1.21 12/04/2008 - Many Contributers!
5 # If you use this and have made improvements or have comments
6 # drop me an email at linc dot fessenden at gmail dot com
7 # and post your changes to the forum at http://lincgeek.org/lincware
8 # I'd appreciate it!
9 # Changes by Rev. Fr. Robert Bower April 29, 2021
10 # Added a option to skip download but add to logfile
11 # to be used when you are using bash podder with a podcast where you don't want to download all past episodes
12 # use the nd after bashpodder as an argument and the podcasts will be added to the logfile but not actually downloaded.
13 # remove from the logfile any episodes you want to download and rerun bashpodder without the nd argument.
14
15 # Make script crontab friendly:
16 cd $(dirname $0)
17
18 # datadir is the directory you want podcasts saved to:
19 datadir=$(date +%Y-%m-%d)
20
21 # create datadir if necessary:
22 mkdir -p $datadir
23
24 # Delete any temp file:
25 rm -f temp.log
26
27 # Read the bp.conf file and wget any url not already in the podcast.log file:
28 while read podcast
29         do
30         file=$(xsltproc parse_enclosure.xsl $podcast 2> /dev/null || wget -q $podcast -O - | tr '\r' '\n' | tr \' \" | sed -n 's/.*url="\([^"]*\)".*/\1/p')
31         for url in $file
32                 do
33                 echo $url >> temp.log
34                 if [[ $1 != "nd" ]]
35                 then
36                 if ! grep "$url" podcast.log > /dev/null
37                         then
38                         wget -t 10 -U BashPodder -c -q -O $datadir/$(echo "$url" | awk -F'/' {'print $NF'} | awk -F'=' {'print $NF'} | awk -F'?' {'print $1'}) "$url"
39                 fi
40                 fi
41                 done
42         done < bp.conf
43 # Move dynamically created log file to permanent log file:
44 cat podcast.log >> temp.log
45 sort temp.log | uniq > podcast.log
46 rm temp.log
47 # Create an m3u playlist:
48 ls $datadir | grep -v m3u > $datadir/podcast.m3u
49