 |
 |
Terminal based iTunes control?
|
 |
|
 |
|
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status:
Offline
|
|
Does such a thing exist? Perhaps using applescript's cli implementation?
kman
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
Use osascript.
Code:
#!/bin/sh
osascript << EOF
tell application "iTunes"
play
end tell
EOF
You can do anything with osascript that you can do in the Script Editor.
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2001
Location: FL
Status:
Offline
|
|
Originally posted by kman42:
Does such a thing exist? Perhaps using applescript's cli implementation?
kman
I respect the question but that seems like a ludicrous waste of time compared to mapping iTunes controlling scripts to function keys.
|
|
sandman
17" PowerBook/OS X.4.2/60GB/1G/Airport Express/iPod 20GB (Click Wheel)
|
| |
|
|
|
 |
|
 |
|
Banned
Join Date: Jul 2002
Location: The end of a catwalk with no way out but down.
Status:
Offline
|
|
Ya, I really have to know why anyone would want to do this?
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Sep 2001
Location: NYC*Crooklyn
Status:
Offline
|
|
to become more pathetically geeky and repel girls prpbably
and you can't go to the dock and click itunes and press spacebar for what reason instead of typing all that code because?
anyway, i'm not flaming
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Status:
Offline
|
|
Imagine, perhaps, that iTunes is playing mp3s on a machine up in your attic connected to the Big Speakers, which you control from your laptop via airport...
|
|
[vash:~] banana% killall killall
Terminated
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
Originally posted by Arkham_c:
Use osascript.
Code:
#!/bin/sh
osascript << EOF
tell application "iTunes"
play
end tell
EOF
You can do anything with osascript that you can do in the Script Editor.
Cool, thanks. I just set up 3 scripts: play/pause, next and previous. It might be cool to create some sort of interface for this other than just running apps, maybe call it textTunes or something. It would be a real terminal application that would install in /usr/bin and when launched it will display the current track info, and have the controls explained for controling playback, volume (with indicator of current volume) and possibly a way to browse for what songs to play. I may look into this project.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2001
Location: ~/
Status:
Offline
|
|
I'll try to find the link and post it but a dude wrote some perl scripts to control iTunes and used a web page as an interface. The reason for it was to control iTunes running on an iBook hooked up to the stereo system from anywhere in the house via Airport. A very cool hack indeed.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2001
Status:
Offline
|
|
Actually I'll be implementing something quite similiar to what kman described. I'm going to install linux on an old PowerMac 7500, run it headless, hook it up to my amplifier and control it via ethernet using my iBook. It'll work as a simple mp3 server.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
In my experience with linux on my 6400 the sound server (or what ever its called) kept crashing after I tried to play any mp3 for more than a second. I gave up on linux. I tried getting SoundJam to work with my scripts but I couldn't get it working with scripts remotely. I don't know what I was doing wrong. This was over a year ago.
However I like the idea of this textTunes thing because it can provide a pretty powerful interface that I can access from other machines not just Macs. I guess a web interface would also be cool but the problem with a web interface is that it needs to be running at all times while waiting for a connection. A terminal application just needs to be launched when you want to use it. I've found that applescript applications, especially those that are constantly polling iTunes (like KungTunes) can suck up processor time. I would like to avoid that as much as possible.
However I was wondering if anyone knows how I can print out some info to the terminal using osascript. Like if I wanted to write a script that showed the current track, how can I get that text into the terminal?
Thanks.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Sep 2000
Location: Cupertino, CA USA
Status:
Offline
|
|
Very easy to do and built into Mac OS X.
1) set up the user from the sending computer as a user on the computer running iTunes
2) turn on Program Linking on the iTunes computer (Sharing Prefs Pane)
Here's a sample script:
using terms from application "iTunes"
tell application "iTunes" of machine "eppc://12.203.33.555"
play
end tell
end using from
You can control any Mac over IP, even over the Intenet!
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
OK I've got this working (except the year part doesn't work). Its a bit messy, do what you wish with it:
Code:
line_1='tell application "iTunes"'
line_2='get the name of the current track'
line_3='end tell'
line_4='get the album of the current track'
line_5='get the artist of the current track'
line_6='get the year of the current track as text'
track_name=`osascript -e "$line_1" -e "$line_2" -e "$line_3"`
track_artist=`osascript -e "$line_1" -e "$line_5" -e "$line_3"`
track_album=`osascript -e "$line_1" -e "$line_4" -e "$line_3"`
track_title=`osascript -e "$line_1" -e "$line_6" -e "$line_3"`
echo "Current track: $track_name by $track_artist from $track_album
($track_year)"
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2001
Status:
Offline
|
|
Originally posted by Sal:
Very easy to do and built into Mac OS X.
1) set up the user from the sending computer as a user on the computer running iTunes
2) turn on Program Linking on the iTunes computer (Sharing Prefs Pane)
Here's a sample script:
using terms from application "iTunes"
tell application "iTunes" of machine "eppc://12.203.33.555"
play
end tell
end using from
You can control any Mac over IP, even over the Intenet!
Could I in theory then control an OS9 machine running iTunes via the terminal of my iBook over ethernet?
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Location: London
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2001
Status:
Offline
|
|
You sweet sweet sweet sweet man. This solves all my problems, now i can run my 7500 as a headless mp3 server and control it over ethernet. I'm not sure how good your app is, but i'm sure it'll do the job. Any chance of some screen grabs? I'm stuck on a pc here for a while.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Location: London
Status:
Offline
|
|
Originally posted by ShotgunEd:
You sweet sweet sweet sweet man. This solves all my problems, now i can run my 7500 as a headless mp3 server and control it over ethernet. I'm not sure how good your app is, but i'm sure it'll do the job. Any chance of some screen grabs? I'm stuck on a pc here for a while.
It was very quickly put together and only uses one thread - so if the applescript messages don't reach the target - the app will beachball for about a minute.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jan 1999
Location: California - Bay Area
Status:
Offline
|
|
Originally posted by Emotionally Fragile Luke:
Ya, I really have to know why anyone would want to do this?
I know I had used it for a server-side language that wouldn't allow me to do AppleScript, but would let me execute shell commands.
Became a moot point after getting the SHOUTcast server set up, though. 
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Sep 2000
Location: Cupertino, CA USA
Status:
Offline
|
|
Originally posted by ShotgunEd:
Could I in theory then control an OS9 machine running iTunes via the terminal of my iBook over ethernet?
Yes. Remote Apple Events (Program Linking) has been around since Mac OS 8. It's a very powerful and useful technology used by customers who have kiosk networks. IP support was added in Mac OS 9 allowing control of computers over the Internet and wireless networks.
Sal
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jan 2002
Location: Germany
Status:
Offline
|
|
Just for the sake of completeness:
If you are using a Mac running Mac OS X as your MP3-server the following tool comes in handy:
acgi dispatcher
This tool enables you to use AppleScript CGIs on the client version of Mac OS X (Mac OS X Server can do it out of the box...). And included is a very nice sample script, which allows you to control iTunes from every computer in your network, yes, also PCs. It works like a charm.
AppleScript rulez
Searching my glasses,
Martin
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
I've been remote-scripting iTunes since well before version 2 was released (there was a hack to get SoundJam's AppleScript dictionary back into iTunes 1 in OS 9). Right now I've got my iBook set up to control my Pismo (essentially a desktop now) using keyboard shortcuts assigned to scripts. I'm now more interested in complete terminal control of iTunes, and I think I'm going to work that out. I'll post again when I have something completed.
However one gripe that I do have is that AppleScript seems to be pretty slow. Its very frustrating.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2001
Location: Minneapolis, MN
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2002
Status:
Offline
|
|
Diggory, Rex The Runt rules!!
http://www.monkeyfood.com/software/vince/
my mother thought wendys breast were her cheeks! bless...
oops, it appears i've derailed the thread.
oh well, it happens sometimes.
sorry.

|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2001
Status:
Offline
|
|
Originally posted by :XI::
Diggory, Rex The Runt rules!!
http://www.monkeyfood.com/software/vince/
my mother thought wendys breast were her cheeks! bless...
oops, it appears i've derailed the thread.
oh well, it happens sometimes.
sorry.
I'm re-railing it now. That iHam app looks class but I'll have to update my 7500 to 8.6 to be able to run it. I'll fiddle a little, at least now I don't have to bother with linux to get a nice remote controllable mp3 server on the go.
Waffffle keep us updated with your progress, I'm interested in your findings. Keep them in here or mail me to rossneely at mac dot com
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|