Clipinc.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(clipinc.sh - v.0.2)
Zeile 1: Zeile 1:
#!/bin/sh
+
<pre>
#
+
#!/bin/sh
# clipinc.sh - v.0.2
+
#
#
+
# clipinc.sh - v.0.2
# add this lines to your [[reccmds.conf]]:
+
#
# folgende zeilen in die [[reccmds.conf]] eintragen:
+
# Requires : at, lame, ffmpeg ('--enable-mp3lame')
#
+
#
# Run clipinc        : /usr/local/bin/clipinc.sh -start
+
# add this lines to your reccmds.conf:
# Run clipinc + 2mp3 : /usr/local/bin/clipinc.sh -start -2mp3
+
# folgende zeilen in die reccmds.conf eintragen:
# Stop clipinc?      : /usr/local/bin/clipinc.sh -kill
+
#
+
# Run clipinc        : /usr/local/bin/clipinc.sh -start
# CONFIG START
+
# Run clipinc + 2mp3 : /usr/local/bin/clipinc.sh -start -2mp3
  AUDIO_CODEC=""    # force audio codec ('copy' to copy stream) -> default ('mp3')
+
# Stop clipinc?      : /usr/local/bin/clipinc.sh -kill
  AUDIO_BITRATE=""  # set audio bitrate (in kbit/s)             -> default ('192')
+
 
  AUDIO_SAMPLING=""  # set audio sampling rate (in Hz)           -> default ('44100')
+
# CONFIG START
# CONFIG END
+
  AUDIO_CODEC=""    # force audio codec ('copy' to copy stream) -> default ('mp3')
+
  AUDIO_BITRATE=""  # set audio bitrate (in kbit/s) -> default ('192')
PATH=$PATH:/usr/local/bin
+
  AUDIO_SAMPLING=""  # set audio sampling rate (in Hz) -> default ('44100')
+
# CONFIG END
case "$1" in
+
 
    -start)
+
PATH=/usr/local/bin:$PATH
        at now <<EOF
+
 
if [ -e "$2/recinfo.conf" ] ; then
+
case "$1" in
    clipinc.pl "$2"
+
    -start)
elif [ -e "$3/recinfo.conf" ] ; then
+
at now <<EOF
    clipinc.pl "$3"
+
if [ -e "$2/recinfo.conf" ] ; then
    find "$CLIPINCDIR" -name "001.vdr" | sed '/\.rec\/001\.vdr/!d' | while read i ; do
+
    clipinc.pl "$2"
        cd "\$(echo \$i | sed -e 's/.\{8\}$//g')"
+
elif [ -e "$3/recinfo.conf" ] ; then
        LABEL=\$(dirname "\$(pwd)")
+
    clipinc.pl "$3"
        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 -i 001.vdr -acodec ${AUDIO_CODEC:-mp3} -ab ${AUDIO_BITRATE:-192} -ar ${AUDIO_SAMPLING:-44100} "$CLIPINC2DIR/\${LABEL##*/}.mp3" &
+
LABEL=\$(dirname "\$(pwd)")
        fi
+
find "\$CLIPINC2DIR" -type f -empty -exec rm -vf '{}' ';'
        wait
+
if [ ! -e "\$CLIPINC2DIR/\${LABEL##*/}.mp3" -a -f 001.vdr ] ; then
    done
+
    ffmpeg \
else
+
-i 001.vdr -acodec ${AUDIO_CODEC:-mp3} -ab ${AUDIO_BITRATE:-192} -ar ${AUDIO_SAMPLING:-44100} "$CLIPINC2DIR/\${LABEL##*/}.mp3" &
    svdrpsend.pl MESG "recinfo.conf not found..."
+
fi
fi
+
wait
EOF
+
    done
        ;;
+
else
    -kill)
+
    svdrpsend.pl MESG "recinfo.conf not found..."
        killall vdrcut clipinc.pl
+
fi
        ;;
+
EOF
esac
+
;;
 +
    -kill)
 +
PID=`pidof -x clipinc.pl`
 +
eval ${PID:+kill -9 $PID}
 +
;;
 +
esac
 +
</pre>
  
 
[[Kategorie:Scripts]]
 
[[Kategorie:Scripts]]

Version vom 4. März 2005, 11:24 Uhr

#!/bin/sh
#
# clipinc.sh - v.0.2
#
# Requires : at, 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')
# 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"
    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 -vf '{}' ';'
	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
else
    svdrpsend.pl MESG "recinfo.conf not found..."
fi
EOF
	;;
    -kill)
	PID=`pidof -x clipinc.pl`
	eval ${PID:+kill -9 $PID}
	;;
esac