bashPodder

BashPodder is an excellent script which will go and fetch your podcasts without any extraneous annoying graphical interface or anything. It only does that and does it well.
I’ve made a few changes to it, like saving the config and temp files in a hidden directories or storing the podcasts somewhere different than where the script is located. Also, a global playlist (.m3u) is generated, with most recent files at the top

Select All Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# By Linc 10/1/2004
# Find the latest script at http://linc.homeunix.org:8080/scripts/bashpodder
# Last revision 07/01/2005 - 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!
 
# modif. by Tony_withmore (directories named after feeds, http://linc.homeunix.org:8080/scripts/bashpodder/user_contributed/tony_whitmore/)
 
# By Chris Ladroue:-
# . files are saved away from script, in $dest
# . config and temp files stored in ~/.bashpodder i.e. $hd
# . generates latest.m3u, with latest added files, most recently downloaded on top.
# . possibility of keeping only the n latest files in the global m3u. See end of script.
 
# Modify according to your preferences.
dest=/home/XXXXX/media/podcasts
hd=/home/XXXXX/.bashpodder
 
# Make script crontab friendly:
cd $(dirname $0)
 
# Delete temp file:
rm -f $hd/temp.log
 
# Delete latest.m3u
# Uncomment if you want only files from the latest update
#rm -f $dest/latest.m3u
#touch $dest/latest.m3u
 
# Read the bp.conf file and wget any url not already in the podcast.log file:
while read podcast datadir
	do
	echo $datadir
 	# Check for and create datadir if necessary:
 	if test ! -d $dest/$datadir
 	        then
 	        mkdir $dest/$datadir
 	fi
	file=$(wget -q $podcast -O - | xsltproc $hd/parse_enclosure.xsl -  2> /dev/null)
	#file=$(wget -q $podcast -O - | xsltproc $hd/parse_enclosure.xsl -  2> /dev/null) || file=$(wget -q $podcast -O - | tr 'r' 'n' | tr ' " | sed -n 's/.*url="([^"]*)".*/1/p' )
	for url in $file
		do
		if ! grep "$url" $hd/podcast.log > /dev/null
			then
			echo $datadir : $url
			wget -q -P $dest/$datadir "$url" && echo $url >> $hd/temp.log
			# Add to global playlist (latest.m3u)
			fn=$(echo $url | rev |cut -d'/' -f1 | rev )
			echo $datadir/$fn | cat - $dest/latest.m3u >> $dest/latest.m3u.tmp
			mv -f $dest/latest.m3u.tmp $dest/latest.m3u
 
			# Move dynamically created log file to permanent log file:
			cat $hd/podcast.log >> $hd/temp.log
			sort $hd/temp.log | uniq > $hd/podcast.log
			rm $hd/temp.log
		fi
		done
	# Create a local m3u playlist:
	ls $dest/$datadir | grep -v m3u > $dest/$datadir/podcast.m3u
	done < $hd/bp.conf
 
# Leave only the 10 latest podcasts in the global m3u
# Uncomment to enable
#more $hd/latest.m3u | sed '11,$d' - > $hd/latest.m3u

Comments are closed.