-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetsn.sh
More file actions
executable file
·36 lines (26 loc) · 1.07 KB
/
getsn.sh
File metadata and controls
executable file
·36 lines (26 loc) · 1.07 KB
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
#!/bin/bash
# Downloaded Security Now! files
SNDIR="$HOME/Music/iTunes/iTunes Music/Music/Steve Gibson/Security Now!"
echo "Finding next episode to download"
# Latest episode not downloaded
SHOWNUM=$(( `ls "$SNDIR" | sort -n | tail -n 1 | egrep -o '^[0-9]+'` + 1 ))
SHOWFILE=`printf sn%04d.mp3 $SHOWNUM`
echo "Checking for episode $SHOWNUM"
if curl -f `printf http://twit.cachefly.net/audio/sn/sn%04d/sn%04d.mp3 $SHOWNUM $SHOWNUM` -o "$HOME/$SHOWFILE"
then
# Directory for files to be automatically added to iTunes
ITUNES="$HOME/Music/iTunes/iTunes Music/Automatically Add to iTunes"
cd $HOME
TITLE=`id3v2 --list $SHOWFILE | grep "TIT2" | grep -o "): .*" | sed 's|): ||'`
ARTIST="Steve Gibson"
ALBUM="Security Now!"
echo "Deleting old tags"
id3v2 -D $SHOWFILE
echo "Setting new tags"
id3v2 -a "$ARTIST" -A "$ALBUM" -t "Security Now! $SHOWNUM: $TITLE" -T $SHOWNUM $SHOWFILE
echo "Preparing to import to iTunes"
mv $SHOWFILE "$ITUNES"
echo "Open iTunes to complete import"
else
echo "Episode does not exist yet"
fi