Rwrapper.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
K
(rwrapper.sh)
 
(14 dazwischenliegende Versionen von 9 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
{{übersetzen|20}}
 
 
==Beschreibung==
 
Aus '''INSTALL''' (VDR).
 
 
<pre>
 
Executing commands before and after a recording:
 
------------------------------------------------
 
 
You can use the '-r' option to define a program or script that gets called
 
before and after a recording is performed, and after an editing process
 
has finished.
 
 
The program will be called with two string parameters. The first parameter
 
is one of
 
 
  before      if this is *before* a recording starts
 
  after      if this is *after* a recording has finished
 
  edited      if this is after a recording has been *edited*
 
 
and the second parameter contains the full name of the recording's
 
directory (which may not yet exists at that moment in the "before" case).
 
In the "edited" case it will be the name of the edited version.
 
 
Within this program you can do anything you would like to do before and/or
 
after a recording or after an editing process. However, the program must return
 
as soon as possible, because otherwise it will block further execution of VDR.
 
Be especially careful to make sure the program returns before the watchdog
 
timeout you may have set up with the '-w' option! If the operation you want to
 
perform will take longer, you will have to run it as a background job.
 
 
An example script for use with the '-r' option could look like this:
 
 
#!/bin/sh
 
case "$1" in
 
    before)
 
            echo "Before recording $2"
 
            ;;
 
    after)
 
            echo "After recording $2"
 
            ;;
 
    edited)
 
            echo "Edited recording $2"
 
            ;;
 
    *)
 
            echo "ERROR: unknown state: $1"
 
            ;;
 
esac
 
</pre>
 
 
==Beispiel==
 
 
Vorschlag für ein einfaches ''Wrapper''-Skript, welches ''vor / nach / editieren'' einer Aufnahme ausgeführt werden kann.
 
Vorschlag für ein einfaches ''Wrapper''-Skript, welches ''vor / nach / editieren'' einer Aufnahme ausgeführt werden kann.
  
Übergabe.
+
==Übergabe==
 
+
 
  -r [[Struktur|$PATH]]/rwrapper.sh
 
  -r [[Struktur|$PATH]]/rwrapper.sh
  -record=[[Struktur|$PATH]]/rwrapper.sh
+
  --record=[[Struktur|$PATH]]/rwrapper.sh
  
 
Siehe auch [[VDR Optionen]].
 
Siehe auch [[VDR Optionen]].
  
Quellen:
+
==rwrapper.sh==
 
+
* ''INSTALL'' (VDR)
+
* ''rwrapper.sh'' [[sharemarks]]
+
* ''scripts'' von [[noad]]
+
 
+
 
+
 
{{Box Datei | [[Struktur|$PATH]]/rwrapper.sh |
 
{{Box Datei | [[Struktur|$PATH]]/rwrapper.sh |
 
<pre>
 
<pre>
Zeile 77: Zeile 19:
 
NOAD="0"        # (0=off,1=on,2=online mode)
 
NOAD="0"        # (0=off,1=on,2=online mode)
 
SHAREMARKS="0"  # (0=off,1=on,2=upload after cut)
 
SHAREMARKS="0"  # (0=off,1=on,2=upload after cut)
 +
AUTOCUTTER="0"  # (0=off,1=on,2=manual edit)
  
# set the online-mode here
+
# set the noad online-mode here
 
# 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="--online=1"
  
# set additional args for every call here here
+
# set additional noad args for every call here here (not used by AutoCutter, see README)
ADDOPTS="--ac3 --overlap --jumplogo --comments --statisticfile=/var/log/noadstat
+
ADDOPTS="--ac3 --overlap --jumplogo --comments --statisticfile=/var/log/noadstat"
 +
 
 +
# AutoCutter Options - see AutoCutter README/INSTALL for more
 +
ACBINDIR=/usr/local/vdr/bin
 +
NOADQ=/var/spool/vdrconvert/noad
 +
AUTOCUTLOG=/var/log/autocutter.log
  
 
case $1 in
 
case $1 in
Zeile 102: Zeile 50:
 
############
 
############
 
case $NOAD in
 
case $NOAD in
    2) noad $1 "$2" $ADDOPTS $ONLINEMODE
+
    2) noad $1 $ADDOPTS $ONLINEMODE "$2"
 
;;
 
;;
 
esac
 
esac
  
############
 
# sharemarks
 
############
 
case $SHAREMARKS in
 
    1|2) marks2pts $1 "$2"
 
  ;;
 
esac
 
 
;;
 
;;
 
     after)
 
     after)
 
echo "After recording $2"
 
echo "After recording $2"
  
############
+
        ############
# noad
+
        # noad
############
+
        ############
case $NOAD in
+
        case $NOAD in
    1) noad $1 "$2" $ADDOPTS
