Noad.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
K
Zeile 1: Zeile 1:
#!/bin/bash
+
<pre>
#
+
#!/bin/bash
# noad.sh - v.0.3
+
#
#
+
# noad.sh
# add this lines to your reccmds.conf:
+
#
# folgende zeilen in die reccmds.conf eintragen:
+
# Required: noad, at
#
+
#
# Run noad                        : /usr/local/bin/noad.sh -start
+
# add this lines to your reccmds.conf:
# Run noad, all recordings (batch) : /usr/local/bin/noad.sh -batch
+
# folgende zeilen in die reccmds.conf eintragen:
# View Cut list                    : /usr/local/bin/noad.sh -view
+
#
# In prozess                      : /usr/local/bin/noad.sh -count
+
# Run noad                        : /usr/local/bin/noad.sh -start
# Stop noad (killpid)              : /usr/local/bin/noad.sh -killpid
+
# Run noad, all recordings (batch) : /usr/local/bin/noad.sh -batch
# Stop noad (killall)?            : /usr/local/bin/noad.sh -killall
+
# View Cut list                    : /usr/local/bin/noad.sh -view
# Remove all marks                : /usr/local/bin/noad.sh -marks.vdr
+
# In prozess                      : /usr/local/bin/noad.sh -count
# Remove all pids                  : /usr/local/bin/noad.sh -noad.pid
+
# Stop noad (killpid)              : /usr/local/bin/noad.sh -killpid
+
# Stop noad (killall)?            : /usr/local/bin/noad.sh -killall
# CONFIG START
+
# Remove marks                    : /usr/local/bin/noad.sh -marks
  VDR_VIDEO="/video"
+
# Remove pid                      : /usr/local/bin/noad.sh -pid
  NOADOPT="nice --background --priority 19 --ac3 --overlap --jumplogo --comments --OSD --statisticfile=/var/log/noadstat"
+
# Remove all marks                : /usr/local/bin/noad.sh -marks.vdr
# CONFIG END
+
# Remove all pids                  : /usr/local/bin/noad.sh -noad.pid
+
 
PATH=/usr/local/bin:$PATH
+
# CONFIG START
+
  NOADOPTS="--background --ac3 --overlap --jumplogo --comments --OSD --statisticfile=/var/log/vdr/noadstat"
case "$1" in
+
# CONFIG END
      -start)
+
 
        echo "recording: "
+
PATH=/usr/local/bin:$PATH
        echo
+
 
        echo "$2"
+
case "$1" in
        echo
+
    -start)
        if [ -e "$2/noad.pid" ] ; then
+
echo "recording: "
            echo "noad is already active..."
+
echo
        else
+
echo "$2"
            echo "noad $NOADOPT \"$2\"" | at now
+
echo
            echo "noad startet..."
+
if [ -e "$2/noad.pid" ] ; then
        fi
+
    echo "noad is already active..."
        ;;
+
else
      -batch)
+
    echo "noad $NOADOPTS \"$2\"" | at now
        while read i ; do
+
    echo "noad startet..."
            if [ ! -e "$i/marks.vdr" -a ! -e "$i/noad.pid" ] ; then
+
fi
                echo "noad $NOADOPT \"$i\"" | batch
+
;;
            fi
+
    -batch)
        done < <(find "$VDR_VIDEO" -follow -name "*.rec")
+
while read i ; do
        ;;
+
    if [ ! -e "$i/marks.vdr" -a ! -e "$i/noad.pid" ] ; then
      -view)
+
echo "noad $NOADOPTS \"$i\"" | batch
        echo "recording: "
+
    fi
        echo
+
done < <(find "$VDR_VIDEO" -follow -name "*.rec")
        echo "$2"
+
;;
        echo
+
    -view)
        if [ -e "$2/noad.pid" ] ; then
+
echo "recording: "
            echo "noad is still active..."
+
echo
            echo
+
echo "$2"
        fi
+
echo
        if [ -e "$2/marks.vdr" ] ; then
