I messed around with the Applescript below (found via James's link above) and could not get it to work. My incompetence is the likely culprit, but it could also be that SlimServer and/or iTunes have changed enough since late '04 that it just don't work.
Should the below script still work as originally designed? Spousal ambivalence has turned into downright hostility, and being able to use iTunes as the interface is the key to bringing her 'round. TIA, Alex Old 2004-10-02, 11:12 Anton F. van der Kraaij Posts: n/a Default Control SlimServer _from_ iTunes Hi Everyone, Well I think I have a solution for my problem. This applescript will check if a song is playing in iTunes. If that is the case, it will play it in the SlimServer. There is a check made for special symbols in filenames. My guess is that some symbols are not fully supported yet (it works for my library so far). Save it as an application and don't forget to tick the 'stay open' checkbox. Probably still bugs or features missing, but it is a start :-) Hope this helps. Oscar, thanks for your help and the link to the old post. Greetings, Anton. -- Begin of Script -- iSlimServer: Control SlimServer from iTunes -- Plays whatever song is currently playing in iTunes on the SlimServer -- Copyright Anton F. van der Kraaij 2004 -- Thanks to a script by Barry Brown for inspiration and help from Oscar Marsch -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- INSTRUCTIONS: -- Set your variables server_address and server_port to your situation -- Save this script as an application, making sure to click 'stay open' global server_address, server_port, current_file_track set server_address to "127.0.0.1" -- This is the slimserver's address set server_port to "9000" -- This is the slimserver's port set current_file_track to "" on idle try tell application "Finder" if (get name of every process) contains "iTunes" then set okflag to true end tell if okflag then -- iTunes is running. Check if it is playing a song. tell application "iTunes" if player state is paused or player state is stopped then -- iTunes is not playing. Stop slimserver. do shell script ("curl \"http://" & server_address & ":" & server_port & "/status.html?p0=stop\"") set okflag to false return 10 end if end tell end if if okflag then tell application "iTunes" if class of current track is file track then try copy current track's location to file_path_of_track on error errText display dialog errText buttons {"Cancel"} with icon 0 end try end if -- not a file track -- return file_path_of_track if (current_file_track is not file_path_of_track) then -- File in iTunes is different than file on SlimServer. -- Thus update variable set current_file_track to file_path_of_track -- convert mac path to unix path for use in URL with curl (be careful with special characters here) set mac_path to (file_path_of_track as text) set root to (offset of ":" in mac_path) set rootdisk to (characters 1 thru (root - 1) of mac_path) tell application "Finder" if (disk (rootdisk as string) is the startup disk) then set unixpath to "%2f" & (characters (root + 1) thru end of mac_path) else set unixpath to "%2fVolumes:" & mac_path end if end tell set chars to every character of unixpath repeat with i from 2 to length of chars if item i of chars as text is equal to "/" then set item i of chars to ":" else if item i of chars as text is equal to ":" then set item i of chars to "%2f" else if item i of chars as text is equal to "\"" then set item i of chars to "\\" & "\"" else if item i of chars as text is equal to "*" then set item i of chars to "\\*" else if item i of chars as text is equal to "?" then set item i of chars to "\\?" else if item i of chars as text is equal to " " then set item i of chars to "%20" else if item i of chars as text is equal to "+" then set item i of chars to "%2b" else if item i of chars as text is equal to "&" then set item i of chars to "%26" else if item i of chars as text is equal to "\\" then set item i of chars to "\\\\" end if end repeat set filetoplay to every item of chars as string -- end conversion -- Tell slimserver to stop current song and play the song currently playing in iTunes do shell script ("curl \"http://" & server_address & ":" & server_port & "/status.html?p0=stop\"") do shell script ("curl \"http://" & server_address & ":" & server_port & "/status.html?p0=playlist&p1=play&p2=" & filetoplay & "\"") end if end tell end if end try return 10 end idle -- end of script -- alexfw ------------------------------------------------------------------------ alexfw's Profile: http://forums.slimdevices.com/member.php?userid=2197 View this thread: http://forums.slimdevices.com/showthread.php?t=26165 _______________________________________________ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss