Noad.sh
Aus VDR Wiki
(Unterschied zwischen Versionen)
(M) |
|||
| Zeile 1: | Zeile 1: | ||
| − | Skript | + | Vorschlag für ein einfaches Skript um [[noad]] auszuführen, welches über die [[reccmds.conf]] ausgeführt werden kann. |
{{Box Datei | [[Struktur|$PATH]]/noad.sh | | {{Box Datei | [[Struktur|$PATH]]/noad.sh | | ||
| Zeile 87: | Zeile 87: | ||
</pre> | </pre> | ||
}} | }} | ||
| + | |||
| + | ==Quellen== | ||
| + | * [[noad]] | ||
[[Kategorie:Skripte]] | [[Kategorie:Skripte]] | ||
Version vom 4. Juni 2006, 08:39 Uhr
Vorschlag für ein einfaches Skript um noad auszuführen, welches über die reccmds.conf ausgeführt werden kann.
$PATH/noad.sh
#!/bin/sh
#
# noad.sh
#
# source: noad
#
# add this lines to your reccmds.conf:
# folgende zeilen in die reccmds.conf eintragen:
#
# Run noad : /path_to_this_script/noad.sh -start
# Run noad, all recordings (batch)? : /path_to_this_script/noad.sh -batch
# In prozess : /path_to_this_script/noad.sh -count
# Stop noad (killpid) : /path_to_this_script/noad.sh -killpid
# Stop noad (killall)? : /path_to_this_script/noad.sh -killall
# Remove marks : /path_to_this_script/noad.sh -rmmarks
# Remove all marks? : /path_to_this_script/noad.sh -rmallmarks
# CONFIG START
NOADOPTS="nice --ac3 --overlap --jumplogo --comments --OSD --statisticfile=/var/log/vdr/noad.log"
VDR_VIDEO="/video0"
# CONFIG END
which noad >/dev/null 2>&1 || { echo noad $"not found" ... ; exit 1 ; }
case $1 in
-start)
echo $"Recording" ...
echo
echo "$2"
echo
if [ -s "${PIDFILE:=$2/noad.pid}" ] ; then
read PID < "$PIDFILE"
if ps -p $PID >/dev/null 2>&1 ; then
echo $"Noad process already active" "(pid: $PID)" ...
exit 0
fi
fi
screen -dmS $$ sh -c "noad $NOADOPTS \"$2\""
echo $"Noad startet" ...
;;
-batch)
screen -dmS $$ bash -c " \
while read i ; do \
noad $NOADOPTS \"\$i\" &
wait \$! ; \
done < <(find "$VDR_VIDEO" -follow -name "*.rec")"
;;
-count)
echo $"Noad processes" $(pidof noad | wc -w | tr -d ' ') ...
;;
-killpid)
echo $"Recording" ...
echo
echo "$2"
echo
if [ -s "${PIDFILE:=$2/noad.pid}" ] ; then
read PID < "$PIDFILE"
if ps -p $PID >/dev/null 2>&1 ; then
kill $PID
echo $"Noad stopped" "(pid: $PID)" ...
exit 0
fi
rm -f "$PIDFILE"
fi
echo $"Noad is not active" ...
;;
-killall)
pidof noad | xargs -r kill -9
;;
-rmmarks)
rm -f "$2/marks.vdr"
;;
-rmallmarks)
find "$VDR_VIDEO" -follow -type f -name marks.vdr -print0 2>/dev/null | xargs -r0 rm
;;
*)
echo "unrecognized option: $1"
exit 1
;;
esac
exit $?