iTunes Remote via SSH
Posted April 13th, 2003 @ 04:21pm by Erik J. Barzeski
I'm about to go into my living room to read a book (see previous post), but I wanted to continue to play my iTunes songs and control them. Then it dawned on me: I've got a lot of shell scripts to do this for me! Tucked away in ~/Documents/Stuff/MiscShellScripts (which I've added to my path) are little apps named nexttrack, resumetrack, prevtrack, pausetrack, and playtrack.
Their content? They range from being quite simple to a bit more complex. I've posted a few below.
My "pause" script is pretty simple:
#!/bin/sh osascript \ -e "tell application \"iTunes\"" \ -e " pause" \ -e "end tell"
My "nexttrack" script is a bit more complex:
#!/bin/sh osascript \ -e "tell application \"iTunes\"" \ -e " next track" \ -e " set x to name of current track & \" by \" & artist of current track & \"\"" \ -e " if player state is not playing then" \ -e " set x to x & \" [\" & player state as string & \"]\"" \ -e " end if" \ -e " set result to x" \ -e "end tell"
I'm off, safe in the knowledge that my PowerBook will serve as a fine remote for my desktop from the living room.
Posted 13 Apr 2003 at 5:08pm #
you could also use remote apple events and write a nice ASS interface for it.
or just download one of the many apps that do that.
Posted 13 Apr 2003 at 5:17pm #
I've always thought Blackhole Media's "Earphoria" was pretty cool:
http://www.blackholemedia.com/beta/
Unfortunately, it looks like they may have abandoned the project.
Posted 13 Apr 2003 at 6:03pm #
I did something similar. Except all in one parent shell script simply called itunes. Then I got tired of how slow osascript is and off loaded a lot of it to precompiled applescripts that echo their results via a do shell script command.
Posted 13 Apr 2003 at 10:23pm #
Yet another way to control iTunes remotely
I love the net... I was thinking of a way to do this today and voila! Here's the link: iTunes...
Posted 22 May 2003 at 8:40am #
I'm on a mailing list and the topic of AppleScript came up. I forget why, but I posted one of my "Terminal AppleScripts" (usig osascript)...
Posted 17 Oct 2003 at 6:29pm #
I wonder if there is any similar kind of functionality put into the windows version - obviously I don't have osascript
Posted 15 Nov 2003 at 4:15pm #
Here are some AppleScript tricks for your remote iTunes.
Posted 14 Dec 2003 at 9:11am #
I'd use synergy. Download the demo on download.com, it also shows pitures from amazon.com!
Posted 05 Feb 2005 at 3:33am #
There are enough programs that'd do that for you, for example this one. This one doesn't even use remote apple events (although there are programs that do it that way, too). These programs can do much more than your scripts, like playlist switching. And they're more user-friendly too. I don't know why you'd use those scripts.