Noad.sh
Aus VDR Wiki
(Unterschied zwischen Versionen)
(M) |
(bissel ´abgespeckt´) |
||
Zeile 7: | Zeile 7: | ||
# noad.sh | # noad.sh | ||
# | # | ||
− | # | + | # source: noad |
# | # | ||
# 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: | ||
# | # | ||
− | # Run noad | + | # Run noad : /path_to_this_script/noad.sh -start |
− | # Run noad, all recordings (batch) : /path_to_this_script/noad.sh -batch | + | # Run noad, all recordings (batch)? : /path_to_this_script/noad.sh -batch |
− | + | # In prozess : /path_to_this_script/noad.sh -count | |
− | # In prozess | + | # Stop noad (killpid) : /path_to_this_script/noad.sh -killpid |
− | # Stop noad (killpid) | + | # Stop noad (killall)? : /path_to_this_script/noad.sh -killall |
− | # Stop noad (killall)? | + | # Remove marks : /path_to_this_script/noad.sh -rmmarks |
− | # Remove marks | + | # Remove all marks? : /path_to_this_script/noad.sh -rmallmarks |
− | + | ||
− | # Remove all marks : /path_to_this_script/noad.sh - | + | |
− | + | ||
# CONFIG START | # CONFIG START | ||
− | NOADOPTS="nice --background --ac3 --overlap --jumplogo --comments --OSD --statisticfile=/var/log/vdr/ | + | NOADOPTS="nice --background --ac3 --overlap --jumplogo --comments --OSD --statisticfile=/var/log/vdr/noad.log" |
− | VDR_VIDEO="/ | + | VDR_VIDEO="/video0" |
# CONFIG END | # CONFIG END | ||
− | |||
− | |||
case "$1" in | case "$1" in | ||
-start) | -start) | ||
− | echo " | + | echo $"Recording" ... |
echo | echo | ||
echo "$2" | echo "$2" | ||
echo | echo | ||
− | if [ - | + | 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 | fi | ||
+ | echo "noad $NOADOPTS \"$2\" >/dev/null 2>&1" | at now | ||
+ | echo $"Noad startet" ... | ||
;; | ;; | ||
-batch) | -batch) | ||
while read i ; do | while read i ; do | ||
− | + | echo "noad $NOADOPTS \"$i\" >/dev/null 2>&1" | |
− | + | echo "while pidof noad >/dev/null ; do sleep 10s ; done" | |
− | + | ||
− | + | ||
done < <(find "$VDR_VIDEO" -follow -name "*.rec") | at now | done < <(find "$VDR_VIDEO" -follow -name "*.rec") | at now | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
;; | ;; | ||
-count) | -count) | ||
− | echo " | + | echo $"Noad processes" $(pidof noad | wc -w | tr -d ' ') ... |
;; | ;; | ||
-killpid) | -killpid) | ||
− | echo " | + | echo $"Recording" ... |
echo | echo | ||
echo "$2" | echo "$2" | ||
echo | echo | ||
− | if [ - | + | if [ -s "${PIDFILE:=$2/noad.pid}" ] ; then |
− | + | read PID < "$PIDFILE" | |
− | echo " | + | if ps -p $PID >/dev/null 2>&1 ; then |
− | + | kill $PID | |
− | + | echo $"Noad stopped" "(pid: $PID)" ... | |
+ | exit 0 | ||
+ | fi | ||
fi | fi | ||
+ | echo $"Noad is not active" ... | ||
;; | ;; | ||
-killall) | -killall) | ||
pidof noad | xargs -r kill | pidof noad | xargs -r kill | ||
;; | ;; | ||
− | - | + | -rmmarks) |
rm -f "$2/marks.vdr" | rm -f "$2/marks.vdr" | ||
;; | ;; | ||
− | - | + | -rmallmarks) |
− | + | find "$VDR_VIDEO" -follow -type f -name marks.vdr -print0 2>/dev/null | xargs -r0 rm | |
− | + | ||
− | + | ||
− | find "$VDR_VIDEO" -follow -type f -name | + | |
;; | ;; | ||
*) | *) |
Version vom 10. Januar 2006, 16:13 Uhr
Script von noad.
#!/bin/bash # # 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 --background --ac3 --overlap --jumplogo --comments --OSD --statisticfile=/var/log/vdr/noad.log" VDR_VIDEO="/video0" # CONFIG END 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 echo "noad $NOADOPTS \"$2\" >/dev/null 2>&1" | at now echo $"Noad startet" ... ;; -batch) while read i ; do echo "noad $NOADOPTS \"$i\" >/dev/null 2>&1" echo "while pidof noad >/dev/null ; do sleep 10s ; done" done < <(find "$VDR_VIDEO" -follow -name "*.rec") | at now ;; -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 fi echo $"Noad is not active" ... ;; -killall) pidof noad | xargs -r kill ;; -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