Advertisement
Guest User

brother mouse

a guest
Feb 4th, 2011
706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. # hprtag.sh
  2. #
  3. # tag .mp3 files and generate .txt file from
  4. # correctly-formatted mp3 filename for uploading to
  5. # http://www.hackerpublicradio.org/
  6. #
  7. # brother mouse
  8.  
  9. # grab the filename passed as arg
  10. MP3=$1
  11. if [[ "$1" = "" ]]
  12. then
  13. # hurr, durr.
  14. echo "USAGE: hprtag.sh [correctly-named-file.mp3]"
  15. exit 1
  16. fi
  17.  
  18. # we have a file. Keep going.
  19. # strip off the .mp3 extension
  20. STUB=`basename $1 .mp3`
  21. TXT=${STUB}.txt
  22.  
  23. echo start adding tags and building textfile
  24. # isolate left side of underscore with backreference
  25. # then replace dashes with spaces globally
  26. ARTIST=`echo $STUB | sed 's/\(.*\)_.*/\1/' | sed 's/-/ /g'`
  27. echo "$ARTIST" > $TXT
  28. id3v2 --artist "$ARTIST" $MP3
  29.  
  30. # isolate right side of underscore with backreference
  31. # then replace dashes with spaces globally
  32. TRACK=`echo $STUB | sed 's/.*_\(.*\)/\1/' | sed 's/-/ /g'`
  33. echo "$TRACK" >> $TXT
  34. id3v2 --song "$TRACK" $MP3
  35.  
  36. # blank third line
  37. echo >> $TXT
  38.  
  39. id3v2 --album "Hacker Public Radio" $MP3
  40. # there is no Podcast genre in the tag specs. Doh!
  41. # Speech will do for now until I get more info.
  42. id3v2 --genre 101 $MP3
  43.  
  44. id3v2 --comment "http://hackerpublicradio.org" $MP3
  45.  
  46. # FIXME - pull this from the date utility
  47. id3v2 --year 2011 $MP3
  48.  
  49. # show all tags in the file as a sanity check
  50. id3v2 --list $MP3
  51.  
  52. echo
  53. echo ==txt file begin
  54. cat $TXT
  55. echo ==txt file end
  56.  
  57. echo
  58. file $MP3
  59.  
  60. echo remember to test: cvlc $MP3
  61.  
  62. # thank you, drive through
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement