Installscript-recording-cmds

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(Bsp (epg): M)
(Bsp (noad): M)
Zeile 41: Zeile 41:
 
# 1 means online for live-recording only
 
# 1 means online for live-recording only
 
# 2 means online for every recording
 
# 2 means online for every recording
ONLINEMODE="--online=1"
+
ONLINEMODE="1"
  
 
# set additional args for every call here here
 
# set additional args for every call here here
Zeile 49: Zeile 49:
 
     *before-*)
 
     *before-*)
 
case $START in
 
case $START in
    2) logit $0 "EXEC -> $CHECK $1 $2 $ONLINEMODE $ADDOPTS"
+
    2) logit $0 "EXEC -> $CHECK $1 $2 $ADDOPTS --online=$ONLINEMODE"
noad $1 "$2" $ONLINEMODE $ADDOPTS
+
noad $1 "$2" $ADDOPTS --online=$ONLINEMODE
 
;;
 
;;
 
    *) logit $0 "OFF -> no online mode"
 
    *) logit $0 "OFF -> no online mode"
Zeile 61: Zeile 61:
 
noad $1 "$2" $ADDOPTS
 
noad $1 "$2" $ADDOPTS
 
;;
 
;;
    2) logit $0 "EXEC -> $CHECK $1 $2 $ONLINEMODE $ADDOPTS"
+
    2) logit $0 "EXEC -> $CHECK $1 $2 $ADDOPTS --online=$ONLINEMODE"
noad $1 "$2" $ONLINEMODE $ADDOPTS
+
noad $1 "$2" $ADDOPTS --online=$ONLINEMODE
 
;;
 
;;
 
esac
 
esac
 +
;;
 +
esac
 +
 +
case $0 in
 +
    *before-*|*after-*)
 +
if ! screen -ls | egrep -q noadwatch ; then
 +
    screen -dmS noadwatch sh -c "while pidof noad ; do \
 +
for i in \$(pidof noad) ; do \
 +
    sleep 5s ; unset ARGS ; IFS=' ' ARGS=( \$(ps --no-heading -np \$i) ) ; \
 +
    if [ ! -d \"\${ARGS[6]}\" -a \"\${ARGS[6]:0:1}\" = / ] ; then \
 +
if ps -p \$i ; then \
 +
    kill -9 \$i ; \
 +
fi ; \
 +
    fi ; \
 +
done ; \
 +
    done"
 +
fi
 
;;
 
;;
 
esac
 
esac

Version vom 23. April 2006, 02:56 Uhr

Inhaltsverzeichnis

Beschreibung

In ../recording-cmds befinden sich Scripte, welche vor / nach / schnitt einer Aufnahme ausgeführt werden.

Format (Datei):

after-<NAME>.run
before-<NAME>.run
edited-<NAME>.run

Format (Head):

START="0"                 # 0 = inactiv, 1 = activ, 2 = + Option
ENTRY=$"0,2:Bechreibung"  # eintrag für das admin-plugin <choices>:<description>
CHECK=$(test xxx)         # tests

Das ganze kann im admin-plugin eingestellt werden. (0 = inactiv, 1 = activ, 2 = + Option)

kurze beschreibung

Alles weitere sollte im syslog ersichtlich sein. (vorrausgesetzt $VDR_LOG -gt 0)

START='0' -> ../recording-cmds/before-clipinc.run
START='1' -> ../recording-cmds/before-noad.run
START='2' -> ../recording-cmds/before-sharemarks.run

Bsp (noad)

1 = Nach einer Aufnahme
2 = Online mode
Datei
../recording-cmds/{after,before}-noad.run
#!/bin/sh
#
# example wrapper script

START="0"
ENTRY=$"0,2:Noad (0=off,1=on,2=online mode)"
CHECK=$(which noad)

# set the online-mode here
# 1 means online for live-recording only
# 2 means online for every recording
ONLINEMODE="1"

# set additional args for every call here here
ADDOPTS="--ac3 --overlap --jumplogo --comments --statisticfile=/var/log/vdr/noad.log"

case $0 in
     *before-*)
	case $START in
	     2) logit $0 "EXEC -> $CHECK $1 $2 $ADDOPTS --online=$ONLINEMODE"
		noad $1 "$2" $ADDOPTS --online=$ONLINEMODE
		;;
	     *) logit $0 "OFF -> no online mode"
		;;
	esac
	;;
     *after-*)
	case $START in
	     1) logit $0 "EXEC -> $CHECK $1 $2 $ADDOPTS"
		noad $1 "$2" $ADDOPTS
		;;
	     2) logit $0 "EXEC -> $CHECK $1 $2 $ADDOPTS --online=$ONLINEMODE"
		noad $1 "$2" $ADDOPTS --online=$ONLINEMODE
		;;
	esac
	;;
