- <?
- // iTunes .itc Artwork Extraction Script v0.1
- // (c) Scott Wilcox 2007/08
- //
- // You will need to download and install 'jpegextractor', imagemagick
- // and java in order for this to successfully work. You'll also need SCP
- // as well. Also uses rm, cd, find and cmp. Report bugs/errors to
- // sc0tt@x0f.org or the evil pixies will come to get you. Takes about 25
- // seconds to get through about 140 albums (approx!).
- //
- // You can see the end results at http://nixbox.org/albums in a pretty grid.
- //
- // Things you'll need:
- // jpegextractor http://schmidt.devlib.org/software/jpeg-extractor.html
- // imagemagick http://www.imagemagick.org
- // java http://java.com
- //
- // This has been tested on Mac OSX, Slackware Linux and FreeBSD. I'm not
- // responsbile if this blows your house up though, kills your dog or does
- // anything else deemed to be bad.
- // Path to jpegextractor directory, with a trailing slash.
- $jpegextractor = "/usr/local/jpegextractor/";
- // Path to java
- $java = "/usr/bin/java";
- // Path to ImageMagick's mogrify binary
- $imagemagick = "/usr/local/ImageMagick-6.3.7/bin/mogrify";
- // Path to iTunes "Album Art" directory, no trailing slash
- $itunes_path = "/Users/MyUser/Music/iTunes/Album Artwork";
- // Path to a temporary directory we can write too, make sure
- // you add a trailing slash, ie /tmp/albumart/
- $tmp = "/tmp/albumart/";
- // Path to SCP binary
- $scp = "/usr/bin/scp";
- // SCP Login details (user@host:path)
- $scp_auth = "user@server:/path/to/album/art";
- // Path to standard 'find', 'rm' and 'cmp' binaries
- $find = "/usr/bin/find";
- $rm = "/bin/rm";
- $cmp = "/usr/bin/cmp";
- // Check to see that they've configured it somewhat
- }
- // First, we need to check that our temporary directory exists
- // and we can write to it
- // We'll use the standard find command to find our list
- // of itunes .itc files
- // Clear the directory out of jpg's
- // Check for .itc's
- // If we found any .itc files, then put them into an array
- // and we'll copy them over to a temp directory so that
- // jpegextractor can process them all in one go.
- // Initilise some variables and an array
- // Copy each file to our temporary directory
- $fail++;
- }
- $blank++;
- }
- }
- // Notify user of how many copied successfully, and how
- // many failed/were blanks
- // Notify user that we're about to start jpegextraction
- // Now switch into the jpegextractor directory and run
- // jpegextractor on temporary directory of .itcs
- ".$tmp."*.itc ; rm ".$tmp."*.itc");
- // Now we need to create an resized image using imagemagick
- // to resize them all.
- // Weed out any duplicates!
- continue; for TWO in $ALL; do [ -f $TWO ] || continue; case $ONE in $TWO) continue;; esac;
- '.$cmp.' -s $ONE $TWO && echo Duplicate: $TWO && '.$rm.' -f $TWO; done; done');
- // Now SCP them over to the webserver
- // Clean up and delete all left files
- }
- }
- ?>
Code / PHP Snippets / iTunes .itc Extraction and Conversion
Download as Text : January 6th, 2009
This work is licensed under a