Noad.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(Auf Leistungsschwachen PCs sollte man '''at now''' durch '''batch''' ersetzen.)
Zeile 1: Zeile 1:
  #!/bin/sh
+
  #!/bin/bash
 
  #
 
  #
  # noad.sh - v.0.1
+
  # noad.sh - v.0.2
 
  #
 
  #
  # add this lines to your [[reccmds.conf]]:
+
  # add this lines to your reccmds.conf:
  # folgende zeilen in die [[reccmds.conf]] eintragen:
+
  # folgende zeilen in die reccmds.conf eintragen:
 
  #
 
  #
  # Start advertising filter      : /usr/local/bin/noad.sh -start
+
  # Run noad                        : /usr/local/bin/noad.sh -start
  # View Cut list                 : /usr/local/bin/noad.sh -marks
+
# Run noad, all recordings (batch) : /usr/local/bin/noad.sh -batch
  # Advertising filter overview  : /usr/local/bin/noad.sh -count
+
  # View Cut list                   : /usr/local/bin/noad.sh -view
  # Stop advertising filter      : /usr/local/bin/noad.sh -stop
+
  # In prozess                      : /usr/local/bin/noad.sh -count
  # Stop all advertising filters? : /usr/local/bin/noad.sh -kill
+
  # Stop noad (killpid)              : /usr/local/bin/noad.sh -killpid
+
  # Stop noad (killall)?             : /usr/local/bin/noad.sh -killall
  # CONFIG START
+
  # Remove all marks                : /usr/local/bin/noad.sh -marks.vdr
  NOADOPT="nice --background --jumplogo --ac3 --overlap --OSD --statisticfile=/var/log/noadstat"
+
  # Remove all pids                  : /usr/local/bin/noad.sh -noad.pid
  # CONFIG END
+
 
   
 
   
 
  PATH=$PATH:/usr/local/bin
 
  PATH=$PATH:/usr/local/bin
 +
 +
NOADOPT="nice --background --jumplogo --ac3 --overlap --OSD --statisticfile=/var/log/noadstat"
 
   
 
   
 
  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" && {
+
test -e "${2}/noad.pid" && {
            echo "Advertising filter is already active."
+
    echo "noad is already active..."
            } || {
+
    } || {
            echo "/usr/local/bin/noad ${NOADOPT} \"${2}\"" | at now
+
    echo "/usr/local/bin/noad ${NOADOPT} \"${2}\"" | at now
            echo "Advertising filter startet."
+
    echo "noad startet..."
        }
+
}
        ;;
+
;;
       -marks)
+
       -batch)
        echo "Recording: "
+
while read i ; do
        echo
+
    ! test -e "${i}/marks.vdr" -a -e "${i}/noad.pid" && {
        echo "${2}"
+
echo "/usr/local/bin/noad ${NOADOPT} \"${i}\"" | batch
        echo
+
    }
        test -e "${2}/noad.pid" && {
+
done < <(find "${VDR_VIDEO}" -follow -name "*.rec")
            echo "Advertising filter is still active."
+
;;
            echo
+
      -view)
        }
+
echo "recording: "
        test -e "${2}/marks.vdr" && {
+
echo
            cat "${2}/marks.vdr"
+
echo "${2}"
            } || {
+
echo
            echo "There is not missing cut markings."
+
test -e "${2}/noad.pid" && {
        }
+
    echo "noad is still active..."
        ;;
+
    echo
 +
}
 +
test -e "${2}/marks.vdr" && {
 +
    cat "${2}/marks.vdr"
 +
    } || {
 +
    echo "cut list not found..."
 +
}
 +
;;
 
       -count)
 
       -count)
        echo "Counting of the advertising filters:"
+
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 ' '
        ;;
+
;;
       -stop)
+
       -killpid)
        echo "Recording: "
+
echo "recording: "
        echo
+
echo
        echo "${2}"
+
echo "${2}"
        echo
+
echo
        test -e "${2}/noad.pid" && {
+
test -e "${2}/noad.pid" && {
            kill `cat "${2}/noad.pid"`
+
    kill `cat "${2}/noad.pid"`
            echo "Advertising filter stopped."
+
    echo "noad stopped..."
            } || {
+
    } || {
            echo "Advertising filter is not active."
+
    echo "noad is not active..."
        }
+
}
        ;;
+
;;
       -kill)
+
       -killall)
        killall noad
+
killall noad
        ;;
+
;;
 +
      -marks.vdr|-noad.pid)
 +
find "${VDR_VIDEO}" -follow -type f -name "${1/-}" -exec  rm -f '{}' ';' &
 +
;;
 +
        *)
 +
  echo "unrecognized option: $1"
 +
        ;;
 
  esac
 
  esac
  
Auf Leistungsschwachen PCs sollte man '''at now''' durch '''batch''' ersetzen.
 
 
- echo "/usr/local/bin/noad ${NOADOPT} \"${2}\"" | at now
 
+ echo "/usr/local/bin/noad ${NOADOPT} \"${2}\"" | batch
 
  
 
[[Kategorie:Scripts]]
 
[[Kategorie:Scripts]]

Version vom 22. Februar 2005, 15:51 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"

case "${1}" in
      -start)
	echo "recording: "
	echo
	echo "${2}"
	echo
	test -e "${2}/noad.pid" && {
	    echo "noad is already active..."
	    } || {
	    echo "/usr/local/bin/noad ${NOADOPT} \"${2}\"" | at now
	    echo "noad startet..."
	}
	;;
      -batch)
	while read i ; do
	    ! test -e "${i}/marks.vdr" -a -e "${i}/noad.pid" && {
		echo "/usr/local/bin/noad ${NOADOPT} \"${i}\"" | batch
	    }
	done < <(find "${VDR_VIDEO}" -follow -name "*.rec")
	;;
      -view)
	echo "recording: "
	echo
	echo "${2}"
	echo
	test -e "${2}/noad.pid" && {
	    echo "noad is still active..."
	    echo
	}
	test -e "${2}/marks.vdr" && {
	    cat "${2}/marks.vdr"
	    } || {
	    echo "cut list not found..."
	}
	;;
      -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
	test -e "${2}/noad.pid" && {
	    kill `cat "${2}/noad.pid"`
	    echo "noad stopped..."
	    } || {
	    echo "noad is not active..."
	}
	;;
      -killall)
	killall noad
	;;
      -marks.vdr|-noad.pid)
	find "${VDR_VIDEO}" -follow -type f -name "${1/-}" -exec  rm -f '{}' ';' &
	;;
       *)
 	echo "unrecognized option: $1"
       ;;
esac