+
            1) noad $1 $ADDOPTS "$2"
;;
+
                ;;
    2) noad $1 "$2" $ADDOPTS $ONLINEMODE
+
            2) noad $1 $ADDOPTS $ONLINEMODE "$2"
;;
+
                ;;
esac
+
        esac
 +
 
 +
        ############
 +
        # AutoCutter
 +
        ############
 +
        case $AUTOCUTTER in
 +
            1|2) grep -q "$2" $NOADQ 2>/dev/null
 +
                if [ $? -ne 0 ]; then
 +
                  printf "%s " "$2" >>$NOADQ
 +
                  # Start NoAD Scan in 7 min.
 +
                  echo "printf '\n' >>$NOADQ" | at now+7 min
 +
                fi
 +
              ;;
 +
        esac
 
;;
 
;;
 
     edited)
 
     edited)
Zeile 134: Zeile 88:
 
############
 
############
 
case $SHAREMARKS in
 
case $SHAREMARKS in
    2) marks2pts -upload $1 "$2"
+
      2) marks2pts --non-interactive --upload $1 "$2"
 
;;
 
;;
 
esac
 
esac
 +
 +
############
 +
# AutoCutter
 +
############
 +
case $AUTOCUTTER in
 +
      2) $ACBINDIR/autocutter-edited.sh $* >>$AUTOCUTLOG 2>&1 &
 +
;;
 +
esac
 +
 
;;
 
;;
 
     *)
 
     *)
Zeile 143: Zeile 106:
 
esac
 
esac
  
############
+
exit $?
#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
+
############
+
 
</pre>
 
</pre>
 
}}
 
}}
 +
 +
==Quellen==
 +
* ''INSTALL'' (VDR)
 +
* ''rwrapper.sh'' [[sharemarks]]
 +
* ''scripts'' von [[noad]]
  
 
[[Kategorie:Skripte]]
 
[[Kategorie:Skripte]]

Aktuelle Version vom 22. Oktober 2007, 20:36 Uhr

Vorschlag für ein einfaches Wrapper-Skript, welches vor / nach / editieren einer Aufnahme ausgeführt werden kann.

[Bearbeiten] Übergabe

-r $PATH/rwrapper.sh
--record=$PATH/rwrapper.sh

Siehe auch VDR Optionen.

[Bearbeiten] rwrapper.sh

Datei
$PATH/rwrapper.sh
#!/bin/sh
#
# rwrapper.sh
#
# an example script for use with the '-r' option could look like this:

CLIPINC="0"     # (0=off,1=on)
NOAD="0"        # (0=off,1=on,2=online mode)
SHAREMARKS="0"  # (0=off,1=on,2=upload after cut)
AUTOCUTTER="0"  # (0=off,1=on,2=manual edit)

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

# set additional noad args for every call here here (not used by AutoCutter, see README)
ADDOPTS="--ac3 --overlap --jumplogo --comments --statisticfile=/var/log/noadstat"

# AutoCutter Options - see AutoCutter README/INSTALL for more
ACBINDIR=/usr/local/vdr/bin
NOADQ=/var/spool/vdrconvert/noad
AUTOCUTLOG=/var/log/autocutter.log

case $1 in
     before)
	echo "Before recording $2"

	############
	# clipinc
	############
	case $CLIPINC in
	     1) vdrrecinfo.pl $1 "$2"
		;;
	esac

	############
	# noad
	############
	case $NOAD in
	     2) noad $1 $ADDOPTS $ONLINEMODE "$2"
		;;
	esac

	;;
     after)
	echo "After recording $2"

        ############
        # noad
        ############
        case $NOAD in
             1) noad $1 $ADDOPTS "$2"
                ;;
             2) noad $1 $ADDOPTS $ONLINEMODE "$2"
                ;;
        esac

        ############
        # AutoCutter
        ############
        case $AUTOCUTTER in
             1|2) grep -q "$2" $NOADQ 2>/dev/null
                 if [ $? -ne 0 ]; then
                   printf "%s " "$2" >>$NOADQ
                   # Start NoAD Scan in 7 min.
                   echo "printf '\n' >>$NOADQ" | at now+7 min
                 fi
               ;;
        esac
	;;
     edited)
	echo "Edited recording $2"

	############
	# sharemarks
	############
	case $SHAREMARKS in
	      2) marks2pts --non-interactive --upload $1 "$2"
		;;
	esac

	############
	# AutoCutter
	############
	case $AUTOCUTTER in
	      2) $ACBINDIR/autocutter-edited.sh $* >>$AUTOCUTLOG 2>&1 &
		;;
	esac

	;;
     *)
	echo "ERROR: unknown state: $1"
	;;
esac

exit $?


[Bearbeiten] Quellen