Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use iCal to schedule recording of WMA radio streams Apps
After seeing this hint, I thought it should be possible to use iCal to schedule recording of WMA radio streams. With a bit of trial and error, I have put together an AppleScript to do just that. I think I should make my contribution to MacOSXHints as well, so here's the hint...

Installation:
  1. Install VLC.
  2. Save this script in ~/Library/Scripts, the normal spot for saving personal scripts. Name it 'Record Radio.scpt'
  3. In iCal, create a new calendar called 'Record Radio'
To schedule a recording:
  1. Create a new event under 'Record Radio' whose From and To covers the actual period you want to record.
  2. Enter the station name into event name, e.g. CR1, RTHK2, or enter the mms:// URL into the URL field. In this case, the event name can be anything.
  3. Set alarm to Run Script, and point it to the Record Radio script, set to '0 minutes before.'
When the iCal event kicks off, it will:
  1. Start VLC to record in AAC format.
  2. Import the recording into iTunes afterwards.
  3. Clean up the temp recording file.
Optional step: You will not be able to use iCal when the script is running. To get around this, you can:
  1. In Script Editor, save the script as an application. Do not forget to uncheck the 'Start Screen' option.
  2. In the iCal event, set alarm to Open File, and point to the new Record Radio.app you just created, at '0 minutes before.'
As this is my first ever AppleScript, any suggestions to make it better would be very welcome.
    •    
  • Currently 2.80 / 5
  You rated: 5 / 5 (5 votes cast)
 
[21,452 views]  

Use iCal to schedule recording of WMA radio streams | 7 comments | Create New Account
Click here to return to the 'Use iCal to schedule recording of WMA radio streams' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use iCal to schedule recording of WMA radio streams
Authored by: leenoble_uk on Sep 02, '05 10:46:12AM

Thanks for the VLC tip. I never realised it could record streams. I've been capping radio shows for years using iCal, Windows Media Player and WireTap (not WireTap Pro, the old version is more scriptable).

I have 2 scripts though and set two alarms per show, one for starting and one for stopping. Your script will save me a ton of drive space as I'm having to record to AIFF at the moment. I'll incorporate the VLC bit it into my existing scripts instead though.

I never bothered to make my scripts public because of the necessity of getting hold of WireTap and UI scripting WMP to make it work. As your can be done without UI Scripting it should be more reliable.

I do have a bunch of scripts though which I may make use of to edit the resultant files because the new QT interface is horrible. It's not possible for example to stop the playhead and then move the selection sliders to the playhead position using the GUI. I've tried all sorts of key combinations to get the sliders to move without the playhead following but none work. Now with AppleScript and Salling Clicker I can edit files very easily just tapping phone keys.

---
So, I said ... well, I can't actually remember exactly what I said. But it was one of the most enormously cruel and frighteningly witty put downs ever.



[ Reply to This | # ]
Use iCal to schedule recording of WMA radio streams
Authored by: rjbailey on Sep 02, '05 07:26:32PM

Man, this is my biggest gripe with VLC: I read about all the wonderful things it does but I can't for the life of me figure out how to do them. I searched in vain on the VLC website for the exact command line options offered in this hint. Grrrr...



[ Reply to This | # ]
Lengthen the delay before quiting VLC on longer recordings
Authored by: strutton on Sep 09, '05 08:19:57AM
It may just be my computer, but I was having trouble using the above script to record long shows, greater than an hour. I found that the time need to wait for VLC to finish saving the file was greater than the code allows. VLC will quit on command regardless of the state of the recorded file....

In my test I found that a 40+ min recording took over 25 sec to close the file. Not sure how this differs in length, but I added plenty of time to the delay as seen below:
 
tell application "VLC"
		stop
		-- wait 220 seconds to let saving finish
		delay 220
Also I found that some radio stations have a starting URL that actually contains multiple URLs example WSB in Atlanta http://www.streamaudio.com/stations/asx/WSB_AM.asx they do this to rotate audio ads before the stream, as well as the radio stream that follows appears to differ each day maybe to prevent you from saving that URL and missing their ad. Anyway for some reason my VLC client will hang up on the last 10-5 seconds of the ad and not move on to the stream. So when recording these stations I have to tell VLC to go to the next track in the script.

Hope this helps,
-mike

[ Reply to This | # ]
Use iCal to schedule recording of WMA radio streams
Authored by: mbelchuk on Oct 30, '05 01:56:59PM

It seems that since upgrading to iTunes 6 the recordings from this hint no longer appear in the iTunes library. Nothing appears to happen and iTunes does not seem to acknowledge that anything was done. The recorded files can be located, however, in the iTunes music folder and they play just fine with VLC and QuickTime. It's just that iTunes won't play them.

While I haven't figured out exactly why the hint broke, I have found a way around it. Here's an excerpt of my revised script.

set tempfile to (system attribute "HOME") & "/Desktop/Recording" & radio_station & ".mp3"
do shell script "/Applications/VLC.app/Contents/MacOS/VLC -q " & radio_URL & " --sout='#transcode{acodec=mp3,ab=64,channels=2}:standard{access=file,mux=wav,url=" & tempfile & "}' &> /dev/null &"

-- sleep till end_date
set duration to (end_date - (current date))
delay duration

-- stop recording
tell application "VLC"
stop
-- wait 10 seconds to let saving finishes
delay 10
quit
end tell

To summarize what I've done. First, I instructed VLC to save the captured audio in a MP3 format. Secondly, I extended the time allowed to save the file.


---
mbee



[ Reply to This | # ]
Use iCal to schedule recording of WMA radio streams
Authored by: mamaway on Nov 16, '05 11:16:40AM
Thanks for the mp3 tip. All I had to do to get the entire script to work from there was change:
tell application "iTunes" launch set new_track to add (tempfile as POSIX file) to playlist "Library" of source "Library"
to:
tell application "iTunes" launch set new_track to add (tempfile as POSIX file) to playlist "RadioRecordings"
And make that playlist of course.

[ Reply to This | # ]
Use iCal to schedule recording of WMA radio streams
Authored by: dieter2 on Feb 18, '06 02:44:41PM

I've tried this on two different machines (an old ibook running 10.3 and a less old Quicksilver running 10.4.4). While this worked fine on the ibook, I found that on the quicksilver I needed to change "mux=wav" to "mux=raw" -- the latter is usually available through the VLC GUI for recording, so it may be more correct. Anyway, try it if you run into trouble.

Other lessons learned: As noted in the original post, don't set the iCal alarm to go off before the event. This causes failures. Also, if you're having trouble getting the script to work, modify the error dialogue to actually display the error information -- obvious, I suppose, but it helps.



[ Reply to This | # ]
Use iCal to schedule recording of WMA radio streams
Authored by: dieter2 on Feb 20, '06 04:41:48AM

Has anybody else found VLC to be kind of unreliable, at least as used here? I think I successfully record maybe 50% of the time. I've fiddled with the delay and such -- I think that the stream gets interrupted, and VLC isn't smart enough to try to pick it up again. Is there a switch to make it more persistent?



[ Reply to This | # ]