Noad.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(M)
Zeile 20: Zeile 20:
 
  VDR_VIDEO=/video
 
  VDR_VIDEO=/video
 
   
 
   
  case "${1}" in
+
  case "$1" in
 
       -start)
 
       -start)
echo "recording: "
+
        echo "recording: "
echo
+
        echo
echo "${2}"
+
        echo "$2"
echo
+
        echo
test -e "${2}/noad.pid" && {
+
        if [ -e "$2/noad.pid" ] ; then
    echo "noad is already active..."
+
            echo "noad is already active..."
    } || {
+
        else
    echo "/usr/local/bin/noad ${NOADOPT} \"${2}\"" | at now
+
            echo "/usr/local/bin/noad $NOADOPT \"$2\"" | at now
    echo "noad startet..."
+
            echo "noad startet..."
}
+
        fi
;;
+
        ;;
 
       -batch)
 
       -batch)
while read i ; do
+
        while read i ; do
    ! test -e "${i}/marks.vdr" -a ! -e "${i}/noad.pid" && {
+
            if [ ! -e "$i/marks.vdr" -a ! -e "$i/noad.pid" ] ; then
echo "/usr/local/bin/noad ${NOADOPT} \"${i}\"" | batch
+
                echo "/usr/local/bin/noad $NOADOPT \"$i\"" | batch
    }
+
            fi
done < <(find "${VDR_VIDEO}" -follow -name "*.rec")
+
        done < <(find "$VDR_VIDEO" -follow -name "*.rec")
;;
+
        ;;
 
       -view)
 
       -view)
echo "recording: "
+
        echo "recording: "
echo
+
        echo
echo "${2}"
+
        echo "$2"
echo
+
        echo
test -e "${2}/noad.pid" && {
+
        if [ -e "$2/noad.pid" ] ; then
    echo "noad is still active..."
+
            echo "noad is still active..."
    echo
+
            echo
}
+
        fi
test -e "${2}/marks.vdr" && {
+
        if [ -e "$2/marks.vdr" ] ; then
    cat "${2}/marks.vdr"
+
            cat "$2/marks.vdr"
    } || {
+
        else
    echo "cut list not found..."
+
            echo "cut list not found..."
}
+
        fi
;;
+
        ;;
 
       -count)
 
       -count)
echo "all noad processes:"
+
        echo "all noad processes:"
echo
+
        echo
ps axc|awk "{if (\$5==\"noad\") print \$1}"|wc -w|tr -d ' '
+
        ps axc | awk "if (\$5==\"noad\") print \$1" | wc -w | tr -d ' '
;;
+
        ;;
 
       -killpid)
 
       -killpid)
echo "recording: "
+
        echo "recording: "
echo
+
        echo
echo "${2}"
+
        echo "$2"
echo
+
        echo
test -e "${2}/noad.pid" && {
+
        if [ -e "$2/noad.pid" ] ; then
    kill `cat "${2}/noad.pid"`
+
            kill `cat "$2/noad.pid"`
    echo "noad stopped..."
+
            echo "noad stopped..."
    } || {
+
        else
    echo "noad is not active..."
+
            echo "noad is not active..."
}
+
        di
;;
+
        ;;
 
       -killall)
 
       -killall)
killall noad
+
        killall noad
;;
+
        ;;
 
       -marks.vdr|-noad.pid)
 
       -marks.vdr|-noad.pid)
find "${VDR_VIDEO}" -follow -type f -name "${1/-}" -exec  rm -f '{}' ';' &
+
        find "$VDR_VIDEO" -follow -type f -name "$1/-" -exec  rm -f '{}' ';' &
;;
+
        ;;
 
         *)
 
         *)
  echo "unrecognized option: $1"
+
          echo "unrecognized option: $1"
 
         ;;
 
         ;;
 
  esac
 
  esac
 
  
 
[[Kategorie:Scripts]]
 
[[Kategorie:Scripts]]

Version vom 1. März 2005, 10:49 Uhr

#!/bin/bash
#
# noad.sh - v.0.2
#
# add this lines to your reccmds.conf:
# folgende zeilen in die reccmds.conf eintragen:
#
# Run noad                         : /usr/local/bin/noad.sh -start
# Run noad, all recordings (batch) : /usr/local/bin/noad.sh -batch
# View Cut list                    : /usr/local/bin/noad.sh -view
# In prozess                       : /usr/local/bin/noad.sh -count
# Stop noad (killpid)              : /usr/local/bin/noad.sh -killpid
# Stop noad (killall)?             : /usr/local/bin/noad.sh -killall
# Remove all marks                 : /usr/local/bin/noad.sh -marks.vdr
# Remove all pids                  : /usr/local/bin/noad.sh -noad.pid

PATH=$PATH:/usr/local/bin

NOADOPT="nice --background --jumplogo --ac3 --overlap --OSD --statisticfile=/var/log/noadstat"
VDR_VIDEO=/video

case "$1" in
      -start)
        echo "recording: "
        echo
        echo "$2"
        echo
        if [ -e "$2/noad.pid" ] ; then
            echo "noad is already active..."
        else
            echo "/usr/local/bin/noad $NOADOPT \"$2\"" | at now
            echo "noad startet..."
        fi
        ;;
      -batch)
        while read i ; do
            if [ ! -e "$i/marks.vdr" -a ! -e "$i/noad.pid" ] ; then
                echo "/usr/local/bin/noad $NOADOPT \"$i\"" | batch
            fi
        done < <(find "$VDR_VIDEO" -follow -name "*.rec")
        ;;
      -view)
        echo "recording: "
        echo
        echo "$2"
        echo
        if [ -e "$2/noad.pid" ] ; then
            echo "noad is still active..."
            echo
        fi
        if [ -e "$2/marks.vdr" ] ; then
            cat "$2/marks.vdr"
        else
            echo "cut list not found..."
        fi
        ;;
      -count)
        echo "all noad processes:"
        echo
        ps axc | awk "if (\$5==\"noad\") print \$1" | wc -w | tr -d ' '
        ;;
      -killpid)
        echo "recording: "
        echo
        echo "$2"
        echo
        if [ -e "$2/noad.pid" ] ; then
            kill `cat "$2/noad.pid"`
            echo "noad stopped..."
        else
            echo "noad is not active..."
        di
        ;;
      -killall)
        killall noad
        ;;
      -marks.vdr|-noad.pid)
        find "$VDR_VIDEO" -follow -type f -name "$1/-" -exec  rm -f '{}' ';' &
        ;;
       *)
         echo "unrecognized option: $1"
       ;;
esac