New iTunesDSr package
Friday, July 27, 2007 6:44:44 AM
Perhaps I've spoken too soon.
This has finally been tested in the Opera browser for Nintendo DS and has been reworked a little to make it run a little smoother.
Set-up instructions have changed slightly since the previous version. Read the rest of this post for more info.
---------------
This has finally been tested in the Opera browser for Nintendo DS and has been reworked a little to make it run a little smoother.
Set-up instructions have changed slightly since the previous version. Read the rest of this post for more info.
---------------
Download: iTunesDSr.zip - 40KB
Requirements:
- Macintosh OS X v. 10.4.x
- The BSD "subsystem" installed (It is by default)
- iTunes 7.3 (I've only tested and used it with this version)
- Administrator privileges
Before Use:
You must enable PHP for and start Personal Web Sharing (the Apache HTTP server). See PHPmac - Enabling Apple's Supplied PHP in OS X 10.4 Tiger for a great guide on doing so.
Installation:
Download and unzip the iTunesDSr archive. Place the folder named iTunesDSr into your User Sites folder.
IMPORTANT! As is, iTunesDSr will not work if placed in any folder other than your User Sites folder!
Set-up:
Double click the iTunesDSr FA.scpt file (located in the scripts folder of iTunesDSr) to open it in Script Editor. Choose "Save as..." from the File menu and save it into the Folder Actions Scripts folder in your User Scripts folder (~/Library/Scripts). If the Folder Actions Scripts folder does not exist there, create it before saving.
Enable Folder Actions using Folder Actions Setup.app located in the AppleScript folder of the Applications folder.
Check the Enable Folder Actions checkbox.
Close Folder Actions Setup and navigate in the Finder back to the iTunesDSr folder. Control Click on the scripts folder (inside the iTunesDSr folder) and select Attach a Folder Action... from the contextual menu.
In the Choose a File dialog, select the iTunesDSr FA.scpt file you moved earlier.
Control-click on the iTunesDSr scripts folder and select Get Info from the contextual menu. In the Info window click on the disclosure triangle at Ownership & Permissions, then again on Details. Click the lock icon to the right of the Owner (your) name to allow changes to the permissions. After entering your credentials when prompted, click on the Group pop-up menu and select "www" from the list. You will most likely be prompted for an administrator password again. Now click on the Access pop-up menu and select "Read & Write" from the list.
Set-up done!
Caveats:
This software behaves very sluggish. This is necessary to allow Folder Actions a chance to see the temporary files needed to pass commands to and get information from iTunes. The PHP send_com.php is set to sleep for 3 seconds after writing the "request" files before removing them. This delay seems to work the most reliably for me (dual 2.5 G5, 1GB RAM). If your results vary, you may wish to edit the sleep(3); function at line 30 of send_com.php.
Usage:
Point your browser at http://your.intranet.ip.address/~youruser/iTunesDSr/index.php
Enjoy.








Unregistered user # Wednesday, April 9, 2008 3:21:29 AM
StrawHousePig # Friday, May 2, 2008 7:08:35 AM
This version does it one at a time when the track changes, but I started with exporting all artwork to a folder before hand to speed up run times. However that was unreliable and I never figured out why. Plus on large libraries it can take quite a while to go through all the tracks.
This was the last version of that method I tried:
property my_path : (path to sites folder as text) & "iTunesDSr:images:albums:" property num_tracks : 0 property last_album : "" tell application "Finder" if exists {((path to preferences folder) as text), "iTunesDSr.plist"} then set my_alert to "I see you haven't run iTunesDSr Artwork before." & return & "This will probably take a while. So relax. I'll let you know when I'm done. =)" do shell script "defaults write iTunesDSr lastRun '" & (current date) & "'" else set my_alert to "iTunesDSr Artwork will now export album art added since the last time you ran it. =)" do shell script "defaults write iTunesDSr lastRun '" & (current date) & "'" end if end tell tell application "iTunes" if the button returned of (display alert my_alert buttons {"Cancel", "Proceed"}) is "Proceed" then set the_albums to album of tracks of library playlist 1 repeat with i from 1 to count of items in the_albums set album_name to item i of the_albums as string if album_name is not "" then if album_name is not last_album then set last_album to album_name set the_track to (track 1 whose album is album_name) of library playlist 1 tell application "Finder" set my_x_path to alias my_path set album_name to my removeChars(album_name) set the_file to (album_name & ".jpg") as string if not (exists file the_file of my_x_path) then my _make(the_track, album_name) end if end tell end if end if end repeat beep display alert "iTunesDSr Artwork finished!" & return & return & num_tracks & " album artworks exported." buttons {"OK"} default button 1 end if end tell on removeChars(this_text) set the illegalChars to "\"'\\:?/" set the character_list to {} repeat with this_char in this_text set this_char to the contents of this_char if this_char is in the illegalChars then set the end of the character_list to "" else set the end of the character_list to this_char end if end repeat return (the character_list) as string end removeChars on _make(the_track, album_name) try tell application "iTunes" set artwork_data to data of artwork 1 of the_track if artwork_data is not "" then set artwork_image to (open for access my_path & "temp_img" with write permission) set eof artwork_image to 512 write artwork_data to artwork_image starting at 513 close access artwork_image set artwork_data to "" tell application "Image Events" set this_image to open (my_path & "temp_img") as string scale this_image to size 110 set new_item to (my_path & (album_name) & ".jpg") as string save this_image in new_item as JPEG close this_image end tell set num_tracks to num_tracks + 1 end if end tell end try end _makeThat will save the artwork as a JPEG named for the album. Of course albums titled "Greatest Hits" don't play well with it. I used it as an app, but it should work as a script with no alterations.