Cutinplace.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(M)
Zeile 7: Zeile 7:
 
# cutinplace.sh
 
# cutinplace.sh
 
#
 
#
# Required: at, cutinplace
+
# add this line to your reccmds.conf:
 +
# folgende zeile in die reccmds.conf eintragen:
 
#
 
#
# add this lines to your reccmds.conf:
+
# cutinplace : /path_to_this_script/cutinplace.sh
# folgende zeilen in die reccmds.conf eintragen:
+
#
+
# cutinplace (at) : /path_to_this_script/cutinplace.sh -at
+
# cutinplace      : /path_to_this_script/cutinplace.sh -start
+
 
+
# CONFIG START
+
  MAX_IN_MB="600"  # max size -> cut without at
+
# CONFIG END
+
 
+
PATH=$PREFIX/bin:$PREFIX/sbin:$PATH
+
  
case "$1" in
+
MARKS=$(wc -l < "$1/marks.vdr" 2>/dev/null)
    -at)
+
if [ ${MARKS:-0} -lt 2 ] ; then
at now <<EOT
+
    echo $"No editing marks defined" ...
svdrpsend.pl -p ${VDR_PORT:-2001} MESG "Editing process started" >/dev/null
+
else
cutinplace "$2" >/dev/null
+
    if [ -s "${PIDFILE:=$1/cip.pid}" ] ; then
svdrpsend.pl -p ${VDR_PORT:-2001} MESG "Editing process finished" >/dev/null
+
read P < "$PIDFILE"
EOT
+
echo $"Editing process already active (pid: $P)" ...
;;
+
    else
    -start)
+
if pidof atd >/dev/null ; then
VAR=$(($(find "$2" -printf %k+)0))
+
    (
if [ "$((VAR/1024))" -gt "$MAX_IN_MB" ] ; then
+
echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG "$"Editing process started"" ... >/dev/null"
    echo "Record to large ($((VAR/1024))Mb -gt ${MAX_IN_MB}Mb), use better at..."
+
echo "cutinplace \"$1\" >/dev/null &"
 +
echo "PID=\$!"
 +
echo "echo \$PID > \"$PIDFILE\""
 +
echo "wait \$PID"
 +
echo "rm -f \"$PIDFILE\""
 +
echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG "$"Editing process finished"" ... >/dev/null"
 +
    ) | at now
 
else
 
else
    cutinplace "$2"
+
    echo $"Jobmanager (atd) is not running" ...
 
fi
 
fi
;;
+
    fi
esac
+
fi
 
</pre>
 
</pre>
 
}}
 
}}
  
 
[[Kategorie:Scripts]]
 
[[Kategorie:Scripts]]

Version vom 6. Januar 2006, 14:17 Uhr

Script für cutinplace.

Datei
$PATH/cutinplace.sh
#!/bin/sh
#
# cutinplace.sh
#
# add this line to your reccmds.conf:
# folgende zeile in die reccmds.conf eintragen:
#
# cutinplace : /path_to_this_script/cutinplace.sh

MARKS=$(wc -l < "$1/marks.vdr" 2>/dev/null)
if [ ${MARKS:-0} -lt 2 ] ; then
    echo $"No editing marks defined" ...
else
    if [ -s "${PIDFILE:=$1/cip.pid}" ] ; then
	read P < "$PIDFILE"
	echo $"Editing process already active (pid: $P)" ...
    else
	if pidof atd >/dev/null ; then
	    (
		echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG "$"Editing process started"" ... >/dev/null"
		echo "cutinplace \"$1\" >/dev/null &"
		echo "PID=\$!"
		echo "echo \$PID > \"$PIDFILE\""
		echo "wait \$PID"
		echo "rm -f \"$PIDFILE\""
		echo "svdrpsend.pl -p ${VDR_PORT:-2001} MESG "$"Editing process finished"" ... >/dev/null"
	    ) | at now
	else
	    echo $"Jobmanager (atd) is not running" ...
	fi
    fi
fi