February 07, 2005
Lisp Controller for iTunes

Richard Newman has a web interface to iTunes, written in Lisp.

From his initial weblog post:

Today, rather than doing anything useful, I wrote an Araneida-based Web application to control a running instance of iTunes. Picture the scenario: our office server is an iTunes platform, serving up the tracks. But there are 4 of us! How do we all skip songs?

Well, up until today I was SSHed into the server, using some shell scripts to Applescript iTunes. That's no good for anyone not logged in as me, though; they can't talk to my running iTunes process.

However, by running this little app in a Lisp (tested with OpenMCL2; might work in others) on the server, we all get a sweet little Web interface.

Later he modified it to use AppleScript directly instead of shelling out:

I decided to investigate further, and I've managed to get a massive speed boost (indeed, I now use the Web interface rather than my shell scripts!). As an example, to increase the volume this function was used:

(defun volume-up ()
  (run-program "vu" ()) t)

Now, we close over a precompiled Applescript object, and provide a function to run it:

(defun make-volume-up ()
  (let ((vu-event (make-instance 'ns:ns-apple-script
    :init-with-source #@"tell application \"iTunes\"\
 to set sound volume to (sound volume + 10)")))
    (send vu-event :compile-and-return-error
      (ccl::%null-ptr))
    (defun volume-up ()
      (send vu-event :execute-and-return-error 
      (ccl::%null-ptr)))))
Posted by jjwiseman at February 07, 2005 12:47 PM
Comments

Pretty cool!

Posted by: Michael Hannemann on February 7, 2005 03:15 PM
Post a comment
Name:


Email Address:


URL:




Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)

Comments:


Remember info?