PDA

View Full Version : Interview w/Dean @ perl.com



Dan Sully
2003-12-05, 18:45
http://www.perl.com/pub/a/2003/12/05/slimp3.html

-D
--
"My pockets hurt." -homer

Jason Snell
2003-12-05, 18:56
As a small bit penance for the off-topic nature of the flame war between myself and a certain unix sysadmin today, here's something for OS X people.

This is an applet you can run to set your iChat status to what's playing on your Slim Devices player.

You can download it from http://monkey.teevee.net/slimstatus.sit (21K)

Source is below, but you can just open the applet in Script Editor.

Requirements: iChat AV (sorry, folks, it's scriptable)

Edit the script to put in your own slimplayer URL and authentication (if any). By default it uses whatever your default player is. If you have more than one, edit the script to put in the MAC address of the player you want the script to control. got more than one player? Um, make a copy of the script and rename them accordingly, with the right MAC address in each one. Or e-mail me -- I've got a version that supports two players, but I am not a programmer and don't have the time right now to deconstruct it so that the one-player and two-player version are part of the same applet.

Feel free to send me feedback. I use this now and then. It's kind of fun to show people what I'm playing, and when I'm at home with my SliMP3 those iTunes-iChat tools just don't cut it!

-jason



-- set your player URL here
property slimplayer_server : {"http://slimserver:9000"}
--if you have more than one player, put the MAC address of the one you want to control here
property mac_player : {""}
--if you're using authentication, put the username and password here
property slimplayer_username : {""}
property slimplayer_password : {""}
property curlURL : {""}
property thePlayer : {""}

on run {}

-- build the URL for curl

if slimplayer_username is "" then
set url_authentication to ""
else
set url_authentication to (" -u " & slimplayer_username & ":" & slimplayer_password)
end if

set curlURL to (url_authentication & " -i " & slimplayer_server & "/status.txt" & "?player=" & mac_player)

end run

on idle

set the_data to do shell script "curl " & curlURL
set txtLst to every paragraph of the_data as list
repeat with i from 1 to number of items in txtLst
set this_item to item i of txtLst
if this_item contains "x-playerartist:" then set x_artist to find(this_item, ":")
if this_item contains "x-playertitle:" then set x_title to find(this_item, ":")
if this_item contains "x-playermode:" then set x_mode to find(this_item, ":")
-- insert other actions here
end repeat

if x_mode is "play" then
setStatus("" & x_artist & " - " & x_title)

else if x_mode is "pause" then
setStatus("(Paused) " & x_artist & " - " & x_title)

else if x_mode is "stop" then
setStatus("Slim Device Stopped")
else
setStatus("At Home")
end if

return 30

end idle

on find(an_item, the_offset)
set headerContent to (characters ((offset of the_offset in an_item) + 2) thru -1 of an_item) as string
return headerContent

end find


on setStatus(newStatus)
tell application "iChat" to set status message to newStatus
end setStatus

--
Jason Snell / Editor in Chief, Macworld / jsnell (AT) macworld (DOT) com
415-243-3565 / AIM-iChat: MW jsnell

Mark C. Langston
2003-12-05, 19:28
On Fri, Dec 05, 2003 at 05:56:54PM -0800, Jason Snell wrote:
> As a small bit penance for the off-topic nature of the flame war between myself and a certain unix sysadmin today, here's something for OS X people.


Similar apologies for the poor behavior elicited from myself by a
certain magazine editor, who feels it necessary to drag employment into
the discussion.


--
Mark C. Langston Sr. Unix SysAdmin
mark (AT) bitshift (DOT) org mark (AT) seti (DOT) org
Systems & Network Admin SETI Institute
http://bitshift.org http://www.seti.org

Mark C. Langston
2003-12-05, 19:29
Many apologies. Did that go to the list? It was supposed to only go
directly to Jason.

If only there were some easy way to ensure that didn't happen by
accident.

Oh, well.


--
Mark C. Langston Sr. Unix SysAdmin
mark (AT) bitshift (DOT) org mark (AT) seti (DOT) org
Systems & Network Admin SETI Institute
http://bitshift.org http://www.seti.org

Craig Brannan
2003-12-05, 20:39
Puleeze! grow up or get a life or both!!!

But mostly - JUST STOP.

Craig
On Dec 5, 2003, at 9:29 PM, Mark C. Langston wrote:

>
>
> Many apologies. Did that go to the list? It was supposed to only go
> directly to Jason.
>
> If only there were some easy way to ensure that didn't happen by
> accident.
>
> Oh, well.
>
>
> --
> Mark C. Langston Sr. Unix SysAdmin
> mark (AT) bitshift (DOT) org mark (AT) seti (DOT) org
> Systems & Network Admin SETI Institute
> http://bitshift.org http://www.seti.org
>