esac

case $0 in
     *before-*|*after-*)
	if ! screen -ls | egrep -q noadwatch ; then
	    screen -dmS noadwatch sh -c "while pidof noad ; do \
		for i in \$(pidof noad) ; do \
		    sleep 5s ; unset ARGS ; IFS=' ' ARGS=( \$(ps --no-heading -np \$i) ) ; \
		    if [ ! -d \"\${ARGS[6]}\" -a \"\${ARGS[6]:0:1}\" = / ] ; then \
			if ps -p \$i ; then \
			    kill -9 \$i ; \
			fi ; \
		    fi ; \
		done ; \
	    done"
	fi
	;;
esac


Bsp (sharemarks)

1 = Erzeugen der sharemarks.conf
2 = + Upload der Marken nach dem Schnitt
Datei
../recording-cmds/{before,edited}-sharemarks.run
#!/bin/sh
#
# example wrapper script

START="0"
ENTRY=$"0,2:Sharemarks (0=off,1=on,2=upload)"
CHECK=$(which marks2pts)

case $0 in
     *before-*)
	logit $0 "EXEC -> $CHECK $1 $2"
	marks2pts $1 "$2"
	;;
     *edited-*)
	case $START in
	     2) logit $0 "EXEC -> $CHECK -upload $1 $2"
		marks2pts -upload $1 "$2"
		;;
	     *) logit $0 "OFF -> no upload after cut"
		;;
	esac
	;;
esac


Bsp (clipinc)

1 = Erzeugen der recinfo.conf
Datei
../recording-cmds/before-clipinc.run
#!/bin/sh
#
# example wrapper script

START="0"
ENTRY=$"0,1:Clipinc (recinfo.conf)"
CHECK=$(which vdrrecinfo.pl)

logit $0 "EXEC -> $CHECK $1 $2"
vdrrecinfo.pl $1 "$2"


Bsp (epg)

Wird ausgeführt, wenn in der Aufnahme der Name "/wakeup/" vorkommt, am besten einen Timer anlegen, zbs.

1:S19.2E-1-1116-12732:MDMDFSS:0300:0301:0:1:wakeup:

Über diesen lassen sich dann die täglichen EPG Geschichten erledigen ... ohne die crontab zuzumüllen, desweiteren entfallen ellenlange shutdown script(s).

Die Variable START ist hier ein wenig irreführend, siehe vdr.conf, das wären dann die EPG Einträge ...

Datei
../recording-cmds/after-wakeup.run
#!/bin/sh
#
# example wrapper script

START="1"

# add this line to your timers.conf:
# folgende zeile in die timers.conf eintragen:
#
# 1:S19.2E-1-1116-12732:MDMDFSS:0300:0301:0:1:wakeup:

case $2 in
     */wakeup/*)
	EXECFILE=/tmp/wakeup.$$
        cat << EOT > $EXECFILE
	for i in ${!EPG_*} ; do
	    eval x=\\$\$i
	    if [ \$x -eq 1 ] ; then
		x=\$(echo \${i##*_} | tr A-Z a-z)
		if [ -x "$ADMDIR/start-cmds/rc/\$x" ] ; then
		    logit $0 "EXEC -> \$x start"
		    cd "$ADMDIR/start-cmds/rc"
		    $SVDRPSENDCMD MESG "starting \$x ..."
		    sh \$x start
		    while screen -ls | egrep -q \$x ; do
			sleep 5s
		    done
		    $SVDRPSENDCMD MESG "\$x done ..."
		fi
	    fi
	done
	$SVDRPSENDCMD PLUG epgsearch UPDS OSD
	DELR=( \$($SVDRPSENDCMD LSTR | grep " wakeup" | tr - ' ') )
	if [ -n "\${DELR[1]}" ] ; then
	    $SVDRPSENDCMD DELR \${DELR[1]}
	fi
	$SVDRPSENDCMD HITK POWER
	rm -f $EXECFILE
EOT
	screen -dmS $$ sh -c "sh $EXECFILE"
	;;
esac