Hi all,
I'm working on a way of recording (logging) a radio station's output. At the moment, software is used that records in hour-long segments, which is absoutely fine for archiving purposes, but when presenters want to take their programmes and do things with it (ie, cut it down for podcasts or 'best-of's) then it gets a little awkward if a programme is over two files (for instance, the logger software cuts its file at the top of the hour, but the programme is broadcast between quarter to and quarter past the hour). It would be much more useful if the logger logged the output on a per-programme basis. I intend to use ALSA's 'arecord' to record the file - at the moment I've been playing with using 'streamripper' as the 'track' title changes depending on the programme (rather than the track being played) so that works fine to record, it just seems a little silly given that at the moment, the same computer that's running streamripper to do the logging is the one that's having the audio fed into it to send to the streaming servers!
The schedule is held in a mySQL database, and, as you'd expect, contains the start and end times of the programmes. However, it is not necessarily a standard time for recording. At the moment, a cron task runs a PHP script that connects to the database to update the website and the stream titles as well as collect listener statistics. This runs every ten minutes, so it's already extracting the data it needs.
However, how can I get 'arecord' to run at the correct time with the correct paramaters? So, if on the ten-minute cron task, I find that the next programme starts at 10.30, and is 45 minutes long, I'll need to set up 'arecord' to record at 10.28 for 49 minutes (I also want to add a couple of minutes either side just in case - on community, RSL, and student stations, presenters don't often keep to time!). But the next day, the 10.30 show may be 60 minutes long, or the show that started at 10 may run until 11. The PHP scrupt that runs every ten minutes gets all of this data, but how can I use that to schedule?
A scour of the Internet came up with two options, one was to get PHP to write to crontab, the other - that seemed closest to what I want - was from here, but that involves running a cron task every minute... surely that can't be a good way to do it? (The scour wasn't too successful, mostly because I wasn't entirely sure what I was exactly searching for!)
Any help would be gratefully received!
Bookmarks