Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # hprtag.sh
- #
- # tag .mp3 files and generate .txt file from
- # correctly-formatted mp3 filename for uploading to
- # http://www.hackerpublicradio.org/
- #
- # brother mouse
- # grab the filename passed as arg
- MP3=$1
- if [[ "$1" = "" ]]
- then
- # hurr, durr.
- echo "USAGE: hprtag.sh [correctly-named-file.mp3]"
- exit 1
- fi
- # we have a file. Keep going.
- # strip off the .mp3 extension
- STUB=`basename $1 .mp3`
- TXT=${STUB}.txt
- echo start adding tags and building textfile
- # isolate left side of underscore with backreference
- # then replace dashes with spaces globally
- ARTIST=`echo $STUB | sed 's/\(.*\)_.*/\1/' | sed 's/-/ /g'`
- echo "$ARTIST" > $TXT
- id3v2 --artist "$ARTIST" $MP3
- # isolate right side of underscore with backreference
- # then replace dashes with spaces globally
- TRACK=`echo $STUB | sed 's/.*_\(.*\)/\1/' | sed 's/-/ /g'`
- echo "$TRACK" >> $TXT
- id3v2 --song "$TRACK" $MP3
- # blank third line
- echo >> $TXT
- id3v2 --album "Hacker Public Radio" $MP3
- # there is no Podcast genre in the tag specs. Doh!
- # Speech will do for now until I get more info.
- id3v2 --genre 101 $MP3
- id3v2 --comment "http://hackerpublicradio.org" $MP3
- # FIXME - pull this from the date utility
- id3v2 --year 2011 $MP3
- # show all tags in the file as a sanity check
- id3v2 --list $MP3
- echo
- echo ==txt file begin
- cat $TXT
- echo ==txt file end
- echo
- file $MP3
- echo remember to test: cvlc $MP3
- # thank you, drive through
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement