Linux + TV-Karte: Festplattenvideorecorderskript
            
                
                    2005-01-08 02:16
                
            
        
        Wolf
    
        Dieses Skript nimmt innerhalb der nächsten 24h Sachen von der TV-Karte auf.
Copy&Paste in Datei "xawtv-recorder", ausführbar machen, testen, modifizieren…
Edit: Ist nicht aktuell.
    Copy&Paste in Datei "xawtv-recorder", ausführbar machen, testen, modifizieren…
#!/bin/bash
# this script starts and ends recording via xawtv at given
# times
# Wolf wrote it, you may use and modify it. call it Public Domain
# programs needed: xawtv, xawtv-remote, xine,  aumix, date, bash,
#                  killall 
startrecording () { (
        # adjust audio levels for recording
                aumix -l R -l 80 -i 80
        # kill all other instances of xawtv
                xawtv-remote quit >& /dev/null
                sleep 0,5
        # we'll need a xawtv without xvideo extension
        # you won't be able to watch while recording!
                xawtv -noxv -geometry 480x360+0+0 >& /dev/null &
                sleep 1
        # the settings for the file are applied
        # modify to reduce filesize
                xawtv-remote movie driver avi
                xawtv-remote movie video mjpeg
                xawtv-remote movie fps 30.0
                xawtv-remote movie audio stereo
                xawtv-remote movie rate 44100
                xawtv-remote movie fvideo $FILENAME
                xawtv-remote capture overlay
                sleep 0,5
        # the recording begins
                xawtv-remote movie start
                sleep 0,5
                checkend
);
}
endrecording () { (
                sleep 0,5
                xawtv-remote movie stop
                aumix -i 0 -v R
                sleep 0,5
                xawtv-remote quit
                echo "Done!"
);
}
checkend () { (
        echo "Recording... Ending time is $REC_END"
        if ( expr $REC_END == NOT_DEFINED >& /dev/null ); then ( echo "To end recording, press CTRL-C" ); fi
                while ( expr 1 = 1 >& /dev/null ); do (
                        NOW=$( date +%H.%M )
                        echo -ne $NOW"."$( date +%S )"\r"
                        if ( expr $NOW == $REC_END >& /dev/null ); then
                                ( echo -e "\nEnding record..." ; endrecording
                                  echo -e "Press any key for replay or press q to quit"
                                  read -s -n 1 CRABBLEDABBLE
                                  if ( expr a$CRABBLEDABBLE == aq >& /dev/null ); then
                                          (
                                          echo "The written file is ~/$FILENAME"
                                          killall xawtv-recorder >& /dev/null );
                                  fi
                                  echo "Playing $FILENAME ..."
                                  xine ~/$FILENAME >& /dev/null
                                  echo "The written file is ~/$FILENAME"
                                  killall xawtv-recorder >& /dev/null
                                ); else ( sleep 15 ); fi
                ); done
);
}
countdown () { (
        clear
        echo "Countdown is running. Target time: $REC_START"
while ( expr 1 = 1 >& /dev/null ); do (
        NOW=$( date +%H.%M )
        echo -ne $NOW"."$( date +%S  )"\r"
        if ( expr $NOW == $REC_START >& /dev/null ); then
                ( echo -e "\nStarting to record..." ; startrecording );
                else ( sleep 15 ); fi
); done
); }
# Here we go...
echo "This is --------------------  xawtv-recorder  ------------------------"
echo -e "\nTip 1: Let the recording start 1 minute too early and end 1 minute late."
echo -e "Tip 2: If you mistype something, press CTRL-W instead of BACKSPACE.\n"
echo "Assure that your computer clock works correctly to get precise results."
echo "To do that, just compare the output of date with an online date-/time-"
echo -e "service.\n"
echo "The given times have to be in hh.mm format. Otherwise, the program will"
echo "never start / end recording. 01.35 is valid, 1:35 not."
echo -e "Same goes for hour format: It has to be a number from 00 to 23.  No am/pm.\n"
echo "You may also type nothing and press ENTER to immediately start recording."
echo -ne "\nStarting Time ( hh.mm ) : "
read -n 5 REC_START
if ( expr a$REC_START == a >& /dev/null ); then (
        echo "The File is called: rip.avi. It is located in your ~/"
        echo "Don't forget to rename it to avoid accidental overwriting!"
        echo "To end the recording, just press CTRL-C. Don't panic, it'll work ;)"
        REC_START=$( date +%H.%M )
        REC_END=NOT_DEFINED
        FILENAME=rip.avi
        countdown );
        else ( IMMEDIATE=0 ); fi
echo -ne "\nEnding Time ( hh.mm ) : "
read -n 5 REC_END
echo -e "\n\nThe File will be saved to your homedir."
echo -ne "Filename ( automatic extension: .avi ) : "
read FILENAME
EXTENSION=.avi
FILENAME=$FILENAME$EXTENSION
countdown
Edit: Ist nicht aktuell.
