-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathlnldl
43 lines (33 loc) · 1.29 KB
/
lnldl
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
#!/bin/sh
#----------------------------------------------------------------------------------
# Project Name - miscellaneous/lnldl
# Started On - Fri 6 Oct 00:23:23 BST 2017
# Last Change - Tue 19 Dec 12:17:00 GMT 2017
# Author E-Mail - [email protected]
# Author GitHub - https://github.com/terminalforlife
#----------------------------------------------------------------------------------
# Quickly and easily download Late Night Linux podcasts.
#----------------------------------------------------------------------------------
XERR(){ printf "ERROR: %s\n" "$2" 1>&2; exit 1; }
ERR(){ printf "ERROR: %s\n" "$2" 1>&2; }
DEPCOUNT=0
for DEP in /usr/bin/id /usr/bin/wget; {
[ -x "$DEP" ] || {
ERR "Dependency '$DEP' not met."
DEPCOUNT=$(( DEPCOUNT + 1 ))
}
}
[ $DEPCOUNT -gt 0 ] && exit 1
[ `/usr/bin/id -u` -eq 0 ] && XERR "Root access is not required."
LINK="http://podtrac.com/pts/redirect.mp3/latenightlinux.com/media"
COUNT=1
until [ $COUNT -eq 21 ]; do
[ "$COUNT" -lt 10 ] && PADCOUNT="0${COUNT}"
if ! /usr/bin/wget --continue --quiet --show-progress\
"$LINK/LNL${PADCOUNT}.ogg" -O ./Episode_${PADCOUNT}.ogg
then
ERR "Non-zero exit status for podcast #${PADCOUNT}."
fi
COUNT=$((COUNT+1))
done
# vim: noexpandtab colorcolumn=84 tabstop=8 noswapfile nobackup