For reasons I don't really understand, my Applescript doesn't work right when I try to grab song info from across my LAN. The technique I posted last night kept trying to connect to my daughter's iTunes instance, even though I was using my own login credentials. This was irritating, so I just went ahead and created a small Opentalk solution. I have a small UI running on the iMac with two buttons - one to start the listener, and one to stop it. I have the same retrieval Applescript as before (for the local case), and this code sets up the listener:
broker := RequestBroker newStstTcpAtPort: 9501.
broker start.
broker export: self oid: #itunes
On the client side, I set up a broker the same way (without the export), and then do this to invoke the remote API (the method that calls the Applescript and creates the formatted string):
| remote string |
remote := broker
remoteObjectToHost: settings machine
port: 9501
oid: #itunes.
string := remote getiTunesInfo.
That's about it - I've added a menu pick to fetch the info - it first looks at my local iTunes, and if that fails, it tries the remote one. There are plenty of failure cases I've ignored, but heck - I'm the only one using this code, and I know whether I'm listening to music before I try to fetch the info :)
Now Listening to: I Know Why by Sheryl Crow from: Wildflower
Technorati Tags:
smalltalk, applescript