I am controlling iTunes via AppleScript and I am playing streams from an HTTP server. The code I’m using looks like this:
tell application "iTunes"
open location "your_url_here"
play
end tell
It works fine, but I would like to avoid those URLs to show up in the iTunes library or any playlist afterwards. Is there a trick to achieve that?
Have you considered using QuickTimePlayer to play the stream instead?
It should open all the iTunes formats, it comes as a default on OsX, it is more “minimal”, won’t save tracks.
(I know you specified you want to use iTunes so this might not be a solution, but being preinstalled software it was worth a try)
EDIT To have it hidden, this seems to work:
To close the stream either quit or close windows (just close if you plan to reopen):
If you hide it before opening the url, it doesn’t work (no idea why). Of course the window, even if invisible, is still open so if someone clicks on the dock icon it will show all the open windows.
If you don’t want to stop previous streams remove the first
repeat -- end repeatpart at the top, but leave theset numberOfWindows to (count windows)that is useless but activates the app without needing a activate/launch command