Search

M y    b r a i n    h u r t s  !                                           w e                 r e a l l y                 t h i n k                   w h a t                y o u             k n o w

30 December 2008

Creating file timestamps

Here is a script that uses mplayer to dump a stream to a file with an appended timestamp.

Linux bash
mplayer  -dumpstream  -dumpfile flamenco_radio_`date +%b-%d-%Y_%H_%M_%S`.mp3 \
http://canalflamenco.rtva.stream.flumotion.com/rtva/canalflamenco.mp3.m3u
Windows batch
mplayer.exe  -dumpstream  -dumpfile bbc1_%date:~10,4%-%date:~4,2%-%date:~7,2%_%time:~0,2%-%time:~3,2%-%time:~6,2% \
mms://livewmstream-ws.bbc.co.uk.edgestreams.net/reflector:47971

ps. The Windows version is not very reliable since it will only work with the US locale. This script assumes the date format is set like this: Mon 04/31/2012. For locales that use different date formats the slicing will have to be adjusted accordingly.