[colug-432] podcasts script in bash

Vince Herried vince at planetvince.info
Thu Aug 11 10:44:57 EDT 2011


I listen to a lot of podcasts and it seemms
google reader is pretty much hit or miss on linux.
here is my script for downloading the podcasts 

Suggestions for improvements wellcomed
If nothing else you get to see what kind of podcasts I like :)


Usage: podcast url



$ cat bin/podcast 
#!/bin/bash
# 2011-4-19 download and tag podcasts
# 2011-5-8      Convert to eyeD3
# for some reason C-SPAN doesn't tag their podcasts
#set -x

LINK="$1"
if [ X$LINK == "X" ] ; then # need input parm
        echo -n "Enter link address "
        read LINK
fi
BASE=$(basename "$LINK")
if [ ${BASE:0:3} == "npr" ] ; then 
        ALBUM="NPR"
elif [ ${BASE:0:7}  == "arc_btv" ]; then # after words fm C-SPAN
        ALBUM="C-SPAN"
        ARTIST="After Words"
        echo -n "$ALBUM $ARTIST enter specific episode? "
        read SONG
elif [ ${BASE:0:4} == "news" ] ; then # newsmakers
        ALBUM="C-SPAN"
        ARTIST="Newsmakers"
        echo -n "$ALBUM $ARTIST enter specific episode? "
        read SONG
elif [ ${BASE:0:1} == "e" ] ; then # podcast/week
        ALBUM="C-SPAN"
        ARTIST="Podcast of the Week"
        echo -n "$ALBUM $ARTIST enter specific episode? "
        read SONG
elif [ ${BASE:0:2} == "qa" ] ; then # Q and A
        ALBUM="C-SPAN"
        ARTIST="Q and A"
        echo -n "$ALBUM $ARTIST enter specific episode? "
        read SONG
elif [ ${BASE:0:3} == "com" ] ; then # the communicators
        ALBUM="C-SPAN"
        ARTIST="The Communicators"
        echo -n "$ALBUM $ARTIST enter specific episode? "
        read SONG
elif [ ${BASE:0:15} == "all_about_books" ] ; then # all about books
        ALBUM="NET Radio"
        ARTIST="All About Books"
        echo -n "$ALBUM $ARTIST enter specific episode? "
        read SONG
elif [ ${BASE:0:10} == "WTPpodcast" ] ; then # the world
        ALBUM="PRI"
        ARTIST="The World"
        echo -n "$ALBUM $ARTIST enter specific episode? "
        read SONG
elif [ ${LINK:46:8} == "theworld" ] ; then # the world
        ALBUM="PRI"
        ARTIST="The World"
        if [ ${BASE:0:7} == "science" ] ; then # science
                ARTIST="The World - Science"
        fi
        echo -n "$ALBUM $ARTIST enter specific episode? "
        read SONG
elif [ ${LINK:25:8} == "radiolab" ] ; then # radio labs
#http://feeds.wnyc.org/~r/radiolab/~5/IwboksawWRs/radiolab053111.mp3
        ALBUM="WNYC"
        ARTIST="Radio Labs"
        echo -n "$ALBUM $ARTIST Enter specific Episode? "
        read SONG
#         1         2         3         4         5         6
#123456789012345678901234567890123456789012345678901234567890
#http://www.podtrac.com/pts/redirect.mp3/audio.wnyc.org/freakonomics_market/freakonomics_market071211.mp3
elif [ ${LINK:55:12} == "freakonomics" ] ; then # freakonomics
        ALBUM="WNYC"
        ARTIST="Freakonomics"
        echo -n "$ALBUM $ARTIST Enter specific Episode? "
        read SONG
elif [ ${LINK:59:13} == "sciencefriday" ] ; then # science friday
#http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/sciencefriday/scifri20110610-hr2.mp3
        ALBUM="NPR"
        ARTIST="Science Friday"
        echo -n "$ALBUM $ARTIST Enter specific Episode? "
        read SONG
fi

if [ "X$ALBUM" == X ] ; then  # prompt for album
        echo -n "Enter Album ( eg C-SPAN, or NPR ) "
        read ALBUM
fi
if [ "X$ARTIST" == X ] ; then  # prompt for artist
        echo -n "Enter Artist ( eg Its all politics ) "
        read ARTIST
fi
if [ "X$SONG" == X ] ; then  # prompt for song
        echo -n "Enter song ( eg specific episode ) "
        read SONG
fi
wget -O "$BASE" "$LINK"

#id3tag -A"$ALBUM" -a"$ARTIST" -s"$SONG"  -g12 $BASE > /dev/null
eyeD3   --remove-images \
        --remove-lyrics \
        --to-v2.4       \
        --genre='Other' \
        -A"$ALBUM"      \
        -a"$ARTIST"     \
        -t"$SONG"       \
        "$BASE"         \
        > /dev/null
[vince at lap3 ~]$ 


-- 
The chief enemy of creativity is "good" sense
		-- Picasso


More information about the colug-432 mailing list