#!/bin/bash
# copyright Gregor Horvath <gh at gregor-horvath dot com>

# GNU GPL  
# http://www.gnu.org/licenses/gpl.html
# 

# Config --------------------------------------------------


DIR="/var/www/gh/oe1/"
URL="http://mp3stream3.apasf.apa.at:8000/"


case "$1" in
    -h|--help)

cat | less << 'EOD'
OE1_RIP(1)            User Manuals                OE1_RIP(1)




NAME
     oe1_rip - dumps oe1 Oesterreich 1 audio stream for a given duration and starting at a given date to spezific www folder using a name for the file name

SYNOPSIS
     oe1_rip [ --help | NAME START_TIME RECORDING_TIME ] 

DESCRIPTION
     oe1_rip uses radio_rip to rip the oe1 (Oesterreich 1) internet radio stream to a ogg file with the given name for the given duration
     starting at the given time.

     NAME 
         name of the ogg file (without extension ogg)
     START_TIME 
         The Time to Start the recording in at command syntax

     RECORDING_TIME 
         is the duration of the recording in minutes 

OPTIONS
     -h   print this help

EXAMPLES
     main program call
     oe1_rip pasticio20100120 09:00 55 

AUTHOR
     Gregor Horvath <gh at gregor-horvath dot com>

SEE ALSO
     radio_rip(1), at(1)

Linux                Last change: Januray 2010                    
EOD

		exit 0

	;;

    *)
   
        NAME=$1
        START=$2
	DURATION=$3
	
	echo "/usr/local/bin/radio_rip $DURATION $DIR$NAME.ogg $URL" | at $START
	;;
esac

