Archive for November 28th, 2006

iPod to youPod

Before I forget, allow me to download the contents of my brain pertaining to sharing one's iPod via the www.

Here is an outline of the steps necessary.
1. Transfer iPod contents to computer
2. Rename files / clean up ID3 tags
3. Make artist directories
4. Set up Apache webserver
5. Install Apache module mod-musicindex
6. Install Icecast streaming server

Transfer iPod contents to computer. I did it like this:

BASH:
  1. # go to directory on iPod where music is stored
  2. cd /media/ipod/iPod_Control/Music
  3. # cp the contents of folders inside music directory to webroot/mp3
  4. cp {F0,F1,F2,F3,F4}{0,1,2,3,4,5,6,7,8,9}/* /var/www/mp3

Rename files / clean up ID3 tags. I did it like this:

BASH:
  1. # debian's package management system; use your equivalent
  2. sudo apt-get install mp3info mp3rename
  3. # check your tags out
  4. # set a var for mp3info cmd to print a tab separated list of title, artist,
  5. # album and newline
  6. mp3infocmd=`mp3info -print '%t\t%a\t%l\t\n'`
  7.  
  8. #**** Refer to this list and edit your ID3 tags - see man mp3info for details ****#
  9.  
  10. # find all mp3s (ignoring single quotes, newlines, etc.)
  11. find /var/www/mp3 -name '*.mp3' -print0 | xargs -0 $mp3info
  12. # rename according to your perfect tags
  13. # set default filename scheme
  14. mp3rename -s '%a&l&t'
  15. # rename!
  16. mp3rename /var/www/mp3

Make directories for artists for easier browsing.

BASH:
  1. #!/bin/bash
  2.  
  3. ########################################
  4. # mp3_sort.sh                                                                                           
  5. # note: anyone is free to use this script as I am about to post it online
  6. # it has no error checking, and will almost definitely break, so it is       
  7. # distributed with no implied merchantability or fitness for a specific   
  8. # purpose                                                                                                 
  9. ########################################
  10. srcDir=/var/www/mp3
  11. destDir=/var/www/mp3/sorted
  12.  
  13. cd ${srcDir}
  14. # disregard case
  15. find ${srcDir} -type f -iname \*.mp3 | while read f; do
  16.  
  17. # get artist
  18. ARTIST=`mp3info -p '%a' "${f}"`
  19.  
  20. # make sure artist tag defined
  21. if [ "noart$ARTIST" = "noart" ]; then # ARTIST undefined
  22. echo "some artist tag missing";
  23. else   
  24.   # destination exists?
  25.   if [ ! -d "${destDir}/${ARTIST}" ]; then
  26.   # no? then make it
  27.       mkdir "${destDir}/${ARTIST}" \
  28.       || echo "cannot make dir \"${destDir}/${ARTIST}\"."\
  29.      >/dev/stderr
  30.   fi
  31. # mv file to newly made directory
  32.   mv -f "${f}" "${destDir}/${ARTIST}"
  33. case "$?" in
  34.   #   0) echo "\"${f}"\" -> \"${destDir}/${ARTIST}\";;
  35.   0) echo "a file was moved";;
  36.   *) echo "could not move \"${f}\".">/dev/stderr;;
  37. esac
  38. fi
  39. done
  40. exit 0

Set up Apache webserver.
See apache.org for details.

Install Apache module mod-musicindex

BASH:
  1. sudo apt-get install libapache2-mod-musicindex
  2. # the REAMDE file has all the instructions on setting the Aliases to whatever
  3. # directory your music files are in

Install IceCast2

BASH:
  1. sudo apt-get install icecast2
  2. # listens on port 8000 by default; allow tcp through in your router or firewall

1 comment November 28th, 2006


Calendar

November 2006
M T W T F S S
« Oct   Jan »
 12345
6789101112
13141516171819
20212223242526
27282930  

Posts by Month

Posts by Category