+
if [ -e "$2/noad.pid" ] ; then
            cat "$2/marks.vdr"
+
    echo "noad is still active..."
        else
+
    echo
            echo "cut list not found..."
+
fi
        fi
+
if [ -e "$2/marks.vdr" ] ; then
        ;;
+
    cat "$2/marks.vdr"
      -count)
+
else
        echo "all noad processes:"
+
    echo "cut list not found..."
        echo
+
fi
        pidof noad | wc -w | tr -d ' '
+
;;
        ;;
+
    -count)
      -killpid)
+
echo "all noad processes:"
        echo "recording: "
+
echo
        echo
+
pidof noad | wc -w | tr -d ' '
        echo "$2"
+
;;
        echo
+
    -killpid)
        if [ -e "$2/noad.pid" ] ; then
+
echo "recording: "
            kill `cat "$2/noad.pid"`
+
echo
            echo "noad stopped..."
+
echo "$2"
        else
+
echo
            echo "noad is not active..."
+
if [ -e "$2/noad.pid" ] ; then
        fi
+
    kill `cat "$2/noad.pid"`
        ;;
+
    echo "noad stopped..."
      -killall)
+
else
        PID=`pidof noad`
+
    echo "noad is not active..."
        eval ${PID:+kill $PID}
+
fi
        ;;
+
;;
      -marks.vdr|-noad.pid)
+
    -killall)
        find "$VDR_VIDEO" -follow -type f -name "${1/-}" -exec  rm -f '{}' ';' &
+
PID=`pidof noad`
        ;;
+
eval ${PID:+kill $PID}
        *)
+
;;
        echo "unrecognized option: $1"
+
    -marks)
        ;;
+
rm -f "$2/marks.vdr"
esac
+
;;
 +
    -pid)
 +
rm -f "$2/noad.pid"
 +
;;
 +
    -marks.vdr|-noad.pid)
 +
find "$VDR_VIDEO" -follow -type f -name "${1/-}" -exec  rm -f '{}' ';' &
 +
;;
 +
    *)
 +
echo "unrecognized option: $1"
 +
exit 1
 +
;;
 +
esac
 +
</pre>
  
 
[[Kategorie:Scripts]]
 
[[Kategorie:Scripts]]

Version vom 30. März 2005, 11:28 Uhr

#!/bin/bash
#
# noad.sh
#
# Required: noad, at
#
# 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 marks                     : /usr/local/bin/noad.sh -marks
# Remove pid                       : /usr/local/bin/noad.sh -pid
# Remove all marks                 : /usr/local/bin/noad.sh -marks.vdr
# Remove all pids                  : /usr/local/bin/noad.sh -noad.pid

# CONFIG START
  NOADOPTS="--background --ac3 --overlap --jumplogo --comments --OSD --statisticfile=/var/log/vdr/noadstat"
# CONFIG END

PATH=/usr/local/bin:$PATH

case "$1" in
    -start)
	echo "recording: "
	echo
	echo "$2"
	echo
	if [ -e "$2/noad.pid" ] ; then
	    echo "noad is already active..."
	else
	    echo "noad $NOADOPTS \"$2\"" | at now
	    echo "noad startet..."
	fi
	;;
    -batch)
	while read i ; do
	    if [ ! -e "$i/marks.vdr" -a ! -e "$i/noad.pid" ] ; then
		echo "noad $NOADOPTS \"$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
	pidof noad | 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..."
	fi
	;;
    -killall)
	PID=`pidof noad`
	eval ${PID:+kill $PID}
	;;
    -marks)
	rm -f "$2/marks.vdr"
	;;
    -pid)
	rm -f "$2/noad.pid"
	;;
    -marks.vdr|-noad.pid)
	find "$VDR_VIDEO" -follow -type f -name "${1/-}" -exec  rm -f '{}' ';' &
	;;
    *)
	echo "unrecognized option: $1"
	exit 1
	;;
esac