Clipinc.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(M)
Zeile 2: Zeile 2:
 
#!/bin/sh
 
#!/bin/sh
 
#
 
#
# clipinc.sh - v.0.2
+
# clipinc.sh
 
#
 
#
# Requires : at, lame, ffmpeg ('--enable-mp3lame')
+
# Required: at, clipinc.pl, lame, ffmpeg ('--enable-mp3lame')
 
#
 
#
 
# add this lines to your reccmds.conf:
 
# add this lines to your reccmds.conf:
Zeile 14: Zeile 14:
  
 
# CONFIG START
 
# CONFIG START
   AUDIO_CODEC=""             # force audio codec ('copy' to copy stream) -> default ('mp3')
+
   AUDIO_CODEC=""     # force audio codec ('copy' to copy stream) -> default ('mp3')
   AUDIO_BITRATE=""           # set audio bitrate (in kbit/s) -> default ('192')
+
   AUDIO_BITRATE=""   # set audio bitrate (in kbit/s) -> default ('192')
   AUDIO_SAMPLING=""         # set audio sampling rate (in Hz) -> default ('44100')
+
   AUDIO_SAMPLING="" # set audio sampling rate (in Hz) -> default ('44100')
   CLIPINCDIR="/video/clips"  # where to store the clips
+
   CLIPINC_LOGFILE="/var/log/vdr/clipinc.log"
  CLIPINC2DIR="/mp3/clips"   # where the mp3s should go
+
 
# CONFIG END
 
# CONFIG END
+
 
 
PATH=/usr/local/bin:$PATH
 
PATH=/usr/local/bin:$PATH
  
Zeile 30: Zeile 29:
 
elif [ -e "$3/recinfo.conf" ] ; then
 
elif [ -e "$3/recinfo.conf" ] ; then
 
     clipinc.pl "$3"
 
     clipinc.pl "$3"
     find "$CLIPINCDIR" -name "001.vdr" | sed '/\.rec\/001\.vdr/!d' | while read i ; do
+
     if [ $(ffmpeg -formats | egrep -c "Output audio/video file formats:.*[ ]mp3[ ]|Encoders:.*[ ]mp3[ ]") -ne 2 ] ; then"
cd "\$(echo \$i | sed -e 's/.\{8\}$//g')"
+
echo "Unsupported codec, 'configure' ffmpeg with ('--enable-mp3lame')..."
LABEL=\$(dirname "\$(pwd)")
+
    else
find "\$CLIPINC2DIR" -type f -empty -exec rm -vf '{}' ';'
+
find "$CLIPINCDIR" -name "001.vdr" | sed '/\.rec\/001\.vdr/!d' | while read i ; do
if [ ! -e "\$CLIPINC2DIR/\${LABEL##*/}.mp3" -a -f 001.vdr ] ; then
+
    cd "\$(echo \$i | sed -e 's/.\{8\}$//g')"
    ffmpeg \
+
    LABEL=\$(dirname "\$(pwd)")
-i 001.vdr -acodec ${AUDIO_CODEC:-mp3} -ab ${AUDIO_BITRATE:-192} -ar ${AUDIO_SAMPLING:-44100} "$CLIPINC2DIR/\${LABEL##*/}.mp3" &
+
    find "\$CLIPINC2DIR" -type f -empty -exec rm -f '{}' ';'
fi
+
    if [ ! -e "\$CLIPINC2DIR/\${LABEL##*/}.mp3" -a -f 001.vdr ] ; then
wait
+
ffmpeg \
    done
+
    -i 001.vdr -acodec ${AUDIO_CODEC:-mp3} -ab ${AUDIO_BITRATE:-192} -ar ${AUDIO_SAMPLING:-44100} "$CLIPINC2DIR/\${LABEL##*/}.mp3" &
 +
    fi
 +
    wait
 +
done
 +
    fi
 
else
 
else
 
     svdrpsend.pl MESG "recinfo.conf not found..."
 
     svdrpsend.pl MESG "recinfo.conf not found..."
fi
+
fi \
 +
> $CLIPINC_LOGFILE 2>&1
 
EOF
 
EOF
 
;;
 
;;

Version vom 30. März 2005, 11:20 Uhr

#!/bin/sh
#
# clipinc.sh
#
# Required: at, clipinc.pl, lame, ffmpeg ('--enable-mp3lame')
#
# add this lines to your reccmds.conf:
# folgende zeilen in die reccmds.conf eintragen:
#
# Run clipinc        : /usr/local/bin/clipinc.sh -start
# Run clipinc + 2mp3 : /usr/local/bin/clipinc.sh -start -2mp3
# Stop clipinc?      : /usr/local/bin/clipinc.sh -kill

# CONFIG START
  AUDIO_CODEC=""     # force audio codec ('copy' to copy stream) -> default ('mp3')
  AUDIO_BITRATE=""   # set audio bitrate (in kbit/s)		 -> default ('192')
  AUDIO_SAMPLING=""  # set audio sampling rate (in Hz)		 -> default ('44100')
  CLIPINC_LOGFILE="/var/log/vdr/clipinc.log"
# CONFIG END

PATH=/usr/local/bin:$PATH

case "$1" in
    -start)
	at now <<EOF
if [ -e "$2/recinfo.conf" ] ; then
    clipinc.pl "$2"
elif [ -e "$3/recinfo.conf" ] ; then
    clipinc.pl "$3"
    if [ $(ffmpeg -formats | egrep -c "Output audio/video file formats:.*[ ]mp3[ ]|Encoders:.*[ ]mp3[ ]") -ne 2 ] ; then"
	echo "Unsupported codec, 'configure' ffmpeg with ('--enable-mp3lame')..."
    else
	find "$CLIPINCDIR" -name "001.vdr" | sed '/\.rec\/001\.vdr/!d' | while read i ; do
	    cd "\$(echo \$i | sed -e 's/.\{8\}$//g')"
	    LABEL=\$(dirname "\$(pwd)")
	    find "\$CLIPINC2DIR" -type f -empty -exec rm -f '{}' ';'
	    if [ ! -e "\$CLIPINC2DIR/\${LABEL##*/}.mp3" -a -f 001.vdr ] ; then
		ffmpeg \
		    -i 001.vdr -acodec ${AUDIO_CODEC:-mp3} -ab ${AUDIO_BITRATE:-192} -ar ${AUDIO_SAMPLING:-44100} "$CLIPINC2DIR/\${LABEL##*/}.mp3" &
	    fi
	    wait
	done
    fi
else
    svdrpsend.pl MESG "recinfo.conf not found..."
fi \
> $CLIPINC_LOGFILE 2>&1
EOF
	;;
    -kill)
	PID=`pidof -x clipinc.pl`
	eval ${PID:+kill -9 $PID}
	;;
esac