Skip to content

Control iTunes Remotely

I have iTunes running at home on a Mac mini, with a Harmon Kardon Soundsticks II system connected, and was looking for a way to control iTunes remotely, from another Mac. This page discusses setting up a PHP script on the remote machine, but involves some things I didn’t like much (like running the web server as a normal user). Also, managing iTunes via web URLs isn’t as convenient as I’d like.

What I finally decided to implement, was a number of shell scripts that can be run from QuickSilver. This works, is very convenient, and only relies on SSH key authentication (i.e. without password) to the remote machine.

Following are the shell scripts I now have. (Important: Note that the second and third lines of each script below are really one line in the shell script. I broke the line for display purposes here.)

With these in place, controlling iTunes remotely is a matter of command-space iNext return. Great!

  • iUp (increase the volume)
    #!/bin/bash
    ssh 192.168.2.130  "osascript -e 'tell application "iTunes"
    to set sound volume to sound volume + 5'"
    
  • iDown (decrease the volume)
    #!/bin/bash
    ssh 192.168.2.130  "osascript -e 'tell application "iTunes"
    to set sound volume to sound volume - 5'"
    
  • iNext (next song)
    #!/bin/bash
    ssh 192.168.2.130  "osascript -e 'tell application "iTunes"
    to next track'"
    
  • iPrev (previous song)
    #!/bin/bash
    ssh 192.168.2.130  "osascript -e 'tell application "iTunes"
    to previous track'"
    
  • iPause (pause)
    #!/bin/bash
    ssh 192.168.2.130  "osascript -e 'tell application "iTunes"
    to pause'"
    
  • iPlay (play)
    #!/bin/bash
    ssh 192.168.2.130  "osascript -e 'tell application "iTunes"
    to play'"
    
  • iQuit (quit iTunes)
    #!/bin/bash
    ssh 192.168.2.130  "osascript -e 'tell application "iTunes"
    to quit'"
    
  • iStart (start iTunes)
    #!/bin/bash
    ssh 192.168.2.130  "osascript -e 'tell application "iTunes"
    to start'"
    

Technorati Tags: ,

Published inTechnology

2 Comments

  1. Brandon Delcamp Brandon Delcamp

    I have a similar setup, yet I use Quicksilvers powerful Triggers feature to map the scripts to hotkeys, which I can trigger with my keyboard, or my hacked up xbox remote.

  2. Yahir Yahir

    I just got my 2000t and all of my songs are skipping in iTunes, and I cant figure out why. If someone could help me out and tell me how to fix this I would really appreciate it because its driving me crazy. Thanks for the replys.

Agree? Disagree? What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.