Build an iTunes Remote Control
Pages: 1, 2
Serving WAP via CGI (ala Perl)
You can get some very good context for running CGI on Apache here if you need an overview. For our purposes, CGI is simply a means of having a Perl script do two things: 1) provide the appropriate HTTP Response Headers for serving WAP content, and 2) pass messages to a daemon (currently lurking in the shadows) that controls iTunes. The stock installation of Apache with OS X has CGI configured to run by default.
To try CGI out, copy the following script into a file named index.pl, place it into /Library/WebServer/CGI-Executables, and set its permissions to be executable by Apache (user "www") with a chmod 755 index.pl in Terminal. If you know any Perl at all, you'll see that it simply writes out the content type header that the browser expects followed by each line of a file called "menu" (the body of a WML file). The file "menu" also needs to be saved to this same directory. For a quick crash course in Perl, check here.
Here's index.pl:
#!/usr/bin/perl
print "Content-type: text/vnd.wap.wml\n\n";
open MENU, "./menu" or die "'menu' not in current dir";
while (<MENU>) {print "$_";}
close MENU;
Here's the file "menu" that is simply a WML file; it looks strikingly similar to HTML content:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC
"-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card title="iTunes RC">
<p><a href="/cgi-bin/RandomTrack.pl">RandomTrack</a></p>
<p><a href="/cgi-bin/PlayPause.pl">Play/Pause</a></p>
<p><a href="/cgi-bin/MuteUnmute.pl">Mute/Unmute</a></p>
<p><a href="/cgi-bin/Rewind.pl">Rewind</a></p>
<p><a href="/cgi-bin/FastForward.pl">FastForward</a></p>
<p><a href="/cgi-bin/VolumeUp.pl">VolumeUp</a></p>
<p><a href="/cgi-bin/VolumeDown.pl">VolumeDown</a></p>
</card>
</wml>
|
Related Reading
AppleScript: The Missing Manual |
You should be able to open the URL http://your-ip-address in your phone or a WAP emulator and successfully have Apache serve this menu to you. Recall that the extra /cgi-bin/index.pl that fully identifies the URL is implicitly understood through one of the earlier modifications to Apache's configuration file. If you're greeted by a "Forbidden" message instead of seeing the menu, check file permissions on the Perl script; permissions often cause hang ups, but it's to protect us from ourselves, right?
The Rest of the Perl Scripts
So what about all of those other self-naming Perl scripts referenced in index.pl? The short answer is that they do what they say they do by getting a corresponding AppleScript to control iTunes. The longer answer involves a quick aside to explain security permissions.
When we run a Perl script or any other executable on our machine, we run it as the user we logged in as. Except for root level actions, our user login usually gets the job done. When Apache runs a script, however, it runs it under the special user account "www" that is limited in some ways. In short, this is a security precaution. It's impact on our design is minimal, but at the same time, sort of frustrating.
To illustrate the design impact, consider the following scenario: If I execute a Perl script as user "matthew" that contains a line of code executing an AppleScript, the AppleScript executes just fine under the veil of user account "matthew" as well.
User "matthew" runs the Perl script, so user "matthew" inadvertently runs the AppleScript, which then sends Apple events to an application like iTunes (an application also running under user account "matthew"). This scenario isn't possible for our iTunes remote control because the Perl scripts and embedded AppleScripts are executed by Apache under user account "www", and user "www" can't send Apple events to applications (not to mention iTunes running under the different user account "matthew").
For our specific purpose, we can circumvent the inability of Apache to run AppleScripts the way we'd like by having the CGI script write a particular command to a file that a background daemon periodically checks and acts on. If this daemon process is running under our normal user account, the daemon can execute AppleScripts and consequently send Apple events to iTunes. This the long way around, but it does get the job done and is reasonably secure. If you ever need to do something fairly complex involving CGI and AppleScript, have a look at ACGI Dispatcher. It might save you some time at the cost of a few meals.
Let's get rolling again with some more code. Consider the following Perl script, PlayPause.pl, that Apache executes when you click on the corresponding link in index.pl:
#!/usr/bin/perl -w
system "echo 'PlayPause' > /tmp/iTunesRemoteControl";
system "chmod uga+rw /tmp/iTunesRemoteControl";
print "Content-type: text/vnd.wap.wml\n\n";
open MENU, "./menu" or die "'menu' not in current dir";
while (<MENU>) {print "$_";}
close MENU;
This Perl script writes the command "PlayPause" to a file in a temporary directory where everyone has write permissions, changes its permissions so that the daemon (that's our next step) can modify it, and then redisplays the main menu.
The Daemon Glue
Without further adieu, here is the daemon that completes the process:
#!/bin/bash
##########################################################
#Matthew Russell -25 Feb 05
#Usage: prompt$./iTunesRemoteControlDaemon.scr &
#
#This simply reads a file and executes an AppleScript that
#controls iTunes based on its content.
#
#kill the daemon using the companion script killDaemon.scr
##########################################################
############
#User Prefs
############
scriptDir="/Library/WebServer/CGI-Executables"
remoteCommand="/tmp/iTunesRemoteControl"
delay="1.0"
#############
#begin script
#############
while [ 1 ]; do
status=`cat $remoteCommand`
case $status in
"RandomTrack") osascript $scriptDir/RandomTrack.scpt;;
"Rewind") osascript $scriptDir/Rewind.scpt;;
"FastForward") osascript $scriptDir/FastForward.scpt;;
"MuteUnmute") osascript $scriptDir/MuteUnmute.scpt;;
"PlayPause") osascript $scriptDir/PlayPause.scpt;;
"VolumeDown") osascript $scriptDir/VolumeDown.scpt;;
"VolumeUp") osascript $scriptDir/VolumeUp.scpt;;
esac
echo "" > $remoteCommand
sleep $delay
done
So as you can see, it's simply a matter of having a daemon script pick up a message from a file and execute a corresponding AppleScript. This would be a good time to check out the man pages for the osascript command and take a crash course in Bash scripting.
I've conveniently bundled all of the scripts here for you along with some troubleshooting help in a README file. Take this archive and extract its contents to your /Library/WebServer/CGI-Executables directory. You must give all of the Perl scripts proper permissions with chmod 755 *.pl. Also, give your daemon executable permissions from your user account with chmod u+x. When all else fails, check and recheck file permissions.
All of the AppleScripts provided can be inspected in the Script Editor via Terminal with open [ScriptName]. All of them are too simple to merit explanation. For example, consider PlayPause.scpt:
tell application "iTunes"
playpause
end tell
Any questions? If you want some more information on AppleScript, a good place to start is here on Apple's site.
Final Thoughts
The scripts provided do most of the common things you'd want to be able to do from an iTunes remote control. If you want more customization, adapt some of the existing AppleScripts out on the web to fit your needs. Doug's AppleScripts for iTunes is a good starting point. If you plan to keep your remote control up for extended time periods, you'll want to design a simple login system that requires some form of authentication. You can easily do this with another short CGI script. What could be worse than an unknowing web surfer waking you up at night with random music?
Following the design pattern for this remote control, you can control a lot more than iTunes. Stay on top of your web server's security, and have fun.
Matthew Russell is a computer scientist from middle Tennessee; and serves Digital Reasoning Systems as the Director of Advanced Technology. Hacking and writing are two activities essential to his renaissance man regimen.
Return to MacDevCenter.com.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 30 of 30.
-
I wrote this, And it doesn't work.
2005-03-20 10:52:35 Cool6324 [Reply | View]
tell application "iTunes"
run
end tell
As open.scpt
and
#!/usr/bin/perl
#
system "echo 'open' > /tmp/iTunesRemoteControl";
system "chmod uga+rw /tmp/iTunesRemoteControl";
#
print "Content-type: text/vnd.wap.wml\n\n";
#
open MENU, "./menu" or die "'menu' not in current dir";
while (<MENU>) {print "$_";}
close MENU;
and added this to the daemon
"open") osascript $scriptDir/open.scpt;;
What do I do to get it to run? And file permissions are correct.
-
I wrote this, And it doesn't work.
2005-03-20 11:06:47 Matthew Russell |
[Reply | View]
Ok. Your AppleScript appears to be good, and without trying to run it myself, your Perl script appears alright as well. If I had to guess, I might say that you haven't modified the daemon code since you neglected to mention that at all.
Realize that the code you've written is disjoint without the daemon. You serve up a page with perl...and perl just so happens to write the word "open" to a file. That's all well and good, but without having your daemon actually process the "open" command, it doesn't matter if you would have written Robinson Crusoe to the file (a great book that I highly recommend by the way).
So my advice would be to add an additional case statement to the daemon if you haven't done that (remembering to restart it afterward). Otherwise, the little AppleScript you wrote will never be called.
The crucial thing to realize here is that writing the word "open" to the file doesn't automatically call open.scpt for you.
How's that work?
M. -
I wrote this, And it doesn't work.
2005-03-20 11:56:22 Cool6324 [Reply | View]
Works Great, I'm going to write one to close iTunes, now. This is so kool, I always wanted to do this too. Now, I want to have a script that Auto-Starts the deamon, from the dock, and I have done done so, but terminal just locks. So that "&" where would I put it so terminal doesn't hang.
tell application "Terminal"
do shell script "sudo /Library/WebServer/CGI-Executables/iTunesRemoteControlDaemon.scr" password "xxxx" with administrator privileges
end tell
But again terminal locks. -
I wrote this, And it doesn't work.
2005-03-20 15:00:23 Matthew Russell |
[Reply | View]
Personally, I haven't ever attempted to take this approach. Have you tried putting it inside the double quotes right after "iTunesRemoteControlDaemon"? Give it a shot.
If it doesn't work, you might want to ask if you actually reboot your system enough to merit going through the trouble of auto-starting this.
If you want to proceed, I'd question why you're using AppleScript to simply run a shell script. You don't need this extra layer of scripting. Your shell script doesn't need to run as admin either. It just needs to run as your user account.
The link I posted before that references login hooks on bombich.com should have been a pointer in the right direction. You ultimately want to have this thing start up as a normal daemon process just like lots of the other things that start up, right?
If you just want a double clickable item to run the script for the dock, you can do that by researching some more on Terminal and saving a terminal session as a Term file. In fact, there a long series here on macdevcenter about that.
M. -
I wrote this, And it doesn't work.
2005-03-20 15:49:46 Cool6324 [Reply | View]
I dont re-boot my system enough, but I do have a iBook that I carry, and I sometimes have to boot. But as long as it's running, I have no problem. I also noticed, that apon excuting the script file in terminal, it does freeze which may give the appearence that nothing is happining, but don't be fooled, the script has been executed!! And do not run it again, because that will cause actions to be repeated. Once the script is opened the terminal, the only way I can get ever thing working is to run thissudo chmod 777 /private/tmp/iTunesRemoteControlin terminal. That will do the trick. I have also added some commands(change album), which anyone can do, copy and paste the info in any if the xxx.pl file's.
#!/usr/bin/perl
system "echo 'XXXXX' > /tmp/iTunesRemoteControl";
system "chmod uga+rw /tmp/iTunesRemoteControl";
print "Content-type: text/vnd.wap.wml\n\n";
open MENU, "./menu" or die "'menu' not in current dir";
while (<MENU>) {print "$_";}
close MENU;
Define a varible where XXXXX is, and add it to the daemon
#!/bin/bash
##########################################################
#Matthew Russell -25 Feb 05
#Usage: prompt$./iTunesRemoteControlDaemon.scr &
#
#This simply reads a file and executes an AppleScript that
#controls iTunes based on its content.
#
#kill the daemon with script killRemoteDaemon.scr
##########################################################
############
#User Prefs
############
scriptDir="/Library/WebServer/CGI-Executables"
remoteCommand="/tmp/iTunesRemoteControl"
delay="1.0"
#############
#begin script
#############
while [ 1 ]; do
status=`cat $remoteCommand`
case $status in
"getlyrics") osascript $scriptDir/GoogleLyricSearch.scpt;;
"nextalbum") osascript $scriptDir/PlayNextAlbum.scpt;;
"open") osascript $scriptDir/open.scpt;;
"RandomTrack") osascript $scriptDir/RandomTrack.scpt;;
"Rewind") osascript $scriptDir/Rewind.scpt;;
"FastForward") osascript $scriptDir/FastForward.scpt;;
"MuteUnMute") osascript $scriptDir/MuteUnMute.scpt;;
"PlayPause") osascript $scriptDir/PlayPause.scpt;;
"VolumeDown") osascript $scriptDir/VolumeDown.scpt;;
"VolumeUp") osascript $scriptDir/VolumeUp.scpt;;
esac
echo "" > $remoteCommand
sleep $delay
done
As you can see I added some, pointing to the corresponding script.
I added one to open, change album, and even get Lyrics. The same concept can be used in all applications and you can just add to the existing daemon(I'm Guessing).
So in closing I've learned alot in two days, I think my "wapTunes" is ready to be shown off to my friends, at school.
-
I wrote this, And it doesn't work.
2005-03-20 16:24:11 Matthew Russell |
[Reply | View]
Glad you had fun with this. That's what it's all about!
M.
-
Doesn't work
2005-03-19 09:32:50 Cool6324 [Reply | View]
I've tried everything, changed permissions on the files it doesn't work. The .pl scripts don't work, because when I call for them nothing happenes. Please tell mme what might I do? I have some idea's for this plus new scripts, so if I can get it to work it's be great. -
Doesn't work
2005-03-19 09:56:20 Matthew Russell |
[Reply | View]
I'd like to help you this working, but need some more information. If you will provide answers to the following questions, I think that'll be a good start.
Specifically, in your directory containing all of the perl scripts, type "ls -al" and paste the output into "pre" tags in your follow up. That provides full information about file permissions.
If you type http://localhost in your browser, do you get the default apache page?
If you type http://YOUR-IP-ADDRESS in your browser, do you get the same default page?
If you try to run a very simple Perl script like the one below, do you get it to display the text you expect from the command line?
When you try it in your browser, what happens?
What is the exact URL you're using to try and access in it?
What directory are you storing the file into on your local disk (should probably be /Library/WebServer/CGI-Executables/)?
#!/usr/bin/perl
print "Content-type: text/vnd.wap.wml\n\n";
print "<html><head><title>hello there</title></head>\n";
print "<body>how are ya doin'?</body></html>\n";
I'll check back here periodically. Keep me updated; let's get it working. -
Doesn't work
2005-03-19 10:31:40 Cool6324 [Reply | View]
total 200
drwxrwxr-x 23 parisbut www 782 19 Mar 12:25 .
drwxrwxr-x 5 root admin 170 18 Mar 19:43 ..
-rw-rw-rw- 1 parisbut admin 12292 19 Mar 12:25 .DS_Store
-rwxr-xr-x 1 parisbut parisbut 265 28 Feb 20:08 FastForward.pl
-rwxr-xr-x 1 parisbut parisbut 980 25 Feb 22:31 FastForward.scpt
-rwxr-xr-x 1 parisbut parisbut 263 28 Feb 20:08 MuteUnMute.pl
-rwxr-xr-x 1 parisbut parisbut 1018 25 Feb 22:41 MuteUnMute.scpt
-rwxr-xr-x 1 parisbut parisbut 265 28 Feb 20:08 PlayPause.pl
-rwxr-xr-x 1 parisbut parisbut 984 25 Feb 22:30 PlayPause.scpt
-rw-r--r-- 1 parisbut parisbut 1137 27 Feb 19:18 README
-rwxr-xr-x 1 parisbut parisbut 264 28 Feb 20:08 RandomTrack.pl
-rwxr-xr-x 1 parisbut parisbut 5794 27 Feb 20:37 RandomTrack.scpt
-rwxr-xr-x 1 parisbut parisbut 259 28 Feb 20:09 Rewind.pl
-rwxr-xr-x 1 parisbut parisbut 974 25 Feb 22:31 Rewind.scpt
-rwxr-xr-x 1 parisbut parisbut 263 28 Feb 20:09 VolumeDown.pl
-rwxr-xr-x 1 parisbut parisbut 1038 25 Feb 22:36 VolumeDown.scpt
-rwxr-xr-x 1 parisbut parisbut 261 28 Feb 20:09 VolumeUp.pl
-rwxr-xr-x 1 parisbut parisbut 1036 26 Feb 00:30 VolumeUp.scpt
-rwxr-xr-x 1 parisbut parisbut 217 27 Feb 19:19 hello.wml
-rwxr--r-- 1 parisbut parisbut 1027 27 Feb 19:17 iTunesRemoteControlDaemon.scr
-rwxr-xr-x 1 parisbut parisbut 159 26 Feb 01:29 index.pl
-rwxr--r-- 1 parisbut parisbut 909 27 Feb 19:19 killRemoteControlDaemon.scr
-rw-r--r-- 1 parisbut parisbut
625 27 Feb 20:36 menu
Local host works, file is promted to download in webrowser. I'm running it from /Library/WebServer/CGI-Executables/. When I use my IP I get the same defualt page. Thank you For Your Help
-
Doesn't work
2005-03-19 10:45:43 Matthew Russell |
[Reply | View]
So to clarify, when you say "file is promted to download in webrowser", you are referring to the simple perl file I pasted in to my previous reply? i.e. you get a prompt to download the actual perl file?
What URL are you typing in exactly? Is it http://localhost/cgi-bin/yourPerlFile.pl ? (The cgi-bin part is important).
If you have modified /etc/httpd/httpd.conf recently, did you remember to stop and restart apache via your System Preferences/Sharing/Personal Web Sharing? If not, your changes weren't updated despite what it may appear. Stop and restart to be sure.
We're narrowing it down. Don't give up!
M. -
Doesn't work
2005-03-19 13:14:52 Cool6324 [Reply | View]
Yes I am prompted to download the actual perl file.
I'm accessing the files http://localhost(or IP):81/cgi-bin/yourPerlFile.pl
:81 because my ISP blocks 80, and I have edited the httpd.conf to use 81. Not using a router either.
I'm also using my phone, as well as Opera(WAP). The Page with the links for or to commands does show. When I press a command it doesn't work. ie. Play doesn't work
I have retarted apache over and over. Still nothing. -
Doesn't work
2005-03-19 13:47:11 Matthew Russell |
[Reply | View]
So when you type http://localhost:81/cgi-bin/hellothere.pl into your web browser (for the simple perl file I pasted in earlier that simply printed a line of text, you get a download option instead of getting a simple webpage? This is expected because the content type is specified to be "Content-type: text/vnd.wap.wml"--which your browser on your computer can't understand (but your phone or a WAP emulator can understand; see page one of the article). Try replacing that line with "Content-type: text/html\n\n" and your browser should then be able to display it. If this checks out, CGI is working.
So the first step thing to do is to use a wap emulator and get your index.pl file to display for you...but based on your comment that "The Page with the links for or to commands does show", this is already happening? (Otherwise, you wouldn't be getting that menu.) If this is the case, the page containing the menu is WAP content served with perl.
Once your server is configured to process the perl scripts and serve you wap content (which it appears to be), you can then start up the background daemon and try to get the iTunes stuff working. Given that the CGI is working, the only other thing that wouldn't be is your background daemon.
You are firing up the background daemon, and have verified that the file it expects to read ( /tmp/iTunesRemoteControl) does exist? If perl is rendering the menu for you, it should also be writing that file to the /tmp directory.
If I've misunderstood anything you've said, clear it up and let's go from there.
M. -
Doesn't work
2005-03-19 14:50:19 Cool6324 [Reply | View]
I am able to see the text in my regular web broswer when I chanhe the content type.
I am able to see the page with WAP.
How do I start the backrond daemon? I dropped file into terninmal and the scripts started working, but now it just stoped. I'm not sure what command I used if any to get it to start.
and tmp/itunesRemoteControl does exist, the file s their. -
Doesn't work
2005-03-19 14:59:57 Matthew Russell |
[Reply | View]
This might be a good time to review the usage header in the daemon script and walk through it once or twice to understand how it does its business. You just start it like any other script only you might find it convenient to end it with an ampersand so it doesn't lock your terminal and so you don't have to keep an extra window open.
If you type "ps -aux" in a terminal, you'll get a list of everything running, and the daemon should be there if it's running. This is the same technique that the kill script uses to find it and kill it whenever you want to shut it down or restart it. Take a look at the latter part of page 2 in the article and checkout the README file included with the scripts.
I think you should be up and running now. Thanks for sticking with it.
M. -
Doesn't work
2005-03-19 15:15:19 Cool6324 [Reply | View]
It still isn't working. Should I place a command before the file in terinmal before running, I dont see it in the lists of running items. -
Doesn't work
2005-03-19 15:22:22 Matthew Russell |
[Reply | View]
From the header of the daemon script:
Usage: prompt$./iTunesRemoteControlDaemon.scr &
So what this assumes is that you're in the same directory as this script (and that you've set it to be executable with "chmod u+x"). Just like any other script, when you type in ./someScriptName, it will execute if it's executable. Placing the ampersand should return your prompt to you. At that point, if you type in "ps -aux | grep iTunesRemoteControlDaemon.scr", you should see it without having to filter through anything.
Does that work for you?
M.
-
Doesn't work
2005-03-19 15:31:10 Cool6324 [Reply | View]
Sorry for the noob questions what's ampersand and where should I write that? Do you have AIM? If so mines is AIM: Seanpaul316 -
Doesn't work
2005-03-19 15:36:44 Matthew Russell |
[Reply | View]
Ampersand is "&" --the thing that's in the usage line that sets the script to run in the background. It's a standard terminal thing.
Try skipping the ampersand for now. Just get the script to run. If you run the script and it keeps your prompt, it's running. Open up another terminal window and go about doing other things. When you're satisfied that things are running, you can use the ampersand and have one less window open.
M. -
Doesn't work
2005-03-19 15:58:12 Cool6324 [Reply | View]
Works great, I just restarted and it ran script again, works good. Will this automatically work after a restart?
BTW, I'm using a Motorola i730, Nextel, with basic WAP service. Works nice.
TIP: When you want to use the same command more than once, ie. Fast Foward it's better to use the reload button.
And last, THANKZ!!! I also learned alot about the way the terinmal works. -
Doesn't work
2005-03-19 16:14:44 Matthew Russell |
[Reply | View]
You need to fire up the daemon each time you restart unless you configure your login scripts to do it for you.
Here's a good lead that should help you at http://www.bombich.com/mactips/loginhooks.html
I'm glad you go this working. Hard work always pays off.
M.
-
Another way to get your IP address
2005-03-19 07:31:15 Matthew Russell |
[Reply | View]
I've had some readers express difficulty in getting their IP address that the web sees (their "external" IP address--not necessarily the one given with "ifconfig"), so I whipped up a little script that you can use to get it another way if you're having trouble.
Save the script to a file and make it executable with "chmod u+x"
#!/bin/bash
####################################################
#Matthew Russell - 19 Mar 05
#
#A way to get your IP address (external to the web)
#from a courtesy web site
####################################################
#a page containing your ip address
wget -q "http://whatismyip.com/index.html"
#scrape out the actual ip address from its title line:
#<title>Your ip is 123.456.789.012 WhatIsMyIP.com</title>
#all one line
perl -n -e 'if (m#(<title>Your ip is )([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)( WhatIsMyIP\.com)#) {print "$2\n";}' index.html > /tmp/ipAddress
Hope that helps.
M.
-
Alternative
2005-03-06 05:47:11 Doncqueurs [Reply | View]
A while ago I posted a similar hack at http://hacks.oreilly.com/. The main difference was that I used a PDA with WiFI and a webbrowser.
Here the URL: http://www.oreillynet.com/pub/h/2661 -
Alternative
2005-03-06 06:12:57 Matthew Russell |
[Reply | View]
It always amazes and interests me to see how many different ways there are to accomplish the same task--especially when the alternative is done in a tool outside those from your normal day to day workings. As the webpage points mentions, just be careful of running Apache as the current user.
-
sounds like a good hack if you have the correct cell phone
2005-03-02 06:48:57 robmiller [Reply | View]
I don't have the correct cell phone, but it is something that would be fun to have.
-
Don't Pry Open Your Airport Express....
2005-03-02 06:32:33 Matthew Russell |
[Reply | View]
...because this guy already did it for you. I was happy to check my e-mail this morning and have a message from Constantin pointing to this link. Certainly not pragmatic on his part, but very interesting if you like knowing how things work:
Inside an Airport Express
There's other pages on his site that show an Airport Extreme opened up and some other cool info about Aiport base stations.
-
Why this hack?
2005-03-01 23:23:20 ralphscheuer [Reply | View]
Nothing against a nice hack now and then, but with this solution, you have to consider that a cell-phone based internet connection also costs money. Moreover, you don't need this considering the fact that most modern phones have bluetooth and Salling Clicker or Romeo do provide remote control functionality via Bluetooth - which takes almost no effort, has a bigger range than most standard remote controls and doesn't cost anything to operate it. -
Why this hack?
2005-03-02 06:26:13 Matthew Russell |
[Reply | View]
You're right about there being a slew of bluetooth devices out there. Some of them cost a few meals; some of them are free; most of them are pretty nice; all of them are pragmatic. This hack was written in the spirit of empowering/educating others, having some some fun, and "getting inside" the design of something like this.
I'm very much a pragmatist myself, but often find myself trying to avoid it because it can usually be more fun and interesting to homebrew something.
I know that at least for me, bluetooth devices often seem to have a little less range than that 30 feet that's advertised, and the concepts from this piece can be taken in a lot of other directions.
Just a fun example of that: you might be out on a date and use your cell phone on the way back home to turn on/dim the lights with some of that cool light controlling hardware that's becoming affordable these days, start up some music with iTunes, etc.
It's all fun! -
Why this hack?
2005-03-02 12:58:56 ralphscheuer [Reply | View]
Please don't be discouraged by my comment - I highly appreciate the articles and tutorials at O'Reilly but in this case, after considering all the disadvantages (cost of the cell phone connection, security implications, latency, etc.), I found the choice of the subject for this hack a bit unfortunate because I wouldn't want to solve this particular problem in such a way.
In the spirit of hacking, an even more geeky solution might be building a midlet for the remote control interface and transmitting XML data to the script ;-)
Again, please don't take offence in my comment, "because you can" is still a good enough reason for geeky stuff ;-) -
RE: Why this hack?
2005-03-02 01:12:32 Derrick Story |
[Reply | View]
I think you're missing the spirit of this thing. In the editor's note I said that this is an Apache tutorial disguised as an iTunes hack. Plus the range of this remote exceeds anything you could do with Bluetooth. Plus, it's a fun way to keep your web serving chops in shape.






I am trying to get this thing to work so it would help if I new it was supposed to say more then PlayPause.