Skip navigation.

iTunes Remote for OperaDS

A web based remote for iTunes, built for Opera for the Nintendo DS

Posts tagged with "Apache"

v 0.5.1

, , , ...

Minor changes to speed up track info display on track change.


Download

iTunesDSr set-up instructions

iTunesDSr set-up instructions

, , , ...

UPDATED: 2006-09-10

Requirements:
  • Macintosh OS X v. 10.4.x
  • The BSD "subsystem" installed (It is by default)


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:

If you are updating from a previous version
Move your iTunesDSr/images/albums folder to the Desktop before replacing the iTunesDSr folder! Not doing so will mean you lose exported iTunes artwork for use with iTunesDSr. After replacing the iTunesDSr folder with a new version move the albums folder back to iTunesDSr/images.

Download and unzip the iTunesDSr archive. Place the folder named iTunesDSr into your User Sites folder (where "Calvin" is your user).

IMPORTANT! As is, iTunesDSr will not work if placed in any folder other than your User Sites folder!


Set-up:

Drop an alias (Command+Option+drag) of the iTunesDSr FA.scpt file (located in the scripts folder of iTunesDSr) into the Folder Actions Scripts folder in your User Scripts folder. If the Folder Actions Scripts folder does not exist there, create it.
Note: You need only do this once. If a new version of this package is released the old alias will work just fine.

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 activate the Finder. Choose Go to Folder... from the Finder's Go menu.

Now enter /tmp in the resulting dialog and press Go.

Control Click on the tmp folder and select Attach a Folder Action... from the contextual menu.

In the Choose a File dialog, select iTunesDSr FA alias you created earlier.

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.


I'll post usage instructions laterer...

But the gist is: To export iTunes artwork for use with iTunesDSr, run iTunesDSr Artwork located in the iTunesDSr scripts folder. Point your browser at http://your.intranet.ip.address/~youruser/iTunesDSr/


Enjoy.

AppleScript vs. Fast User Switching!!

, , , ...

Fast User Switching - 1
AppleScript - 0



The instance of iTunes that receives Apple Events is the one running under the current user. I've noticed this behavior with Remote Apple Events apps that want to control iTunes. What this means is that if you're blasting iTunes and another user switches to their account, your iTunes stops responding to AppleScript commands.

Now, hold on a minute! iTunes does respond to AppleScript from another app running under the same user, active login be damned. For instance, I have an AppleScript Studio app I made to update a "last song played" PHP script. The result of which can be seen on my homepage (StrawHousePig - Home) and in the form of an image I use for profile or sig pics at various forums that allow it.



The AS Studio app polls iTunes and sends current track info to the PHP script. I always meant to finish and release it, but once I got it working for us I said, "screw it, good enough". The important thing here is that it updates without my user being active.

So while it may be kewl to hi-jack your wife's or other relatives iTunes, it's only funny till they hear you laughing about it. Actually controlling your iTunes would be much better. Though the real value of doing so is made moot unless you're streaming iTunes through an AirPort Express or other means as that's the only way to hear your iTunes while your user isn't the active one.

I'll have to look into running an AS app that can pass ARGVs from osascript to iTunes as commands. But, osascript may break that.


The point of all this is that with this technique it should be possible to run Apache as www instead of a "real" user, making it much more secure to use.

Block Apache to outsiders

, , ,

Though I'm sure its rarely necessary, I'm going to post this bit of mod_rewrite magic that took me quite a while to sort out (this is the only syntax that would work). What it does is bounce (because I like being a smart-ass) any request made to Apache unless it is made from the local network (subnet/intranet access only). I figure there has to be a few Mac users sharing their ethernet connection over AirPort. Though I'm not certain that can be done with PPoE...


This has not been tested on a server accessible to outsiders, but I'll do that before releasing Apache instructions in the final package.

Open httpd.conf (in the Terminal, type sudo pico /etc/httpd/httpd.conf, press Return then enter you password at the prompt and press Return).

This section looks like a great place to put it. Scroll down until you find it.
# First, we configure the "default" to be a very restrictive set of
# permissions.
#

After those lines, paste this:
###################################################
###     Protect server from outside traffic     ###
###################################################

RewriteEngine on      
RewriteCond %{REMOTE_ADDR} !^10\.
RewriteRule ^/(.*) http://%{REMOTE_ADDR}/ [L,E=nolog:1]

###################################################

IMPORTANT: If your subnet IP prefix begins with anything other than 10. (one zero dot) be sure to change the RewriteCond line to reflect that.

Press Ctrl-x, then y, then Return and restart Apache.