LadioCast automation (AppleScript)
Playing music is fun, LadioCast is an awesome tool that lets you broadcast ANY audio from your soundcard to an icecast server. It also lets you mix from multiple sources. Being a simple tool it doesn't grab it's own metadata info or anything fancy like that. There are several common ways to update this info and they're covered other places online. Below I've included my own ladiocast_update script that adds a bit extra to the metadata mix.
Sometimes you want to play a stream for a bit and then drop offline cleanly, but you don't want to hang around to wait for it to finish (sleep is awesome once or twice a month).
Through the magic of AppleScript you can do this. [We can have platform debates later, my whole broadcast kit is in osx right now, get over it.]
This script queries iTunes for the current state (playing, paused, stopped). If the stream is seen playing or paused it updates the metadata in ladiocast with the info from the currently playing track. If it finds that it has stopped it plays the "radio off" playlist (used to give a sign-off message), waits a little bit (for the message to finish) and then kills the stream.
ladiocast_update
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | set lastName to "" set lastArtist to "" set lastAlbum to "" set currentState to "" tell application "iTunes" repeat set currentState to player state if currentState is stopped then play playlist "radio off" delay 10 tell application "LadioCast" disconnect 1 end tell exit repeat else set trackName to name of current track set trackArtist to artist of current track set trackAlbum to album of current track if trackName is not lastName or trackArtist is not lastArtist or trackAlbum is not lastAlbum then set lastName to trackName set lastArtist to trackArtist set lastAlbum to trackAlbum tell application "LadioCast" set metadata song to trackArtist & " - " & trackName end tell end if end if delay 15 end repeat end tell |