summaryrefslogtreecommitdiff
path: root/vdr/scripts
diff options
context:
space:
mode:
authorroot <root@elwms02.(none)>2010-04-06 16:13:08 +0200
committerroot <root@elwms02.(none)>2010-04-06 16:13:08 +0200
commit0e7005fcc7483c01aa102fbea358c5ac65a48d62 (patch)
tree11517ce0d3d2977c6732b3aa583b0008083e0bd3 /vdr/scripts
downloadx-vdr-0e7005fcc7483c01aa102fbea358c5ac65a48d62.tar.gz
x-vdr-0e7005fcc7483c01aa102fbea358c5ac65a48d62.tar.bz2
hello world
Diffstat (limited to 'vdr/scripts')
-rw-r--r--vdr/scripts/README.DE_burn-bc142
-rw-r--r--vdr/scripts/burn-bc838
-rw-r--r--vdr/scripts/runvdr247
-rw-r--r--vdr/scripts/runvdr-old319
-rw-r--r--vdr/scripts/timerrep.sh63
-rw-r--r--vdr/scripts/vdr130
-rw-r--r--vdr/scripts/vdr-no-shutdown12
-rw-r--r--vdr/scripts/vdr2root244
-rw-r--r--vdr/scripts/vdrmount35
-rw-r--r--vdr/scripts/vdrnoad99
-rw-r--r--vdr/scripts/vdrplayer279
-rw-r--r--vdr/scripts/vdrreaddvd31
-rw-r--r--vdr/scripts/vdrreccmds32
-rw-r--r--vdr/scripts/vdrsettime8
-rw-r--r--vdr/scripts/vdrsetup1896
-rw-r--r--vdr/scripts/vdrshutdown214
-rw-r--r--vdr/scripts/vdrwritedvd17
-rw-r--r--vdr/scripts/x-lcd26
18 files changed, 4632 insertions, 0 deletions
diff --git a/vdr/scripts/README.DE_burn-bc b/vdr/scripts/README.DE_burn-bc
new file mode 100644
index 0000000..831f9e1
--- /dev/null
+++ b/vdr/scripts/README.DE_burn-bc
@@ -0,0 +1,142 @@
+burn-bc (burn background creator 0.0.5) - readme 2007-07-01
+===================================================
+Beschreibung:
+=================
+burn-bc ist ein Skript zum erstellen von Hintergründen für das burn-plugin des VDR.
+Das Skript kann per Terminal, Maus (Xdialog) oder aus dem VDR-Menu bedient werden.
+Es können Bilder aus der eigenen Sammlung oder Screenshots der laufenden Sendung bzw. Aufzeichnung verwendet werden.
+Die Bilder werden mit auswählbaren Filtern bearbeitet und an die entsprechenden Stellen kopiert.
+Textfelder können gezeichnet oder als Template eingeblendet eingebelndet werden.
+
+=================
+Vorraussetzungen:
+=================
+ImageMagick 6.2.4
+svdrpsend.pl (zum erstellen der Screenshots)
+sharutils (zum erstellen der Screenshots)
+Xdialog (optional)
+at (optional)
+
+=================
+Installation:
+=================
+Am einfachsten ist es, burn-bc nach /usr/bin zu kopieren und ausführbar zu machen.
+# terminal
+cp ./burn-bc /usr/bin
+chmod 755 /usr/bin/burn-bc
+
+Das Skript kann aber auch an jeder anderen Stelle abgelegt werden.
+Nur muss dann der Pfad beim aufrufen mit angegeben werden.
+
+Damit burn-bc aus dem VDR-Menu bedienbar ist, muss die commands.conf angepasst werden:
+burn-bc : echo "/usr/bin/burn-bc -f 'crop zoom-center resize draw-storke unsharp' -w default"|at now
+
+Wer auch eigene Bilder verwenden möchte, kann zum aufrufen das image-plugin benutzen und dafür die imagecmds.conf ergänzen:
+burn-bc : echo "/usr/bin/burn-bc -f 'draw-storke unsharp' -w default -i %s"|at now
+
+Weitere Beispiele gibt es weiter unten...
+
+=================
+Filter:
+=================
+# Optimierung
+crop -> Ränder abschneiden
+
+# Bildausschnitt
+zoom-center -> Zoom auf die Mitte des Bildes
+zoom-left -> Zoom auf die linke Seite des Bildes
+zoom-right -> Zoom auf die rechte Seite des Bildes
+zoom-center-16x9 -> Zoom auf die Mitte eines anamorphen 16/9 Bildes
+zoom-left-16x9 -> Zoom auf die linke Seite eines anamorphen 16/9 Bildes
+zoom-right-16x9 -> Zoom auf die rechte Seite eines anamorphen 16/9 Bildes
+letterbox-16x9 -> Erzeugt ein Letterbox Bild aus einem anamorphen 16/9 Bild
+
+# Optimierung (nach dem Ränder abschneiden oder zoomen notwendig)
+resize -> Skaliert das Bild auf 720x576
+
+# Textfelder
+comp-atop -> Legt ein Template über das Bild
+comp-blend -> Blendet ein Template in das Bild
+draw-bigsize -> Zeichnet zwei grosse, transparente Textfelder mit Rahmen über das Bild
+draw-normal -> Zeichnet zwei transparente Textfelder mit runde Ecken über das Bild
+draw-storke -> Zeichnet zwei transparente Textfelder mit runde Ecken und Rahmen über das Bild
+draw-user -> Zeichnet die Textfelder über das Bild (zum anpassen gedacht)
+
+# Fun
+serial-foto -> Legt eine Serie von vier bzw fünf (bei 16/9 Filmen) verkleinerten Screenshots über das Bild
+serial-movie -> Montiert eine Serie von fünf Screenshots zu einem Filmstreifen und legt diesen über das Bild
+tux -> Blendet ein Bild (das als Template "$targetdir/tux.png" vorliegen muss) in den unteren rechten Teil des Textfeldes ein.
+watermark -> Blendet einen Schriftzug in den unteren rechten Teil des Textfeldes ein.
+
+# Optimierung
+sharpen -> Leichtes anheben der Bildschärfe
+depth -> Reduziert die Farbtiefe auf 24bpp (damit das Bild mit dem Image-Plugin angezeigt werden kann)
+
+=================
+Tipps:
+=================
+Auf die Reihenfolge der Filter achten und nie mehr als notwendig verwenden.
+
+=================
+Argumente:
+=================
+burn-bc [-argument wert]
+Optionale Argumente sind:
+-f | -filter crop
+-f | -filter zoom-center|zoom-left|zoom-right|zoom-center-16x9|zoom-left-16x9|zoom-right-16x9|letterbox-16x9
+-f | -filter resize
+-f | -filter comp-atop|comp-blend|draw-bigsize|draw-normal|draw-storke|draw-user
+-f | -filter serial-foto|serial-movie
+-f | -filter tux
+-f | -filter sharpen
+-f | -filter depth
+-i | -image /path/to/image.ext
+-o | -osd on|off
+-t | -target /path/to/plugins/burn/menu-bg.png
+-T | -template /path/to/template.png
+-w | -watermark ?|default|"some text"
+-W | -width 720|768
+-x | -showfile on|off
+-d | -dialog
+-h | -help
+-v | -version
+
+Terminal:
+=================
+burn-bc -w default -f crop -f resize -f draw-storke'
+burn-bc -f 'crop zoom-center resize draw-storke unsharp depth' -o off -w default
+burn-bc -f draw-normal -w default -i ~/bilder/image.jpg
+
+Xdialog:
+=================
+burn-bc
+burn-bc -d -w " Dokumentation"
+burn-bc -d -w ?
+
+KDE Kontext-Menu (rechte Maustaste):
+burn-bc -d -w ? -i %f
+
+commands.conf
+=================
+d v d - b c : echo "sub menu"
+- Draw Only : echo "/usr/bin/burn-bc -f draw-storke -w default"|at now
+- Simple Cropping : echo "/usr/bin/burn-bc -f 'crop resize draw-storke unsharp' -w default"|at now
+- Zoom Center : echo "/usr/bin/burn-bc -f 'crop zoom-center resize draw-storke unsharp' -w default"|at now
+- Zoom Left : echo "/usr/bin/burn-bc -f 'crop zoom-left resize draw-storke unsharp' -w default"|at now
+- Zoom Right : echo "/usr/bin/burn-bc -f 'crop zoom-right resize draw-storke unsharp' -w default"|at now
+- Serial Foto : echo "/usr/bin/burn-bc -f 'crop zoom-center resize draw-storke serial-foto unsharp' -w default"|at now
+- Serial Movie : echo "/usr/bin/burn-bc -f 'crop zoom-center resize draw-storke serial-movie unsharp' -w default"|at now
+
+imagecmds.conf
+=================
+# ? - Bestätigung anfordern, (optional)
+# %s - Platzhalter für Dateinamen (optional)
+# burn-bc
+Draw Only : echo "/usr/bin/burn-bc -f draw-storke -w default -i %s"|at now
+Resize Only : echo "/usr/bin/burn-bc -f 'draw-storke unsharp' -w default -i %s"|at now
+Simple Cropping : echo "/usr/bin/burn-bc -f 'crop resize draw-storke unsharp' -w default -i %s"|at now
+Zoom Center : echo "/usr/bin/burn-bc -f 'zoom-center resize draw-storke unsharp' -w default -i %s"|at now
+Zoom Left : echo "/usr/bin/burn-bc -f 'crop zoom-left resize draw-storke unsharp' -w default -i %s"|at now
+Zoom Right : echo "/usr/bin/burn-bc -f 'crop zoom-right resize draw-storke unsharp' -w default -i %s"|at now
+Symlink anlegen : echo ln -fs '%s' /var/lib/vdr/plugins/burn/menu-bg.png | sh
+
diff --git a/vdr/scripts/burn-bc b/vdr/scripts/burn-bc
new file mode 100644
index 0000000..750b4d9
--- /dev/null
+++ b/vdr/scripts/burn-bc
@@ -0,0 +1,838 @@
+#! /bin/bash
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+script="burn-bc" #
+version="burn background creator 0.0.5" #
+# written by Marc Wernecke #
+# date: 2007-07-01 #
+# use: script [-argument value] #
+# optional arguments are: #
+# -f | -filter crop #
+# zoom-center|zoom-left|zoom-right| #
+# zoom-center-16x9|zoom-left-16x9|zoom-right-16x9|letterbox-16x9 #
+# resize #
+# comp-atop|comp-blend|draw-bigsize|draw-normal|draw-storke|draw-user #
+# serial-foto|serial-movie #
+# tux #
+# sharpen #
+# depth #
+# -i | -image /path/to/image.ext #
+# -t | -target /path/to/plugins/burn/menu-bg.png #
+# -T | -template /path/to/template.png #
+# -o | -osd on|off #
+# -w | -watermark ?|default|"some text" #
+# -W | -width 720|768 #
+# -x | -showfile on|off #
+# -d | -dialog #
+# -h | -help #
+# -v | -version #
+# #
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# #
+# defaults: #
+FILTER="" # filter1 filter2 #
+IMAGE="" # /path/file #
+INFO="off" # on|off #
+OSDMSG="on" # on|off #
+TARGET="$HOME/plugins/burn/menu-bg.png" # /path/file.ext #
+TEMPLATE="template.png" # /path/file.ext #
+WATERMARK="off" # on|off #
+WIDTH="768" # 720|768 #
+WMTEXT=" powered by VDR" # "some text" #
+SHOWFILE="off" # on|off #
+TMPDIR="/tmp" # /path #
+SVDRPSEND="svdrpsend.pl" # /path/file.ext #
+# #
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+args="$*"
+language="deu"
+
+# svdrpsend.pl
+TEST=$(which $SVDRPSEND)
+if [ ! "$TEST" ]; then
+ SVDRPSEND="$(grep "^VDRBINDIR=" /etc/default/vdr | cut -d "=" -f 2 | sed -e 's/\"//g')/svdrpsend.pl"
+ if [ ! -x "$SVDRPSEND" ]; then
+ echo "svdrpsend.pl not found"
+ exit 2
+ fi
+fi
+
+## FUNCTIONS
+function start_action() {
+ # target directory
+ test "${TARGET:0:1}" = "/"
+ if [ "x$?" != "x0" ]; then
+ echo "$script: TARGET must be an absolute path ..."
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: TARGET must be an absolute path"
+ exit 3
+ fi
+ targetdir="$(dirname $TARGET)"
+ if [ ! -d "$targetdir/$script" ]; then
+ mkdir -p "$targetdir/$script"
+ if [ ! -d "$targetdir/$script" ]; then
+ echo "$script: Could not create $targetdir/$script ..."
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: Could not create $targetdir/$script"
+ exit 3
+ fi
+ fi
+
+ # temp directory
+ test "${TMPDIR:0:1}" = "/"
+ if [ "x$?" != "x0" ]; then
+ echo "$script: TMPDIR must be an absolute path ..."
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: TMPDIR must be an absolute path"
+ exit 4
+ fi
+ if [ ! -d "$TMPDIR" ]; then
+ echo "$script: $TMPDIR not found ..."
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: $TMPDIR not found"
+ exit 4
+ fi
+ tmpdir="$TMPDIR/$$$script"
+ mkdir -p "$tmpdir"
+
+ # image
+ if [ -f "$IMAGE" ]; then
+ image=$(basename "$IMAGE")
+ convert -extent $(identify -format "%wx%h" "$IMAGE") "$IMAGE" "$tmpdir/$image"
+ else
+ image="burn-bg_$(date '+%F_%T').jpg"
+ IMAGE="$image" # this is for logging only
+ $SVDRPSEND grab - 100 $WIDTH 576 | \
+ sed -n -e 's/^216-//p' -e '1ibegin-base64 644 -' -e '$a====' | \
+ uudecode -o "$tmpdir/$image" # <- was passiert hier bei sed mit dem image?
+ BYTES=$(ls -l "$tmpdir/$image" | tr -s " " | cut -d " " -f 5)
+ if [ "$BYTES" = "0" ]; then
+ echo "$script: Snapshot is empty ..."
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: Snapshot is empty"
+ exit 5
+ fi
+ fi
+
+ # check if temp image exists
+ if [ ! -f "$tmpdir/$image" ]; then
+ echo "$script: Image not found ..."
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: Image not found"
+ exit 6
+ fi
+
+ # resize temp image to 720x576 if necessary
+ f_resize
+}
+
+# filter functions
+function f_comp() {
+ # template.png
+ if [ -f "$TEMPLATE" ]; then
+ template="$TEMPLATE"
+ elif [ -f "$targetdir/$TEMPLATE" ]; then
+ template="$targetdir/$TEMPLATE"
+ else
+ template="$targetdir/template.png"
+ fi
+ if [ ! -f "$template" ]; then
+ echo "$script: $template not found ..."
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: $template not found"
+ exit 7
+ fi
+
+ if [ "$WATERMARK" = "on" ]; then
+ convert -font helvetica -fill black -pointsize 32 -draw "text 250,460 '$WMTEXT'" "$template" "$tmpdir/template.png"
+ template="$tmpdir/template.png"
+ fi
+
+ case $1 in
+ atop)
+ composite -gravity center -compose atop -quality 100 "$template" "$tmpdir/$image" "$tmpdir/tmp_$image"
+ ;;
+ blend)
+ image_s=$(identify -format "%wx%h" "$template")
+ composite -gravity center -blend $image_s -quality 100 "$template" "$tmpdir/$image" "$tmpdir/tmp_$image"
+ ;;
+ esac
+ cp -f "$tmpdir/tmp_$image" "$tmpdir/$image"
+}
+
+function f_crop() {
+ array=($(identify -format "%w %h" "$tmpdir/$image"))
+ image_w=${array[0]}
+ image_h=${array[1]}
+ crop_w=$(($image_w / 36))
+ crop_h=$(($image_h / 36))
+ new_w=$(($image_w - $crop_w * 2))
+ new_h=$(($image_h - $crop_h * 2))
+ new_s=$(echo "$new_w x $new_h" | sed -e 's/ //g')
+ mogrify -crop $new_s+$crop_w+$crop_h "$tmpdir/$image"
+ mogrify -extent $new_s "$tmpdir/$image"
+}
+
+function f_depth() {
+ mogrify -depth 8 "$tmpdir/$image" # 8 or 16
+}
+
+function f_draw() {
+ template="$tmpdir/template.png"
+ # create template.png
+ case $1 in
+ bigsize)
+ convert -size 720x576 xc:transparent -fill "#000000" \
+ -stroke "#ffffff" -strokewidth 2 \
+ -draw 'rectangle 60,35 660,95' \
+ -draw 'rectangle 60,105 660,475' "$tmpdir/tmp.png"
+ tux_align="right"
+ ;;
+ normal)
+ convert -size 720x576 xc:transparent -fill "#000000" \
+ -draw 'roundRectangle 70,35 650,95 10,10' \
+ -draw 'roundRectangle 70,105 550,475 10,10' "$tmpdir/tmp.png"
+ ;;
+ storke)
+ convert -size 720x576 xc:transparent -fill "#000000" \
+ -stroke "#ffffff" -strokewidth 2 \
+ -draw 'roundRectangle 70,35 650,95 10,10' \
+ -draw 'roundRectangle 70,105 550,475 10,10' "$tmpdir/tmp.png"
+ ;;
+ user)
+ convert -size 720x576 xc:transparent -fill "#000000" \
+ -stroke "#303030" -strokewidth 5 \
+ -draw 'polygon 70,35 650,35 650,95 550,95 550,475 70,475' "$tmpdir/tmp.png"
+ ;;
+ esac
+
+ # reduce alphachannel about 50% and create the watermark
+ if [ "$WATERMARK" = "on" ]; then
+ convert -font helvetica -fill "#303030" -pointsize 32 -draw "text 250,460 '$WMTEXT'" -channel Alpha -fx 'u/2.0' "$tmpdir/tmp.png" "$template"
+ else
+ convert -channel Alpha -fx 'u/2.0' "$tmpdir/tmp.png" "$template"
+ fi
+ # composite
+ composite -gravity center -compose atop -quality 100 "$template" "$tmpdir/$image" "$tmpdir/tmp_$image"
+ cp -f "$tmpdir/tmp_$image" "$tmpdir/$image"
+}
+
+function f_resize() {
+ image_h=$(identify -format "%h" "$tmpdir/$image")
+ (($image_h != 576)) && mogrify -resize x576 "$tmpdir/$image"
+ image_w=$(identify -format "%w" "$tmpdir/$image")
+ if (($image_w > 720)); then
+ crop_w=$((($image_w - 720) / 2))
+ mogrify -crop 720x576+${crop_w}+0 "$tmpdir/$image"
+ elif (($image_w < 720)); then
+ mogrify -resize 720 "$tmpdir/$image"
+ image_h=$(identify -format "%h" "$tmpdir/$image")
+ crop_h=$((($image_h - 576) / 2))
+ (($image_h > 576)) && mogrify -crop 720x576+0+$crop_h "$tmpdir/$image"
+ fi
+ mogrify -extent 720x576 "$tmpdir/$image"
+}
+
+function f_serial_foto() {
+ aspect="4x3"
+ sec=1
+ images=""
+ x=130
+ while [ $sec -le 4 ]; do
+ sleep 5
+ $SVDRPSEND grab - 100 $WIDTH 576 | \
+ sed -n -e 's/^216-//p' -e '1ibegin-base64 644 -' -e '$a====' | \
+ uudecode -o "$tmpdir/serial-$sec.jpg"
+ BYTES=$(ls -l "$tmpdir/serial-$sec.jpg" | tr -s " " | cut -d " " -f 5)
+ if [ "$BYTES" = "0" ]; then
+ echo "$script: Snapshot is empty ..."
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: Snapshot is empty"
+ return 1
+ fi
+ [ "$WIDTH" = "768" ] && mogrify -crop 720x576+24+0 "$tmpdir/serial-$sec.jpg"
+
+ # autodetect blackbars
+ if [ "$aspect" != "16x9" ] && [ ! -f "$tmpdir/blackbar.jpg" ]; then
+ cp -f "$tmpdir/serial-$sec.jpg" "$tmpdir/blackbar.jpg"
+ mogrify -crop 720x5+0+566 "$tmpdir/blackbar.jpg"
+ colors=$(identify -verbose "$tmpdir/blackbar.jpg" | grep Type: | cut -d ":" -f2 | sed -e 's/ //g')
+ [ "$colors" = "Grayscale" ] && aspect="16x9"
+ fi
+ case $aspect in
+ 4x3)
+ mogrify -crop 680x544+20+16 "$tmpdir/serial-$sec.jpg"
+ ;;
+ 16x9)
+ mogrify -crop 680x382+20+97 "$tmpdir/serial-$sec.jpg"
+ ;;
+ esac
+
+ mogrify -resize 90x "$tmpdir/serial-$sec.jpg"
+ composite -compose atop -geometry +560+$x -quality 100 "$tmpdir/serial-$sec.jpg" "$tmpdir/$image" "$tmpdir/tmp_$image"
+ cp -f "$tmpdir/tmp_$image" "$tmpdir/$image"
+ sec=$(($sec+1))
+ ((x=$x+82))
+ done
+ tux_align="center"
+}
+
+function f_serial_movie() {
+ aspect="4x3"
+ sec=1
+ images=""
+ while [ $sec -le 5 ]; do
+ sleep 5
+ $SVDRPSEND grab - 100 $WIDTH 576 | \
+ sed -n -e 's/^216-//p' -e '1ibegin-base64 644 -' -e '$a====' | \
+ uudecode -o "$tmpdir/serial-$sec.jpg"
+ BYTES=$(ls -l "$tmpdir/serial-$sec.jpg" | tr -s " " | cut -d " " -f 5)
+ if [ "$BYTES" = "0" ]; then
+ echo "$script: Snapshot is empty ..."
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: Snapshot is empty"
+ return 1
+ fi
+ images="$images $tmpdir/serial-$sec.jpg"
+ [ "$WIDTH" = "768" ] && mogrify -crop 720x576+24+0 "$tmpdir/serial-$sec.jpg"
+# mogrify -crop 680x544+20+16 "$tmpdir/serial-$sec.jpg"
+ # autodetect blackbars
+ if [ "$aspect" != "16x9" ] && [ ! -f "$tmpdir/blackbar.jpg" ]; then
+ cp -f "$tmpdir/serial-$sec.jpg" "$tmpdir/blackbar.jpg"
+ mogrify -crop 720x5+0+566 "$tmpdir/blackbar.jpg"
+ colors=$(identify -verbose "$tmpdir/blackbar.jpg" | grep Type: | cut -d ":" -f2 | sed -e 's/ //g')
+ [ "$colors" = "Grayscale" ] && aspect="16x9"
+ fi
+ case $aspect in
+ 4x3)
+ mogrify -crop 680x544+20+16 "$tmpdir/serial-$sec.jpg"
+ ;;
+ 16x9)
+ mogrify -crop 680x382+20+97 "$tmpdir/serial-$sec.jpg"
+ ;;
+ esac
+ sec=$(($sec+1))
+ done
+ montage -background "#000000" -tile 5x1 -geometry +10+60 -rotate -90 $images "$tmpdir/montage.jpg"
+ mogrify -fill "#ffffff" \
+ -draw 'rectangle 10,10 50,50' \
+ -draw 'rectangle 70,10 110,50' \
+ -draw 'rectangle 130,10 170,50' \
+ -draw 'rectangle 190,10 230,50' \
+ -draw 'rectangle 250,10 290,50' \
+ -draw 'rectangle 310,10 350,50' \
+ -draw 'rectangle 370,10 410,50' \
+ -draw 'rectangle 430,10 470,50' \
+ -draw 'rectangle 490,10 530,50' \
+ -draw 'rectangle 550,10 590,50' \
+ -draw 'rectangle 610,10 650,50' \
+ -draw 'rectangle 670,10 710,50' \
+ -draw 'rectangle 730,10 770,50' \
+ -draw 'rectangle 790,10 830,50' \
+ -draw 'rectangle 850,10 890,50' \
+ -draw 'rectangle 910,10 950,50' \
+ -draw 'rectangle 970,10 1010,50' \
+ -draw 'rectangle 1030,10 1070,50' \
+ -draw 'rectangle 1090,10 1130,50' \
+ -draw 'rectangle 1150,10 1190,50' \
+ -draw 'rectangle 1210,10 1250,50' \
+ -draw 'rectangle 1270,10 1310,50' \
+ -draw 'rectangle 1330,10 1370,50' \
+ -draw 'rectangle 1390,10 1430,50' \
+ -draw 'rectangle 1450,10 1490,50' \
+ -draw 'rectangle 1510,10 1550,50' \
+ -draw 'rectangle 1570,10 1610,50' \
+ -draw 'rectangle 1630,10 1670,50' \
+ -draw 'rectangle 1690,10 1730,50' \
+ -draw 'rectangle 1750,10 1790,50' \
+ -draw 'rectangle 1810,10 1850,50' \
+ -draw 'rectangle 1870,10 1910,50' \
+ -draw 'rectangle 1930,10 1970,50' \
+ -draw 'rectangle 1990,10 2030,50' \
+ -draw 'rectangle 2050,10 2090,50' \
+ -draw 'rectangle 2110,10 2150,50' \
+ -draw 'rectangle 2170,10 2210,50' \
+ -draw 'rectangle 2230,10 2270,50' \
+ -draw 'rectangle 2290,10 2330,50' \
+ -draw 'rectangle 2350,10 2390,50' \
+ -draw 'rectangle 2410,10 2450,50' \
+ -draw 'rectangle 2470,10 2510,50' \
+ -draw 'rectangle 2530,10 2570,50' \
+ -draw 'rectangle 2590,10 2630,50' \
+ -draw 'rectangle 2650,10 2690,50' \
+ -draw 'rectangle 2710,10 2750,50' \
+ -draw 'rectangle 2770,10 2810,50' \
+ -draw 'rectangle 10,750 50,790' \
+ -draw 'rectangle 70,750 110,790' \
+ -draw 'rectangle 130,750 170,790' \
+ -draw 'rectangle 190,750 230,790' \
+ -draw 'rectangle 250,750 290,790' \
+ -draw 'rectangle 310,750 350,790' \
+ -draw 'rectangle 370,750 410,790' \
+ -draw 'rectangle 430,750 470,790' \
+ -draw 'rectangle 490,750 530,790' \
+ -draw 'rectangle 550,750 590,790' \
+ -draw 'rectangle 610,750 650,790' \
+ -draw 'rectangle 670,750 710,790' \
+ -draw 'rectangle 730,750 770,790' \
+ -draw 'rectangle 790,750 830,790' \
+ -draw 'rectangle 850,750 890,790' \
+ -draw 'rectangle 910,750 950,790' \
+ -draw 'rectangle 970,750 1010,790' \
+ -draw 'rectangle 1030,750 1070,790' \
+ -draw 'rectangle 1090,750 1130,790' \
+ -draw 'rectangle 1150,750 1190,790' \
+ -draw 'rectangle 1210,750 1250,790' \
+ -draw 'rectangle 1270,750 1310,790' \
+ -draw 'rectangle 1330,750 1370,790' \
+ -draw 'rectangle 1390,750 1430,790' \
+ -draw 'rectangle 1450,750 1490,790' \
+ -draw 'rectangle 1510,750 1550,790' \
+ -draw 'rectangle 1570,750 1610,790' \
+ -draw 'rectangle 1630,750 1670,790' \
+ -draw 'rectangle 1690,750 1730,790' \
+ -draw 'rectangle 1750,750 1790,790' \
+ -draw 'rectangle 1810,750 1850,790' \
+ -draw 'rectangle 1870,750 1910,790' \
+ -draw 'rectangle 1930,750 1970,790' \
+ -draw 'rectangle 1990,750 2030,790' \
+ -draw 'rectangle 2050,750 2090,790' \
+ -draw 'rectangle 2110,750 2150,790' \
+ -draw 'rectangle 2170,750 2210,790' \
+ -draw 'rectangle 2230,750 2270,790' \
+ -draw 'rectangle 2290,750 2330,790' \
+ -draw 'rectangle 2350,750 2390,790' \
+ -draw 'rectangle 2410,750 2450,790' \
+ -draw 'rectangle 2470,750 2510,790' \
+ -draw 'rectangle 2530,750 2570,790' \
+ -draw 'rectangle 2590,750 2630,790' \
+ -draw 'rectangle 2650,750 2690,790' \
+ -draw 'rectangle 2710,750 2750,790' \
+ -draw 'rectangle 2770,750 2810,790' \
+ "$tmpdir/montage.jpg"
+ mogrify -rotate 90 -resize 90x "$tmpdir/montage.jpg"
+ composite -compose atop -geometry +560+130 -quality 100 "$tmpdir/montage.jpg" "$tmpdir/$image" "$tmpdir/tmp_$image"
+ cp -f "$tmpdir/tmp_$image" "$tmpdir/$image"
+ tux_align="center"
+}
+
+function f_sharpen() {
+ mogrify -unsharp 0 "$tmpdir/$image"
+}
+
+function f_tux() {
+ # template
+ template="$targetdir/tux.png"
+ if [ ! -f "$template" ]; then
+ echo "$script: $template not found ..."
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: $template not found"
+ return 1
+ fi
+ array=($(identify -format "%w %h" "$template"))
+ image_w=${array[0]}
+ image_h=${array[1]}
+ new_w=$((550 - $image_w))
+ new_h=$((475 - $image_h))
+ [ "$tux_align" = "right" ] && new_w=$((660 - $image_w))
+ [ "$WATERMARK" = "on" ] && new_h=$((440 - $image_w))
+ tux_align="center"
+ convert -channel Alpha -fx 'u/4.0' "$template" "$tmpdir/tmp.png"
+ composite -compose atop -geometry +$new_w+$new_h -quality 100 "$tmpdir/tmp.png" "$tmpdir/$image" "$tmpdir/tmp_$image"
+ cp -f "$tmpdir/tmp_$image" "$tmpdir/$image"
+}
+
+function f_zoom_center() {
+ array=($(identify -format "%w %h" "$tmpdir/$image"))
+ image_w=${array[0]}
+ image_h=${array[1]}
+ new_w=$(($image_w * 3 / 4))
+ new_h=$(($image_h * 3 / 4))
+ crop_w=$((($image_w - $new_w) / 2))
+ crop_h=$((($image_h - $new_h) / 2))
+ new_s=$(echo "$new_w x $new_h" | sed -e 's/ //g')
+ mogrify -crop $new_s+$crop_w+$crop_h "$tmpdir/$image"
+ mogrify -extent $new_s "$tmpdir/$image"
+}
+
+function f_zoom_left() {
+ array=($(identify -format "%w %h" "$tmpdir/$image"))
+ image_w=${array[0]}
+ image_h=${array[1]}
+ new_w=$(($image_w * 3 / 4))
+ new_h=$(($image_h * 3 / 4))
+ crop_w=0
+ crop_h=$((($image_h - $new_h) / 2))
+ new_s=$(echo "$new_w x $new_h" | sed -e 's/ //g')
+ mogrify -crop $new_s+$crop_w+$crop_h "$tmpdir/$image"
+ mogrify -extent $new_s "$tmpdir/$image"
+}
+
+function f_zoom_right() {
+ array=($(identify -format "%w %h" "$tmpdir/$image"))
+ image_w=${array[0]}
+ image_h=${array[1]}
+ new_w=$(($image_w * 3 / 4))
+ new_h=$(($image_h * 3 / 4))
+ crop_w=$(($image_w - $new_w))
+ crop_h=$((($image_h - $new_h) / 2))
+ new_s=$(echo "$new_w x $new_h" | sed -e 's/ //g')
+ mogrify -crop $new_s+$crop_w+$crop_h "$tmpdir/$image"
+ mogrify -extent $new_s "$tmpdir/$image"
+}
+
+function f_zoom_center_16x9() {
+ array=($(identify -format "%wx%h %w %h" "$tmpdir/$image"))
+ image_s=${array[0]}
+ image_w=${array[1]}
+ image_h=${array[2]}
+ new_w=$(($image_h * 16 / 9))
+ crop_w=$((($new_w - $image_w) / 2))
+ new_s=$(echo "$new_w x $image_h" | sed -e 's/ //g')
+ mogrify -resize $new_s\! -crop $image_s+$crop_w+0 "$tmpdir/$image"
+ mogrify -extent $image_s "$tmpdir/$image"
+}
+
+function f_zoom_left_16x9() {
+ array=($(identify -format "%wx%h %w %h" "$tmpdir/$image"))
+ image_s=${array[0]}
+ image_w=${array[1]}
+ image_h=${array[2]}
+ new_w=$(($image_h * 16 / 9))
+ crop_w=0
+ new_s=$(echo "$new_w x $image_h" | sed -e 's/ //g')
+ mogrify -resize $new_s\! -crop $image_s+$crop_w+0 "$tmpdir/$image"
+ mogrify -extent $image_s "$tmpdir/$image"
+}
+
+function f_zoom_right_16x9() {
+ array=($(identify -format "%wx%h %w %h" "$tmpdir/$image"))
+ image_s=${array[0]}
+ image_w=${array[1]}
+ image_h=${array[2]}
+ new_w=$(($image_h * 16 / 9))
+ crop_w=$(($new_w - $image_w))
+ new_s=$(echo "$new_w x $image_h" | sed -e 's/ //g')
+ mogrify -resize $new_s\! -crop $image_s+$crop_w+0 "$tmpdir/$image"
+ mogrify -extent $image_s "$tmpdir/$image"
+}
+
+function f_letterbox_16x9() {
+ array=($(identify -format "%wx%h %w %h" "$tmpdir/$image"))
+ image_s=${array[0]}
+ image_w=${array[1]}
+ image_h=${array[2]}
+ new_w=$(($image_h * 16 / 9))
+ new_h=$(($new_w * 4 / 5))
+ (( new_h == 819 )) && new_h=820
+ bar=$((($new_h - $image_h) / 2))
+ new_h1=$(($image_h + $bar))
+ new_h2=$(($image_h + $bar + $bar))
+ new_s1=$(echo "$image_w x $new_h1" | sed -e 's/ //g')
+ new_s2=$(echo "$image_w x $new_h2" | sed -e 's/ //g')
+ mogrify -rotate 180 -extent $new_s1 -rotate 180 -extent $new_s2 -resize $image_s\! "$tmpdir/$image"
+}
+
+function filter_select() {
+ for f in $FILTER; do
+ case $f in
+ comp-atop)
+ f_comp atop
+ ;;
+ comp-blend)
+ f_comp blend
+ ;;
+ crop)
+ f_crop
+ ;;
+ depth)
+ f_depth
+ ;;
+ draw-bigsize)
+ f_draw bigsize
+ ;;
+ draw-normal)
+ f_draw normal
+ ;;
+ draw-storke)
+ f_draw storke
+ ;;
+ draw-user)
+ f_draw user
+ ;;
+ resize)
+ f_resize
+ ;;
+ serial-foto)
+ f_serial_foto
+ ;;
+ serial-movie)
+ f_serial_movie
+ ;;
+ sharpen)
+ f_sharpen
+ ;;
+ tux)
+ f_tux right
+ ;;
+ zoom-center)
+ f_zoom_center
+ ;;
+ zoom-left)
+ f_zoom_left
+ ;;
+ zoom-right)
+ f_zoom_right
+ ;;
+ zoom-center-16x9)
+ f_zoom_center_16x9
+ ;;
+ zoom-left-16x9)
+ f_zoom_left_16x9
+ ;;
+ zoom-right-16x9)
+ f_zoom_right_16x9
+ ;;
+ letterbox-16x9)
+ f_letterbox_16x9
+ ;;
+ esac
+ done
+}
+
+function final_action() {
+ # install the new image
+ image_name=$(echo "$image" | cut -f1 -d "." - )
+ convert -comment "$version" "$tmpdir/$image" "$targetdir/$script/$image_name.png"
+ ln -fs "$targetdir/$script/$image_name.png" "$TARGET"
+
+ # clean up
+ rm -rf "$tmpdir"
+
+ # messages
+ [ "$OSDMSG" = "on" ] && $SVDRPSEND "MESG $script: Image created"
+
+ if [ "$INFO" = "on" ]; then
+ echo "$script: $(date '+%F %T')"
+ echo "image: $IMAGE"
+ echo "filter: $FILTER"
+ echo -n "target:"; identify -format "%f %wx%h" "$targetdir/$script/$image_name.png"
+ echo "template: $template"
+ echo "tmpdir: $tmpdir"
+ fi
+
+ [ "$SHOWFILE" = "on" ] && display "$targetdir/$script/$image_name.png" &
+}
+
+## PROG
+# arguments
+for i in $args; do
+ case $1 in
+ -showfile|-x)
+ shift 1
+ SHOWFILE="$1"
+ [ "$SHOWFILE" != "on" ] && SHOWFILE="off"
+ ;;
+ -filter|-f)
+ shift 1
+ FILTER="$FILTER $1"
+ ;;
+ -image|-i)
+ shift 1
+ IMAGE="$1"
+ ;;
+ -target|-t)
+ shift 1
+ TARGET="$1"
+ ;;
+ -template|-T)
+ shift 1
+ TEMPLATE="$1"
+ ;;
+ -osd|-o)
+ shift 1
+ OSDMSG="$1"
+ [ "$OSDMSG" != "on" ] && OSDMSG="off"
+ ;;
+ -watermark|-w)
+ shift 1
+ [ "$1" != "default" ] && WMTEXT="$1"
+ WATERMARK="on"
+ ;;
+ -width|-W)
+ shift 1
+ if [ "$1" = "768" ]; then
+ WIDTH="768"
+ else
+ WIDTH="720"
+ fi
+ ;;
+ -dialog|-d)
+ use_dialog="true"
+ ;;
+ -help|-h)
+ echo "$script ($version)"
+ echo "use: $script [-argument value]"
+ echo "optional arguments are:"
+ echo "-f | -filter crop"
+ echo "-f | -filter zoom-center|zoom-left|zoom-right|zoom-center-16x9|zoom-left-16x9|zoom-right-16x9|letterbox-16x9"
+ echo "-f | -filter resize"
+ echo "-f | -filter comp-atop|comp-blend|draw-bigsize|draw-normal|draw-storke|draw-user"
+ echo "-f | -filter serial-foto|serial-movie"
+ echo "-f | -filter tux"
+ echo "-f | -filter unsharp"
+ echo "-f | -filter depth"
+ echo "-i | -image /path/to/image.ext"
+ echo "-o | -osd on|off"
+ echo "-t | -target /path/to/plugins/burn/menu-bg.png"
+ echo "-T | -template /path/to/template.png"
+ echo "-w | -watermark ?|default|\"some text\""
+ echo "-W | -width 768|720"
+ echo "-x | -showfile on|off"
+ echo "-d | -dialog"
+ echo "-h | -help"
+ echo "-v | -version"
+ echo ""
+ exit 0
+ ;;
+ -version|-v)
+ echo "$script ($version)"
+ echo ""
+ exit 0
+ ;;
+ esac
+ shift 1
+done
+
+# MAIN PROG
+if [ ! "$args" ] || [ "$use_dialog" = "true" ]; then # DIALOG
+ # filter defaults
+ crop="on"
+ zoomcenter="off"
+ zoomleft="off"
+ zoomright="off"
+ resize="on"
+ drawbigsize="off"
+ drawnormal="off"
+ drawstorke="off"
+ drawuser="off"
+ serialfoto="off"
+ serialmovie="off"
+ tux="off"
+ sharpen="off"
+ depth="off"
+ SHOWFILE="on"
+ OSDMSG="off"
+
+ #WATERMARK="on"
+ # watermark text input
+ if [ "$WMTEXT" = "?" ]; then
+ WMTEXT_DEF=" powered by VDR"
+ case $language in
+ deu) menutext="Text fuer das Wasserzeichen" ;;
+ eng) menutext="Text for the watermark" ;;
+ fra) menutext="Watermark" ;;
+ esac
+ TMP_WMTEXT=`Xdialog --left --wrap --title " $version " --inputbox "$menutext" 0 0 "$WMTEXT_DEF" 3>&1 1>&2 2>&3`
+ if [ $? = 0 ]; then
+ WMTEXT="$TMP_WMTEXT"
+ else
+ WMTEXT="$WMTEXT_DEF"
+ fi
+ fi
+
+ # language
+ case $language in
+ deu)
+ # menutext
+ menutext="Von den Filtern mit zoom-*, draw-* oder serial-*\nsollte jeweils nur einer ausgewaehlt werden."
+ # helptext
+ text_crop="Raender abschneiden"
+ text_zoomcenter="Zoom auf die Mitte des Bildes"
+ text_zoomleft="Zoom auf die linke Seite des Bildes"
+ text_zoomright="Zoom auf die rechte Seite des Bildes"
+ text_resize="Skaliert das bearbeitete Bild wieder auf 720x576. Dieser Filter muss aktiviert werden, wenn crop oder zoom* benutzt werden"
+ text_drawbigsize="Zeichnet zwei grosse, transparente Textfelder mit Rahmen ueber das Bild"
+ text_drawnormal="Zeichnet zwei transparente Textfelder mit runde Ecken ueber das Bild"
+ text_drawstorke="Zeichnet zwei transparente Textfelder mit runde Ecken und Rahmen ueber das Bild"
+ text_drawuser="Zeichnet ueber das Bild"
+ text_watermark="Blendet ein Wasserzeichen in das Textfeld. Text: \"$WMTEXT\""
+ text_serialfoto="Legt eine Serie von vier verkleinerten Screenshots ueber das Bild"
+ text_serialmovie="Montiert eine Serie von fuenf Screenshots zu einem Filmstreifen und legt diesen ueber das Bild"
+ text_tux="Blendet einen Tux in das Bild"
+ text_sharpen="Leichtes anheben der Bildschaerfe"
+ text_depth="Reduziert die Farbtiefe auf 24bpp (damit das Bild mit dem Image-Plugin angezeigt werden kann)"
+ text_showfile="Fertiges Bild anzeigen"
+ ;;
+ eng)
+ ;;
+ fra)
+ ;;
+ esac
+
+ while true; do
+ options=`Xdialog --item-help --no-tags --left --wrap --separate-output --cancel-label "Exit" --title " $version " \
+ --checklist "$menutext" 0 0 17 \
+ "1" "crop" "$crop" "$text_crop" \
+ "2" "zoom-center" "$zoomcenter" "$text_zoomcenter" \
+ "3" "zoom-left" "$zoomleft" "$text_zoomleft" \
+ "4" "zoom-right" "$zoomright" "$text_zoomright" \
+ "5" "resize" "$resize" "$text_resize" \
+ "6" "draw-bigsize" "$drawbigsize" "$text_drawbigsize" \
+ "7" "draw-normal" "$drawnormal" "$text_drawnormal" \
+ "8" "draw-storke" "$drawstorke" "$text_drawstorke" \
+ "9" "draw-user" "$drawuser" "$text_drawuser" \
+ "10" "watermark" "$WATERMARK" "$text_watermark" \
+ "11" "serial-foto" "$serialfoto" "$text_serialfoto" \
+ "12" "serial-movie" "$serialmovie" "$text_serialmovie" \
+ "13" "tux" "$tux" "$text_tux" \
+ "14" "sharpen" "$sharpen" "$text_sharpen" \
+ "15" "depth" "$depth" "$text_depth" \
+ "16" "showfile" "$SHOWFILE" "$text_showfile" 3>&1 1>&2 2>&3`
+ [ $? != 0 ] && exit 0
+
+ # settings
+ FILTER=""
+ crop="off"
+ zoomcenter="off"
+ zoomleft="off"
+ zoomright="off"
+ resize="off"
+ drawbigsize="off"
+ drawnormal="off"
+ drawstorke="off"
+ drawuser="off"
+ serialfoto="off"
+ serialmovie="off"
+ tux="off"
+ sharpen="off"
+ depth="off"
+ SHOWFILE="off"
+ WATERMARK="off"
+
+ for i in $options; do
+ case "$i" in
+ 1) crop="on"; FILTER="$FILTER crop" ;;
+ 2) zoomcenter="on"; FILTER="$FILTER zoom-center" ;;
+ 3) zoomleft="on"; FILTER="$FILTER zoom-left" ;;
+ 4) zoomright="on"; FILTER="$FILTER zoom-right" ;;
+ 5) resize="on"; FILTER="$FILTER resize" ;;
+ 6) drawbigsize="on"; FILTER="$FILTER draw-bigsize" ;;
+ 7) drawnormal="on"; FILTER="$FILTER draw-normal" ;;
+ 8) drawstorke="on"; FILTER="$FILTER draw-storke" ;;
+ 9) drawuser="on"; FILTER="$FILTER draw-user" ;;
+ 10) WATERMARK="on" ;;
+ 11) serialfoto="on"; FILTER="$FILTER serial-foto" ;;
+ 12) serialmovie="on"; FILTER="$FILTER serial-movie" ;;
+ 13) tux="on"; FILTER="$FILTER tux" ;;
+ 14) sharpen="on"; FILTER="$FILTER sharpen" ;;
+ 15) depth="on"; FILTER="$FILTER depth" ;;
+ 16) SHOWFILE="on" ;;
+ esac
+ done
+ # action
+ start_action
+ # apply filter
+ filter_select
+ # final
+ final_action
+ done
+else # MAIN PROG
+ # action
+ start_action
+ # apply filter
+ filter_select
+ # final
+ final_action
+fi
+
+exit 0
diff --git a/vdr/scripts/runvdr b/vdr/scripts/runvdr
new file mode 100644
index 0000000..36115ea
--- /dev/null
+++ b/vdr/scripts/runvdr
@@ -0,0 +1,247 @@
+#!/bin/sh
+
+# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis)
+# von Marc Wernecke - www.zulu-entertainment.de
+# 24.03.2009
+# runvdr
+
+VDRLANG="de_DE.iso88591"
+VDRCHARSET="ISO-8859-9"
+KILL="/usr/bin/killall -q -TERM"
+KERNEL=`uname -r`
+VDRCONFIG=/etc/default/vdr
+LOGGER="logger -s ${0##*/} "
+
+function VdrSettings() {
+ # read vdr default configuration
+ if [ -f "$VDRCONFIG" ]; then
+ . $VDRCONFIG
+ else
+ $LOGGER "exit, because $VDRCONFIG does not exists"
+ exit 1
+ fi
+
+ # read sysconfig generated by setup-plugin
+ if [ "$setup" = "on" ] && [ -f "$VDRCONFDIR/plugins/setup/sysconfig" ]; then
+ . "$VDRCONFDIR/plugins/setup/sysconfig"
+ fi
+
+ # test if vdr exists and is executable
+ test -x "$VDRPRG" || exit 0
+
+ # create tmp files
+ $VDRPRG --help | sed -e '/^$/d' -e 's/^. //' > /tmp/vdr-help.tmp
+ $VDRPRG --version | sed -e 's/\(^[^ ]*\)\(.*$\)/\1_desc="\1\2"/' -e '/^streamdev/s/-/_/' -e 's/^\[.*//' | sort > /tmp/vdr-desc.cache
+
+ # export vdr language
+ export LANG=$VDRLANG
+ export LC_ALL=$VDRLANG
+ export VDR_CHARSET_OVERRIDE=$VDRCHARSET
+
+ # export HOME
+ if [ "$VDRUSER" = "root" ]; then
+ export HOME="/root"
+ else
+ export HOME="$VDRCONFDIR"
+ fi
+
+ # java / projectx for burn and dvdconvert
+ if [ "$burn" = "on" ] || [ "$dvdconvert" = "on" ]; then
+ [ -z "$JAVA_HOME" ] && export JAVA_HOME="/usr/lib/jvm/java-6-sun/jre"
+ [ -z "$PROJECTX_HOME" ] && export PROJECTX_HOME="/usr/bin/ProjectX"
+ fi
+
+ # set DISPLAY
+ # - activate automatic login
+ # - copy x-vdr/extra/xhost to ~/.kde/Autostart and set xhost executable
+ if [ "$softdevice" = "on" ] || [ "$xineliboutput" = "on" ]; then
+ [ -z "$DISPLAY" ] && export DISPLAY=:$XV_DISPLAY
+ fi
+
+ # load nvram
+ if [ `which nvram-wakeup | wc -l` -gt 0 ] && [ `lsmod | grep -cw 'nvram'` -eq 0 ]; then
+ modprobe -q nvram
+ fi
+
+ # load cdfs
+ if [ `lsmod | grep -cw 'cdfs'` -eq 0 ]; then
+ modprobe -q cdfs
+ fi
+
+ # load av7710ir
+ if [ -e /proc/av7110_ir ] || [ -e /proc/budget_ci_ir ]; then
+ for FILE in av7110_ir budget_ci_ir; do
+ if [ -e "/proc/$FILE" ]; then
+ chown $VDRUSER:$VDRGROUP /proc/$FILE
+ fi
+ done
+ if [ `lsmod | grep -cw 'evdev'` -eq 0 ]; then modprobe -q evdev ; fi
+ fi
+
+ # load em8300
+ if [ "$em8300" = "on" ]; then
+# EM8300="/lib/modules/$KERNEL/em8300"
+# if [ -f "$EM8300/adv717x.ko" ] && [ -f "$EM8300/bt865.ko" ] && [ -f "$EM8300/em8300.ko" ]; then
+# $VDRSCRIPTDIR/rmm
+# $VDRSCRIPTDIR/ldm
+ [ "$dxr3" != "on" ] && em8300setup
+# fi
+ fi
+
+ # load parport
+ if [ "$graphlcd_base" = "on" ]; then
+ [ `lsmod | grep -cw 'parport'` -eq 0 ] && modprobe -q parport
+ [ `lsmod | grep -cw 'parport_pc'` -eq 0 ] && modprobe -q parport_pc
+ [ `lsmod | grep -cw 'ppdev'` -eq 0 ] && modprobe -q ppdev
+# chmod 0666 /dev/parport0
+ fi
+
+ # only for mplayer via xine
+ # - copy x-vdr/extra/xhost to ~/.kde/Autostart and set xhost executable
+ if [ "$VDRUSER" != "root" ] && [ "$xine" = "on" ] && [ "$mplayer" = "on" ]; then
+ chmod 666 /dev/rtc
+# echo 1024 > /proc/sys/dev/rtc/max-user-freq
+ fi
+
+ # plugins
+ PLUGINS=""
+ ignore_cmd=""
+
+ if [ "$USE_SYSCONFIG" = "on" ]; then # use PLUGINLIST from sysconfig
+ PLUGINS="$PLUGINLIST"
+
+ else # start creating a temporary pluginlist ...
+ # plugin api version
+ plugin_api="$(grep -m1 '^vdr_desc=' /tmp/vdr-desc.cache | sed -e 's/^vdr_desc=//' -e 's/[^)]*$//' -e 's/^[^\/]*//g' -e 's/\///' -e 's/\/*)//')"
+ [ -n "$plugin_api" ] || plugin_api="$($VDRPRG --version | grep -m1 '^vdr ' | sed -e 's/[^)]*$//' -e 's/^[^\/]*//g' -e 's/\///' -e 's/\/*)//')"
+
+ # put these plugins on top of the pluginlist
+ if [ -n "$PLUGINS_ON_TOP" ]; then
+ for p in $PLUGINS_ON_TOP ; do
+ if [ -f "$VDRLIBDIR/libvdr-${p}.so.${plugin_api}" ]; then
+ ignore_cmd="$ignore_cmd -I libvdr-${p}.so.${plugin_api}"
+ plugin=$(echo $p | sed -e "s/-/_/g") # this is for streamdev-...
+ if [ "${!plugin}" = "on" ]; then
+ plugin_args="${plugin}_args"
+ if [ -n "${!plugin_args}" ]; then
+ PLUGINS="$PLUGINS -P'${p} ${!plugin_args}'"
+ else
+ PLUGINS="$PLUGINS -P'${p}'"
+ fi
+ fi
+ fi
+ done
+ fi
+
+ # read libdir and continue creating pluginlist
+ files=$(ls -B $ignore_cmd "$VDRLIBDIR" | grep "^libvdr-" | grep ".so.${plugin_api}$" | sed -e "s/^libvdr-//g" -e "s/.so.${plugin_api}$//g")
+ if [ -n "$files" ]; then
+ for p in $files ; do
+ plugin=$(echo $p | sed -e "s/-/_/g") # this is for streamdev-...
+ if [ -z "${!plugin}" ] && [ -f "$VDRLIBDIR/libvdr-$(echo $plugin | sed -e "s/_/-/g").so.${plugin_api}" ]; then
+ echo "" >> $VDRCONFIG
+ echo "# $p" >> $VDRCONFIG
+ echo "${plugin}=\"off"\" >> $VDRCONFIG
+ eval ${plugin}="off"
+ # plugin args
+ nl=0; (( nl=$(grep -n "^$p " /tmp/vdr-help.tmp | cut -f 1 -d ":") +1 ))
+ [ $nl -gt 1 ] && [ $(sed -n "${nl}p" /tmp/vdr-help.tmp | grep -c "^-") -gt 0 ] && echo "${plugin}_args=\"\"" >> $VDRCONFIG
+ fi
+ if [ "${!plugin}" = "on" ]; then
+ plugin_args="${plugin}_args"
+ if [ -n "${!plugin_args}" ]; then
+ PLUGINS="$PLUGINS -P'${p} ${!plugin_args}'"
+ else
+ PLUGINS="$PLUGINS -P'${p}'"
+ fi
+ fi
+ done
+ fi
+
+ # special plugin settings
+ [ "$remote" = "on" ] && chmod 0666 $remote_event
+ fi
+
+ # scripts
+ VDRRECCMDS=""
+ [ -x "$VDRSCRIPTDIR/vdrreccmds" ] && VDRRECCMDS="-r $VDRSCRIPTDIR/vdrreccmds"
+ VDRSETTIME=""
+ [ -x "$VDRSCRIPTDIR/vdrsettime" ] && [ $(grep -c "\-T CMD, --timeset=CMD" /tmp/vdr-help.tmp) -gt 0 ] && VDRSETTIME="-T $VDRSCRIPTDIR/vdrsettime"
+ VDRSHUTDOWN=""
+ [ -x "$VDRSCRIPTDIR/vdrshutdown" ] && VDRSHUTDOWN="-s $VDRSCRIPTDIR/vdrshutdown"
+
+ # keyboard tty (terminal for vdr)
+ VDRKEYBTTY=""
+ if [ "$KEYB_TTY" != "" ]; then
+ VDRKEYBTTY="-t $KEYB_TTY"
+ [ "$VDRUSER" != "root" ] && chmod 0666 $KEYB_TTY
+ fi
+
+ # cmd
+ VDRCMD="$VDRPRG -w $WATCHDOG -v $VIDEODIR -c $VDRCONFDIR -E $VDRVARDIR/epg.data -L $VDRLIBDIR -u $VDRUSER \
+ $VDRRECCMDS $VDRSETTIME $VDRSHUTDOWN $VDRKEYBTTY $PLUGINS $OPTIONS "
+}
+
+# modules
+function get_modulenames() {
+ KVERS=`uname -r | grep -e '2.6'`
+ if [ -z "$KVERS" ]; then
+ MODULES=`lsmod | grep 'dvb-core' | cut -d'[' -f2 | cut -d']' -f1`
+ else
+ MODULES=`lsmod | grep '^dvb_core' | awk '{print $4;}' | awk '{ gsub(/,/," ", $1); print }'`
+ fi
+}
+
+get_modulenames
+
+if [ -z "$MODULES" ]; then # If no DVB-Modules were found, try to load
+ modprobe -q dvb # the module with the name dvb, this could
+ get_modulenames # be an alias for the dvb-ttpci-module or
+fi # another dvb-module
+
+MODULES="$MODULES dvb-core"
+
+if [ `echo $MODULES | grep -cw 'b2c2_flexcop'` -gt 0 ] && [ `echo $MODULES | grep -cw 'b2c2_flexcop_pci'` -eq 0 ]; then
+ MODULES="b2c2_flexcop_pci $MODULES"
+fi
+
+# clear TTY
+if [ "$KEYB_TTY" != "" ]; then
+ clear > $KEYB_TTY
+fi
+
+# main script
+while (true) do
+ # load vdr settings
+ VdrSettings
+ # start X
+ MSG="Starting Xserver for VDRUSER: '$VDRUSER'"
+ [ "$XPLAYER" = "on" ] && echo "$MSG" && su "$VDRUSER" -c "startx &"
+ # start vdr
+ $LOGGER "Starting Video Disk Recorder at `date`"
+ eval $VDRCMD >/dev/null 2>&1
+ if test $? -eq 0; then
+ $LOGGER "Video Disk Recorder stopped at `date`"
+ [ "$XPLAYER" = "on" ] && $KILL Xorg
+ exit 0
+ fi
+ # stop vdr
+ $LOGGER "Stopping Video Disk Recorder at `date`"
+ [ "$XPLAYER" = "on" ] && $KILL Xorg
+ $KILL $VDRPRG
+ wait `pidof $VDRPRG`
+ # unload modules
+ for MODULE in $MODULES; do
+ rmmod $MODULE >/dev/null 2>&1
+ wait `pidof rmmod`
+ done
+ # load modules
+ for MODULE in $MODULES; do
+ modprobe $MODULE >/dev/null 2>&1
+ done
+done
+
+# clear tty
+if [ "$KEYB_TTY" != "" ]; then
+ clear > $KEYB_TTY
+fi
diff --git a/vdr/scripts/runvdr-old b/vdr/scripts/runvdr-old
new file mode 100644
index 0000000..6e8373a
--- /dev/null
+++ b/vdr/scripts/runvdr-old
@@ -0,0 +1,319 @@
+#!/bin/sh
+
+# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis)
+# von Marc Wernecke - www.zulu-entertainment.de
+# 06.11.2007
+# runvdr
+
+#export LD_ASSUME_KERNEL=2.4.1
+export LANG=de_DE.iso8859-1
+export LC_ALL=de_DE.iso8859-1
+
+KILL="/usr/bin/killall -q -TERM"
+KERNEL=`uname -r`
+
+function vdr_settings() {
+ # load vdr configuration
+ if [ -f /etc/default/vdr ]; then
+ . /etc/default/vdr
+ else
+ logger "$0 - error -> /etc/default/vdr does not exists"
+ exit 1
+ fi
+
+ # test if vdr exists and is executable
+ test -x "$VDRPRG" || exit 0
+
+ # export HOME
+ if [ "$VDRUSER" = "root" ]; then
+ export HOME="/root"
+ else
+ export HOME="$VDRCONFDIR"
+ fi
+
+ # java for burn
+ if [ "$burn" = "on" ]; then
+ [ -z "$JAVA_HOME" ] && export JAVA_HOME="/usr/lib/jvm/java-1.5.0-sun/jre"
+ [ -z "$PROJECTX_HOME" ] && export PROJECTX_HOME="/usr/local/src/ProjectX"
+ fi
+
+ # set DISPLAY
+ # - activate automatic login
+ # - copy x-vdr/extra/xhost to ~/.kde/Autostart and set xhost executable
+ if [ "$softdevice" = "on" ] || [ "$xineliboutput" = "on" ]; then
+ [ -z "$DISPLAY" ] && export DISPLAY=:$XV_DISPLAY
+ fi
+
+ # load nvram
+ if [ `which nvram-wakeup | wc -l` -gt 0 ] && [ `lsmod | grep -cw 'nvram'` -eq 0 ]; then
+ modprobe -q nvram
+ fi
+
+ # load cdfs
+ if [ `lsmod | grep -cw 'cdfs'` -eq 0 ]; then
+ modprobe -q cdfs
+ fi
+
+ # load av7710ir
+ if [ -e /proc/av7110_ir ] || [ -e /proc/budget_ci_ir ]; then
+ for FILE in av7110_ir budget_ci_ir; do
+ if [ -e "/proc/$FILE" ]; then
+ chown $VDRUSER:$VDRGROUP /proc/$FILE
+ fi
+ done
+ if [ `lsmod | grep -cw 'evdev'` -eq 0 ]; then modprobe -q evdev ; fi
+ fi
+
+ # load em8300
+ if [ "$em8300" = "on" ]; then
+# EM8300="/lib/modules/$KERNEL/em8300"
+# if [ -f "$EM8300/adv717x.ko" ] && [ -f "$EM8300/bt865.ko" ] && [ -f "$EM8300/em8300.ko" ]; then
+# $VDRSCRIPTDIR/rmm
+# $VDRSCRIPTDIR/ldm
+ [ "$dxr3" != "on" ] && em8300setup
+# fi
+ fi
+
+ # load parport
+ if [ "$graphlcd_base" = "on" ]; then
+ [ `lsmod | grep -cw 'parport'` -eq 0 ] && modprobe -q parport
+ [ `lsmod | grep -cw 'parport_pc'` -eq 0 ] && modprobe -q parport_pc
+ [ `lsmod | grep -cw 'ppdev'` -eq 0 ] && modprobe -q ppdev
+ # chmod 0666 /dev/parport0
+ fi
+
+ # only for mplayer via xine
+ # - copy x-vdr/extra/xhost to ~/.kde/Autostart and set xhost executable
+ if [ "$VDRUSER" != "root" ] && [ "$xine" = "on" ] && [ "$mplayer" = "on" ]; then
+ chmod 666 /dev/rtc
+ echo 1024 > /proc/sys/dev/rtc/max-user-freq
+ fi
+
+
+ # plugins
+ PLUGINS=""
+ # video devices
+ [ "$dxr3" = "on" ] && PLUGINS="$PLUGINS -P'dxr3'"
+ [ "$softdevice" = "on" ] && PLUGINS="$PLUGINS -P'softdevice $softdevice_args'"
+ [ "$vdrtvtime" = "on" ] && PLUGINS="$PLUGINS -P'vdrtvtime $vdrtvtime_args'"
+ [ "$xine" = "on" ] && PLUGINS="$PLUGINS -P'xine $xine_args'"
+ [ "$xineliboutput" = "on" ] && PLUGINS="$PLUGINS -P'xineliboutput $xineliboutput_args'"
+ # other
+ [ "$admin" = "on" ] && PLUGINS="$PLUGINS -P'admin'"
+ [ "$adzap" = "on" ] && PLUGINS="$PLUGINS -P'adzap $adzap_args'"
+ [ "$alcd" = "on" ] && PLUGINS="$PLUGINS -P'alcd $alcd_args'"
+ [ "$analogradio" = "on" ] && PLUGINS="$PLUGINS -P'analogradio $analogradio_args'"
+ [ "$arghdirector" = "on" ] && PLUGINS="$PLUGINS -P'arghdirector'"
+ [ "$atmo" = "on" ] && PLUGINS="$PLUGINS -P'atmo $atmo_args'"
+ [ "$audiorecorder" = "on" ] && PLUGINS="$PLUGINS -P'audiorecorder $audiorecorder_args'"
+ [ "$autosort" = "on" ] && PLUGINS="$PLUGINS -P'autosort'"
+ [ "$autotimeredit" = "on" ] && PLUGINS="$PLUGINS -P'autotimeredit $autotimeredit_args'"
+ [ "$avards" = "on" ] && PLUGINS="$PLUGINS -P'avards $avards_args'"
+ [ "$avolctl" = "on" ] && PLUGINS="$PLUGINS -P'avolctl'"
+ [ "$beep" = "on" ] && PLUGINS="$PLUGINS -P'beep'"
+ [ "$bitstreamout" = "on" ] && PLUGINS="$PLUGINS -P'bitstreamout $bitstreamout_args'"
+ [ "$burn" = "on" ] && PLUGINS="$PLUGINS -P'burn $burn_args'"
+ [ "$calc" = "on" ] && PLUGINS="$PLUGINS -P'calc'"
+ [ "$cdda" = "on" ] && PLUGINS="$PLUGINS -P'cdda $cdda_args'"
+ [ "$chanorg" = "on" ] && PLUGINS="$PLUGINS -P'chanorg $chanorg_args'"
+ [ "$channelswitcher" = "on" ] && PLUGINS="$PLUGINS -P'channelswitcher'"
+ [ "$cinebars" = "on" ] && PLUGINS="$PLUGINS -P'cinebars'"
+ [ "$clock" = "on" ] && PLUGINS="$PLUGINS -P'clock'"
+ [ "$console" = "on" ] && PLUGINS="$PLUGINS -P'console $console_args'"
+ [ "$control" = "on" ] && PLUGINS="$PLUGINS -P'control $control_args'"
+ [ "$csf" = "on" ] && PLUGINS="$PLUGINS -P'csf'"
+ [ "$cutalot" = "on" ] && PLUGINS="$PLUGINS -P'cutalot'"
+ [ "$decruft" = "on" ] && PLUGINS="$PLUGINS -P'decruft'"
+ [ "$digicam" = "on" ] && PLUGINS="$PLUGINS -P'digicam'"
+ [ "$director" = "on" ] && PLUGINS="$PLUGINS -P'director'"
+ [ "$dummydevice" = "on" ] && PLUGINS="$PLUGINS -P'dummydevice'"
+ [ "$dvd" = "on" ] && PLUGINS="$PLUGINS -P'dvd $dvd_args'"
+ [ "$dvdconvert" = "on" ] && PLUGINS="$PLUGINS -P'dvdconvert $dvdconvert_args'"
+ [ "$dvdselect" = "on" ] && PLUGINS="$PLUGINS -P'dvdselect'"
+ [ "$dvdswitch" = "on" ] && PLUGINS="$PLUGINS -P'dvdswitch $dvdswitch_args'"
+ if [ "$epgsearch" = "on" ]; then
+ PLUGINS="$PLUGINS -P'epgsearch $epgsearch_args'"
+ [ "$epgsearchonly" = "on" ] && PLUGINS="$PLUGINS -P'epgsearchonly'"
+ [ "$conflictcheckonly" = "on" ] && PLUGINS="$PLUGINS -P'conflictcheckonly'"
+ [ "$quickepgsearch" = "on" ] && PLUGINS="$PLUGINS -P'quickepgsearch'"
+ fi
+ [ "$epgsync" = "on" ] && PLUGINS="$PLUGINS -P'epgsync'"
+ [ "$extb" = "on" ] && PLUGINS="$PLUGINS -P'extb $extb_args'"
+ [ "$extrecmenu" = "on" ] && PLUGINS="$PLUGINS -P'extrecmenu'"
+ [ "$femon" = "on" ] && PLUGINS="$PLUGINS -P'femon'"
+ [ "$ffnetdev" = "on" ] && PLUGINS="$PLUGINS -P'ffnetdev $ffnetdev_args'"
+ [ "$filebrowser" = "on" ] && PLUGINS="$PLUGINS -P'filebrowser'"
+ [ "$freecell" = "on" ] && PLUGINS="$PLUGINS -P'freecell'"
+ [ "$fritzbox" = "on" ] && PLUGINS="$PLUGINS -P'fritzbox'"
+ [ "$games" = "on" ] && PLUGINS="$PLUGINS -P'games'"
+ [ "$graphlcd" = "on" ] && PLUGINS="$PLUGINS -P'graphlcd $graphlcd_args'"
+ [ "$graphtft" = "on" ] && PLUGINS="$PLUGINS -P'graphtft $graphtft_args'"
+ [ "$image" = "on" ] && PLUGINS="$PLUGINS -P'image $image_args'"
+ [ "$ipod" = "on" ] && PLUGINS="$PLUGINS -P'ipod'"
+ [ "$iptv" = "on" ] && PLUGINS="$PLUGINS -P'iptv $iptv_args'"
+ [ "$launcher" = "on" ] && PLUGINS="$PLUGINS -P'launcher'"
+ [ "$lcdproc" = "on" ] && PLUGINS="$PLUGINS -P'lcdproc $lcdproc_args'"
+ [ "$lcr" = "on" ] && PLUGINS="$PLUGINS -P'lcr $lcr_args'"
+ [ "$live" = "on" ] && PLUGINS="$PLUGINS -P'live $live_args'"
+ [ "$loadepg" = "on" ] && PLUGINS="$PLUGINS -P'loadepg $loadepg_args'"
+ [ "$mailbox" = "on" ] && PLUGINS="$PLUGINS -P'mailbox $mailbox_args'"
+ [ "$manual" = "on" ] && PLUGINS="$PLUGINS -P'manual'"
+ [ "$mediamvp" = "on" ] && PLUGINS="$PLUGINS -P'mediamvp $mediamvp_args'"
+ [ "$menuorg" = "on" ] && PLUGINS="$PLUGINS -P'menuorg $menuorg_args'"
+ [ "$mlcd" = "on" ] && PLUGINS="$PLUGINS -P'mlcd'"
+ [ "$mlist" = "on" ] && PLUGINS="$PLUGINS -P'mlist'"
+ [ "$mousemate" = "on" ] && PLUGINS="$PLUGINS -P'mousemate $mousemate_args'"
+ [ "$mp3" = "on" ] && PLUGINS="$PLUGINS -P'mp3 $mp3_args'"
+ [ "$mplayer" = "on" ] && PLUGINS="$PLUGINS -P'mplayer $mplayer_args'"
+ [ "$muggle" = "on" ] && PLUGINS="$PLUGINS -P'muggle $muggle_args'"
+ [ "$music" = "on" ] && PLUGINS="$PLUGINS -P'music $music_args'"
+ [ "$coverviewer" = "on" ] && PLUGINS="$PLUGINS -P'coverviewer $coverviewer_args'"
+ [ "$netconfig" = "on" ] && PLUGINS="$PLUGINS -P'netconfig $netconfig_args'"
+ [ "$newsticker" = "on" ] && PLUGINS="$PLUGINS -P'newsticker'"
+ [ "$noepgmenu" = "on" ] && PLUGINS="$PLUGINS -P'noepgmenu'"
+ [ "$nordlichtsepg" = "on" ] && PLUGINS="$PLUGINS -P'nordlichtsepg'"
+ [ "$osdout" = "on" ] && PLUGINS="$PLUGINS -P'osdout'"
+ [ "$osdpip" = "on" ] && PLUGINS="$PLUGINS -P'osdpip'"
+ [ "$osdserver" = "on" ] && PLUGINS="$PLUGINS -P'osdserver'"
+ [ "$osdteletext" = "on" ] && PLUGINS="$PLUGINS -P'osdteletext $osdteletext_args'"
+ [ "$picselshow" = "on" ] && PLUGINS="$PLUGINS -P'picselshow $picselshow_args'"
+ [ "$pilot" = "on" ] && PLUGINS="$PLUGINS -P'pilot'"
+ [ "$pilotskin" = "on" ] && PLUGINS="$PLUGINS -P'pilotskin'"
+ [ "$pim" = "on" ] && PLUGINS="$PLUGINS -P'pim'"
+ [ "$pin" = "on" ] && PLUGINS="$PLUGINS -P'pin'"
+ [ "$playlist" = "on" ] && PLUGINS="$PLUGINS -P'playlist $playlist_args'"
+ [ "$podcatcher" = "on" ] && PLUGINS="$PLUGINS -P'podcatcher $podcatcher_args'"
+ [ "$powermate" = "on" ] && PLUGINS="$PLUGINS -P'powermate $powermate_args'"
+ [ "$prefermenu" = "on" ] && PLUGINS="$PLUGINS -P'prefermenu'"
+ [ "$premiereepg" = "on" ] && PLUGINS="$PLUGINS -P'premiereepg'"
+ [ "$pvrinput" = "on" ] && PLUGINS="$PLUGINS -P'pvrinput'"
+ [ "$radio" = "on" ] && PLUGINS="$PLUGINS -P'radio $radio_args'"
+ [ "$recstatus" = "on" ] && PLUGINS="$PLUGINS -P'recstatus'"
+ [ "$reelchannelscan" = "on" ] && PLUGINS="$PLUGINS -P'reelchannelscan'"
+ [ "$remote" = "on" ] && PLUGINS="$PLUGINS -P'remote $remote_args'" && chmod 0666 $remote_event
+ [ "$remoteosd" = "on" ] && PLUGINS="$PLUGINS -P'remoteosd'"
+ [ "$remotetimers" = "on" ] && PLUGINS="$PLUGINS -P'remotetimers'"
+ [ "$ripit" = "on" ] && PLUGINS="$PLUGINS -P'ripit'"
+ [ "$rotor" = "on" ] && PLUGINS="$PLUGINS -P'rotor $rotor_args'"
+ [ "$rssreader" = "on" ] && PLUGINS="$PLUGINS -P'rssreader'"
+ [ "$screenshot" = "on" ] && PLUGINS="$PLUGINS -P'screenshot'"
+ [ "$setup" = "on" ] && PLUGINS="$PLUGINS -P'setup'"
+ [ "$skinelchi" = "on" ] && PLUGINS="$PLUGINS -P'skinelchi $skinelchi_args'"
+ [ "$skinenigmang" = "on" ] && PLUGINS="$PLUGINS -P'skinenigmang $skinenigmang_args'"
+ [ "$skinreel" = "on" ] && PLUGINS="$PLUGINS -P'skinreel'"
+ [ "$skinsoppalusikka" = "on" ] && PLUGINS="$PLUGINS -P'skinsoppalusikka $skinsoppalusikka_args'"
+ [ "$sleeptimer" = "on" ] && PLUGINS="$PLUGINS -P'sleeptimer $sleeptimer_args'"
+ [ "$solitaire" = "on" ] && PLUGINS="$PLUGINS -P'solitaire'"
+ [ "$span" = "on" ] && PLUGINS="$PLUGINS -P'span'"
+ [ "$spider" = "on" ] && PLUGINS="$PLUGINS -P'spider'"
+ [ "$sport" = "on" ] && PLUGINS="$PLUGINS -P'sport $sport_args'"
+ [ "$streamdev_client" = "on" ] && PLUGINS="$PLUGINS -P'streamdev-client'"
+ [ "$streamdev_server" = "on" ] && PLUGINS="$PLUGINS -P'streamdev-server $streamdev_server_args'"
+ [ "$streamplayer" = "on" ] && PLUGINS="$PLUGINS -P'streamplayer'"
+ [ "$submenu" = "on" ] && PLUGINS="$PLUGINS -P'submenu'"
+ [ "$subtitles" = "on" ] && PLUGINS="$PLUGINS -P'subtitles'"
+ [ "$sudoku" = "on" ] && PLUGINS="$PLUGINS -P'sudoku'"
+ [ "$svdrpext" = "on" ] && PLUGINS="$PLUGINS -P'svdrpext'"
+ [ "$svdrpservice" = "on" ] && PLUGINS="$PLUGINS -P'svdrpservice'"
+ [ "$sysinfo" = "on" ] && PLUGINS="$PLUGINS -P'sysinfo'"
+ [ "$taste" = "on" ] && PLUGINS="$PLUGINS -P'taste'"
+ [ "$text2skin" = "on" ] && PLUGINS="$PLUGINS -P'text2skin'"
+ [ "$ttxtsubs" = "on" ] && PLUGINS="$PLUGINS -P'ttxtsubs'"
+ [ "$timeline" = "on" ] && PLUGINS="$PLUGINS -P'timeline'"
+ [ "$touchtft" = "on" ] && PLUGINS="$PLUGINS -P'touchtft $touchtft_args'"
+ [ "$tvonscreen" = "on" ] && PLUGINS="$PLUGINS -P'tvonscreen $tvonscreen_args'"
+ [ "$tvtv" = "on" ] && PLUGINS="$PLUGINS -P'tvtv'"
+ [ "$undelete" = "on" ] && PLUGINS="$PLUGINS -P'undelete $undelete_args'"
+ [ "$vdrcd" = "on" ] && PLUGINS="$PLUGINS -P'vdrcd $vdrcd_args'"
+ [ "$vdrrip" = "on" ] && PLUGINS="$PLUGINS -P'vdrrip $vdrrip_args'"
+ [ "$vompserver" = "on" ] && PLUGINS="$PLUGINS -P'vompserver $vompserver_args'"
+ [ "$wapd" = "on" ] && PLUGINS="$PLUGINS -P'wapd $wapd_args'"
+ [ "$weatherng" = "on" ] && PLUGINS="$PLUGINS -P'weatherng $weatherng_args'"
+ [ "$wirbelscan" = "on" ] && PLUGINS="$PLUGINS -P'wirbelscan'"
+ [ "$xxvautotimer" = "on" ] && PLUGINS="$PLUGINS -P'xxvautotimer $xxvautotimer_args'"
+ [ "$yaepg" = "on" ] && PLUGINS="$PLUGINS -P'yaepg'"
+ [ "$zaphistory" = "on" ] && PLUGINS="$PLUGINS -P'zaphistory'"
+ [ "$default_plugins" = "on" ] && PLUGINS="$PLUGINS -P'hello' -P'osddemo' -P'svccli' -P'svcsvr' -P'sky' -P'status' -P'svdrpdemo'"
+
+ # scripts
+ VDRRECCMDS="$VDRSCRIPTDIR/vdrreccmds"
+ VDRSETTIME="$VDRSCRIPTDIR/vdrsettime"
+ VDRSHUTDOWN="$VDRSCRIPTDIR/vdrshutdown"
+
+ # keyboard tty (terminal for vdr)
+ VDRKEYBTTY=""
+ if [ "$KEYB_TTY" != "" ]; then
+ VDRKEYBTTY="-t $KEYB_TTY"
+ [ "$VDRUSER" != "root" ] && chmod 0666 $KEYB_TTY
+ fi
+
+ # cmd
+ VDRCMD="$VDRPRG -w $WATCHDOG -v $VIDEODIR -c $VDRCONFDIR -E $VDRVARDIR/epg.data -L $VDRLIBDIR \
+ -s $VDRSHUTDOWN -T $VDRSETTIME -r $VDRRECCMDS $VDRKEYBTTY -u $VDRUSER $PLUGINS $OPTIONS "
+}
+
+# modules
+function get_modulenames() {
+ KVERS=`uname -r | grep -e '2.6'`
+ if [ -z "$KVERS" ]; then
+ MODULES=`lsmod | grep 'dvb-core' | cut -d'[' -f2 | cut -d']' -f1`
+ else
+ MODULES=`lsmod | grep '^dvb_core' | awk '{print $4;}' | awk '{ gsub(/,/," ", $1); print }'`
+ fi
+}
+
+get_modulenames
+
+if [ -z "$MODULES" ]; then # If no DVB-Modules were found, try to load
+ modprobe -q dvb # the module with the name dvb, this could
+ get_modulenames # be an alias for the dvb-ttpci-module or
+fi # another dvb-module
+
+MODULES="$MODULES dvb-core"
+
+if [ `echo $MODULES | grep -cw 'b2c2_flexcop'` -gt 0 ] && [ `echo $MODULES | grep -cw 'b2c2_flexcop_pci'` -eq 0 ]; then
+ MODULES="b2c2_flexcop_pci $MODULES"
+fi
+
+# clear TTY
+if [ "$KEYB_TTY" != "" ]; then
+ clear > $KEYB_TTY
+fi
+
+# main script
+while (true) do
+ # load vdr settings
+ vdr_settings
+ # start vdr
+ logger "Starting Video Disk Recorder at `date`"
+ eval $VDRCMD >/dev/null 2>&1
+ if test $? -eq 0; then
+ logger "Video Disk Recorder stopped at `date`"
+ exit 0
+ fi
+ # stop vdr
+ logger "Stopping Video Disk Recorder at `date`"
+ $KILL $VDRPRG
+ n=10
+ echo -n "Waiting $n seconds ..."
+ for i in `seq 1 $n`; do
+ sleep 1
+ (( n=$n-1 ))
+ echo -n " $n"
+ done
+ echo ""
+ # unload modules
+ for MODULE in $MODULES; do
+ rmmod $MODULE >/dev/null 2>&1
+ wait `pidof rmmod`
+ done
+ # load modules
+ for MODULE in $MODULES; do
+ modprobe $MODULE >/dev/null 2>&1
+ done
+done
+
+# clear tty
+if [ "$KEYB_TTY" != "" ]; then
+ clear > $KEYB_TTY
+fi
diff --git a/vdr/scripts/timerrep.sh b/vdr/scripts/timerrep.sh
new file mode 100644
index 0000000..c3d48bb
--- /dev/null
+++ b/vdr/scripts/timerrep.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# this script allows searching for a repeat of timer using epgsearch (>=0.9.3).
+# it requires the timercmd patch from Gerhard Steiner, that extends the timers
+# menu of VDR with commands like in recordings menu
+#
+# add the following lines to your timercmds.conf
+#
+# Search for repeat : /path_of_this_script/timerrep.sh 0
+# Search for repeat (with subtitle): /path_of_this_script/timerrep.sh 1
+#
+# Author: Christian Wieninger (cwieninger@gmx.de)
+#------------------------------------------------------------------------------
+
+source /etc/default/vdr # x-vdr
+
+# adjust the following lines to your config
+# your plugins config dir
+PLUGINCONFDIR=${VDRCONFDIR}/plugins/epgsearch
+# path to svdrpsend.pl
+SVDRPSEND=${VDRBINDIR}/svdrpsend.pl
+# if you are using special subfolders for some recordings, please add them here
+FOLDERS=""
+# the key used to call epgsearch
+EPGSEARCHKEY=user2
+
+# do not edit below this line
+#------------------------------------------------------------------------------
+
+cat << EOM >/tmp/cmd.sh
+
+SEARCHTERM="$6"~"$7";
+#event info not yet present? then extract it from the file name
+if test "\$SEARCHTERM" == "~"; then
+SEARCHTERM='$8'
+#cut leading special folders
+i=0;
+FOLDERS=$FOLDERS;
+while [ "\$LASTWORD" != "\$FOLDERS" ];
+do
+ LASTWORD=\${FOLDERS%%,*};
+ SEARCHTERM=\${SEARCHTERM#*\$LASTWORD~};
+ i=\$i+1;
+ FOLDERS=\${FOLDERS#*,};
+done
+#cut trailing dummy subtitle created by epgsearch
+SEARCHTERM=\${SEARCHTERM%~???_??.??.????-??:??}
+if [ "$1" -eq "0" ]; then
+ SEARCHTERM=\${SEARCHTERM%~*};
+fi
+fi
+
+RCFILE=$PLUGINCONFDIR/.epgsearchrc;
+echo Search=\$SEARCHTERM > \$RCFILE;
+echo SearchMode=0 >> \$RCFILE;
+echo UseDescr=0 >> \$RCFILE;
+$SVDRPSEND HITK $EPGSEARCHKEY;
+EOM
+
+echo ". /tmp/cmd.sh; rm /tmp/cmd.sh" | at now
+
+
+
diff --git a/vdr/scripts/vdr b/vdr/scripts/vdr
new file mode 100644
index 0000000..c11d0a5
--- /dev/null
+++ b/vdr/scripts/vdr
@@ -0,0 +1,130 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: vdr
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Linux Video Disk Recorder
+### END INIT INFO
+# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis)
+# von Marc Wernecke - www.zulu-entertainment.de
+# 12.02.2009
+# /etc/init.d/vdr
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DESC="Linux Video Disk Recorder"
+NAME="vdr"
+LOGGER="logger -s ${0##*/} "
+
+if [ -f /etc/default/vdr ]; then
+ . /etc/default/vdr
+else
+ $LOGGER "exit, because /etc/default/vdr does not exists"
+ exit 1
+fi
+
+DAEMON=$VDRBINDIR/runvdr
+PIDFILE=/var/run/runvdr.pid
+
+test -x "$DAEMON" || exit 0
+test -x "$VDRPRG" || exit 0
+
+function clean_console() {
+ if [ "$KEYB_TTY" != "" ]; then
+ tput -Tlinux clear > $KEYB_TTY
+ fi
+}
+
+function switch_console() {
+ if [ "$KEYB_TTY" != "" ]; then
+ clean_console
+ echo -e "This tty is currently mapped to VDR, keypresses aren't echoed.\r" > $KEYB_TTY
+ echo -n "For a login prompt switch to another console." > $KEYB_TTY
+ chvt `echo "$KEYB_TTY" | sed "s/\/dev\/tty//"`
+ REDIRECT="< $KEYB_TTY"
+ fi
+}
+
+function get_status() {
+ if start-stop-daemon --start --startas $DAEMON --test \
+ --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null
+ then
+ echo " - is not running."
+ exit 3
+ else
+ echo " - is running."
+ exit 0
+ fi
+}
+
+function startvdr() {
+ if [ "$AUTOSTART" != "off" ]; then
+ # only start vdr if there is no other instance running
+ if start-stop-daemon --start --startas $DAEMON --test \
+ --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null
+ then
+ # stopping dvb-bootsplash (mplayer)
+ [ -x /etc/init.d/dvb-bootsplash ] && /etc/init.d/dvb-bootsplash stop
+ # starting LCDd
+ # uncomment this only if you DONT use the systems init rc
+# [ "$LCDproc" = "on" ] && [ -f /etc/init.d/lcdd ] && /etc/init.d/lcdd start &
+ # starting Video Disk Recorder
+# switch_console
+ start-stop-daemon --start --quiet --startas $DAEMON --background \
+ --name $(basename $DAEMON) --pidfile $PIDFILE --make-pidfile -- $REDIRECT
+ else
+ echo -n " - seems to be running already"
+ fi
+ else
+ echo -n " - aborted (to enable the daemon, set AUTOSTART=\"on\" in /etc/default/vdr)"
+ fi
+}
+
+function stopvdr() {
+ if start-stop-daemon --stop --retry 30 \
+ --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null
+ then
+ start-stop-daemon --stop --retry 30 --oknodo --exec $VDRPRG >/dev/null
+ rm -f $PIDFILE
+ clean_console
+ # graphlcd shutdown sequence
+ [ "$graphlcd_base" = "on" ] && [ -f /etc/init.d/x-lcd ] && /etc/init.d/x-lcd stop
+ # stopping LCDd
+ # uncomment this only if you DONT use the systems init rc
+# [ "$LCDproc" = "on" ] && [ -f /etc/init.d/lcdd ] && /etc/init.d/lcdd stop
+ else
+ echo -n " - seems not to be running"
+ fi
+}
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: $NAME"
+ startvdr
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping $DESC: $NAME"
+ stopvdr
+ echo "."
+ ;;
+ restart|force-reload)
+ echo -n "Restarting $DESC: $NAME"
+ stopvdr
+ sleep 4
+ startvdr
+ echo "."
+ ;;
+ status)
+ echo -n "Getting status of $DESC: $NAME"
+ get_status
+ ;;
+ *)
+ N=/etc/init.d/$NAME
+ echo "Usage: $N {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/vdr/scripts/vdr-no-shutdown b/vdr/scripts/vdr-no-shutdown
new file mode 100644
index 0000000..b880f93
--- /dev/null
+++ b/vdr/scripts/vdr-no-shutdown
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+while (true) do
+ date
+ echo "vdr-no-shutdown"
+ echo "if this script is running"
+ echo "vdr can not shutdown the system"
+ sleep 60
+ done
+
+
+
diff --git a/vdr/scripts/vdr2root b/vdr/scripts/vdr2root
new file mode 100644
index 0000000..e6cea06
--- /dev/null
+++ b/vdr/scripts/vdr2root
@@ -0,0 +1,244 @@
+#!/bin/sh
+
+# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis)
+# von Marc Wernecke - www.zulu-entertainment.de
+# 24.03.2008
+
+# vdr2root
+
+# Load VDR configuration
+GRUB_POWEROFF=
+. /etc/default/vdr
+LOGGER="logger -s ${0##*/} "
+
+# Load vdrshutdown configuration
+if [ -f "$VDRCONFDIR/shutdown.conf" ]; then
+ . "$VDRCONFDIR/shutdown.conf"
+else
+ $LOGGER "$VDRCONFDIR/shutdown.conf nonreadable"
+ $LOGGER "using defaults"
+fi
+
+KILL="/usr/bin/killall -q -TERM"
+
+if [ $# -eq 0 ]; then
+ echo "vdr2root -> this script needs a command..."
+ $0 help
+ exit 1
+fi
+
+case $1 in
+ admin)
+ $VDRCONFDIR/plugins/admin/setvdr.sh
+ ;;
+ clean-log)
+ cd /var/log ; cat /dev/null > messages ; cat /dev/null > wtmp ; echo "Säubern der Logfiles..."
+ ;;
+ show-log)
+ if test -s /var/log/messages ; then tail -n 500 /var/log/messages|tac ; else echo "(/var/log/messages) nicht gefunden oder leer..." ; fi
+ ;;
+ video-update)
+ touch $VIDEODIR/.update
+ ;;
+ ssh-start)
+ /etc/init.d/ssh start
+ ;;
+ ssh-stop)
+ /etc/init.d/ssh stop
+ ;;
+ ssh-restart)
+ /etc/init.d/ssh restart
+ ;;
+ vdr-kill)
+ killall -9 runvdr
+ killall -9 vdr
+ ;;
+ vdr-start)
+ /etc/init.d/vdr start
+ ;;
+ vdr-stop)
+ if [ "$AUTOSTART" != "off" ]; then
+ /etc/init.d/vdr stop
+ else
+ killall -9 runvdr
+ killall -9 vdr
+ fi
+ ;;
+ vdr-restart)
+ if [ "$AUTOSTART" != "off" ]; then
+ /etc/init.d/vdr restart
+ else
+ killall -9 vdr
+ fi
+ ;;
+ acpi-wakeup)
+ # $2 = wakeuptime
+ [ $# -eq 3 ] && echo $2 > $3
+ ;;
+ nvram-wakeup)
+ # $2 = wakeuptime
+ [ $# -eq 2 ] && nvram-wakeup $2
+ ;;
+ extb-poweroff)
+ $VDRSCRIPTDIR/extb-poweroff.pl
+ ;;
+ lilo)
+ lilo -R PowerOff
+ ;;
+ grub)
+ if [ $# -eq 2 ] && [ -n "$GRUB_POWEROFF" ]; then
+ grub-set-default $GRUB_POWEROFF
+ else
+ $LOGGER "stop shutdown, because missing configuration"
+ fi
+ ;;
+ reboot)
+ shutdown -r now
+ ;;
+ shutdown)
+ shutdown -h now
+ ;;
+ poweroff)
+ poweroff
+ ;;
+ settime)
+ [ $# -eq 2 ] && /bin/date $2
+ ;;
+ readdvd)
+ # dvdselect and dvdswitch
+ # $1 = "readdvd"
+ # $2 = directory for dvd's (see plugin configuration menu)
+ # $3 = name of dvd
+ # $4 = original dvd-device
+ # dvdswitch only
+ # $5 = mountpoint - default is "(null)"
+ # $6 = "IMAGE" or "DIR"
+ LOGFILE="/var/log/vdrreaddvd.log"
+ echo "vdr2root # `date`" > "$LOGFILE" 2>&1
+ echo "vdr2root # $0 $*" >> "$LOGFILE" 2>&1
+ if [ ! -e "$DVDBURNER" ]; then
+ echo "vdr2root # DVDBURNER=\"$DVDBURNER\" does not exists" >> "$LOGFILE" 2>&1
+ exit 1
+ fi
+ eject -t $DVDBURNER
+ [ ! -d "$2" ] && mkdir -p "$2" && echo "vdr2root # Erstelle \"$2\"" >> "$LOGFILE" 2>&1
+ case $6 in
+ IMAGE)
+ [ -f "$2/$3" ] && rm -f "$2/$3" && echo "vdr2root # Lösche \"$2/$3\"" >> "$LOGFILE" 2>&1
+ echo "vdr2root # DVD einlesen gestartet" >> "$LOGFILE" 2>&1
+ $VDRBINDIR/svdrpsend.pl -d localhost "MESG DVD einlesen gestartet"
+ dd if="$4" of="$2/$3" >> "$LOGFILE" 2>&1
+ ;;
+ DIR)
+ cd "$2"
+ [ -d "$3" ] && rm -rf "$3" && echo "vdr2root # Lösche \"$2/$3\"" >> "$LOGFILE" 2>&1
+ echo "vdr2root # DVD einlesen gestartet" >> "$LOGFILE" 2>&1
+ $VDRBINDIR/svdrpsend.pl -d localhost "MESG DVD einlesen gestartet"
+ vobcopy -i $DVDBURNER -o "$2" -t "$3" -m >> "$LOGFILE" 2>&1
+ ;;
+ esac
+ eject $DVDBURNER
+ echo "vdr2root # DVD einlesen fertig" >> "$LOGFILE" 2>&1
+ chown $VDRUSER.$VDRGROUP "$2/$3" && echo "vdr2root # chown $VDRUSER.$VDRGROUP \"$2/$3\"" >> "$LOGFILE" 2>&1
+ $VDRBINDIR/svdrpsend.pl -d localhost "MESG DVD einlesen fertig"
+ ;;
+ writedvd)
+ # dvdselect and dvdswitch
+ # $1 = writedvd
+ # $2 = filename
+ LOGFILE="/var/log/vdrwritedvd.log"
+ echo "vdr2root # `date`" > "$LOGFILE" 2>&1
+ echo "vdr2root # $0 $1 \"$2\"" >> "$LOGFILE" 2>&1
+ if [ ! -e "$DVDBURNER" ]; then
+ echo "vdr2root # DVDBURNER=\"$DVDBURNER\" does not exists" >> "$LOGFILE" 2>&1
+ exit 1
+ fi
+ BURN_SPEED=0
+ SPEED=""
+ [ $BURN_SPEED -gt 0 ] && SPEED="-speed=$BURN_SPEED"
+ unset SUDO_COMMAND
+ eject -t $DVDBURNER
+ echo "vdr2root # DVD brennen gestartet" >> "$LOGFILE" 2>&1
+ $VDRBINDIR/svdrpsend.pl -d localhost "MESG DVD brennen gestartet"
+ if [ -f "$2" ]; then
+ growisofs -use-the-force-luke=tty -dvd-compat $SPEED -Z $DVDBURNER="$2" >> "$LOGFILE" 2>&1
+ elif [ -d "$2" ]; then
+ DVDNAME=`basename "$2"`
+ growisofs -use-the-force-luke=tty -dvd-compat $SPEED -Z $DVDBURNER -dvd-video -V "$DVDNAME" "$2" >> "$LOGFILE" 2>&1
+ fi
+ eject $DVDBURNER
+ echo "vdr2root # DVD brennen fertig" >> "$LOGFILE" 2>&1
+ $VDRBINDIR/svdrpsend.pl -d localhost "MESG DVD brennen fertig"
+ ;;
+ automount)
+ wakeonlan 00:00:00:00:00:00
+ echo "wake on..."
+ sleep 10
+ [ ! -d /mnt/vdrserver ] && mkdir -p /mnt/vdrserver
+ if [ ! -d $VIDEODIR/vdrserver ]; then
+ cd $VIDEODIR
+ ln -vnfs /mnt/vdrserver vdrserver
+ fi
+ echo "...waiting"
+ sleep 10
+ echo "waiting..."
+ sleep 10
+ echo "...waiting"
+ sleep 10
+ echo "waiting..."
+ sleep 10
+ echo "...mounting"
+ mount -t smbfs -o password= //vdrserver/video /mnt/vdrserver
+ echo "erneues einlesen der Aufnahmen..."
+ touch $VIDEODIR/.update
+ ;;
+ wakeonlan)
+ wakeonlan 00:00:00:00:00:00
+ ;;
+ mount)
+ if [ ! -d /mnt/vdrserver ] ; then mkdir -p /mnt/vdrserver ; fi
+ if [ ! -d $VIDEODIR/vdrserver ] ; then
+ cd $VIDEODIR
+ ln -vnfs /mnt/vdrserver vdrserver
+ fi
+ mount -t smbfs -o password= //vdrserver/video /mnt/vdrserver
+ touch $VIDEODIR/.update
+ ;;
+ umount)
+ umount -t smbfs /mnt/vdrserver
+# exec umount -t smbfs /mnt/vdrserver
+ touch $VIDEODIR/.update
+ ;;
+ * | help)
+ [ "$1" != "help" ] && echo "vdr2root -> # $0 $* <- command not found"
+ echo "vdr2root -> possible commands are..."
+ echo "$0 acpi-wakeup \$2"
+ echo "$0 admin"
+ echo "$0 automount"
+ echo "$0 clean-log"
+ echo "$0 help"
+ echo "$0 lilo"
+ echo "$0 mount"
+ echo "$0 nvram-wakeup \$2"
+ echo "$0 poweroff"
+ echo "$0 readdvd \$2 \$3 \$4"
+ echo "$0 reboot"
+ echo "$0 settime \$2"
+ echo "$0 show-log"
+ echo "$0 shutdown"
+ echo "$0 ssh-start"
+ echo "$0 ssh-stop"
+ echo "$0 umount"
+ echo "$0 vdr-start"
+ echo "$0 vdr-stop"
+ echo "$0 vdr-restart"
+ echo "$0 video-update"
+ echo "$0 wakeonlan"
+ echo "$0 writedvd \$2"
+ ;;
+esac
+
+exit 0
+
+
+
diff --git a/vdr/scripts/vdrmount b/vdr/scripts/vdrmount
new file mode 100644
index 0000000..0be7b02
--- /dev/null
+++ b/vdr/scripts/vdrmount
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# This script is called from VDR to mount/unmount/eject
+# the sources for MP3 play.
+#
+# argument 1: wanted action, one of mount,unmount,eject,status
+# argument 2: mountpoint to act on
+#
+# mount,unmount,eject must return 0 if succeeded, 1 if failed
+# status must return 0 if device is mounted, 1 if not
+#
+
+action="$1"
+path="$2"
+
+case "$action" in
+ mount)
+ if [ -z "$(echo $path | grep "usb")" ]; then
+ eject -t "$path" || exit 1 # close the tray
+ fi
+ mount "$path" || exit 1 # mount it
+ ;;
+ unmount)
+ umount "$path" || exit 1 # unmount it
+ ;;
+ eject)
+ eject "$path" || exit 1 # eject disk
+ ;;
+ status)
+ cat /proc/mounts | grep -q "$path" # check if mounted
+ [ $? -ne 0 ] && exit 1 # not mounted ...
+ ;;
+esac
+
+exit 0
diff --git a/vdr/scripts/vdrnoad b/vdr/scripts/vdrnoad
new file mode 100644
index 0000000..39ba8af
--- /dev/null
+++ b/vdr/scripts/vdrnoad
@@ -0,0 +1,99 @@
+#!/bin/bash
+#
+# vdrnoad
+#
+# Required: noad, at
+#
+# add this lines to your reccmds.conf:
+# folgende zeilen in die reccmds.conf eintragen:
+#
+# Run noad : /usr/lib/vdr/scripts/vdrnoad -start
+# Run noad, all recordings (batch) : /usr/lib/vdr/scripts/vdrnoad -batch
+# View Cut list : /usr/lib/vdr/scripts/vdrnoad -view
+# In prozess : /usr/lib/vdr/scripts/vdrnoad -count
+# Stop noad (killpid) : /usr/lib/vdr/scripts/vdrnoad -killpid
+# Stop noad (killall)? : /usr/lib/vdr/scripts/vdrnoad -killall
+# Remove marks : /usr/lib/vdr/scripts/vdrnoad -marks
+# Remove pid : /usr/lib/vdr/scripts/vdrnoad -pid
+# Remove all marks : /usr/lib/vdr/scripts/vdrnoad -marks.vdr
+# Remove all pids : /usr/lib/vdr/scripts/vdrnoad -noad.pid
+
+# CONFIG START
+ NOADOPTS="nice --background --ac3 --asd --overlap --jumplogo --comments --OSD --statisticfile=/var/log/noadstat"
+ #VIDEODIR="/video"
+ source /etc/default/vdr
+# 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\" >/dev/null 2>&1" | 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\" >/dev/null 2>&1" | batch
+ fi
+ done < <(find "$VIDEODIR" -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 "$VIDEODIR" -follow -type f -name "${1/-}" -exec rm -f '{}' ';' &
+ ;;
+ *)
+ echo "unrecognized option: $1"
+ exit 1
+ ;;
+esac
+
diff --git a/vdr/scripts/vdrplayer b/vdr/scripts/vdrplayer
new file mode 100644
index 0000000..ce6b8b5
--- /dev/null
+++ b/vdr/scripts/vdrplayer
@@ -0,0 +1,279 @@
+#!/bin/bash
+
+# vdrplayer 0.0.5 (start-script for shmclient, tvtime, vdrtvtime, vdr-sxfe, xine or xineliboutput)
+# by Marc Wernecke - www.zulu-entertainment.de
+# 10.02.2009
+
+### Config ####################################################################################
+NONROOT="true" # true or false
+STARTX="true" # allways, true or false
+VDRIP= # 127.0.0.1 for localhost or any other ip for a vdr-server in your local-network
+VDRPLAYER= # shmclient, tvtime, vdr-sxfe, xine, xineliboutput or xine-network
+
+[ "$HOME" = "/" ] && HOME=/etc
+[ -r $HOME/vdrplayer.conf ] && . $HOME/vdrplayer.conf
+
+### Arguments #################################################################################
+EXIT="false"
+KILLALL="false"
+VERSION="vdrplayer 0.0.4"
+
+for i in $* ; do
+ case $1 in
+ --exit|-e)
+ EXIT="true"
+ ;;
+ --help|-h)
+ echo "$VERSION"
+ echo "--exit|-e Kill all active player and exit"
+ echo "--help|-h Shows the help text and exit"
+ echo "--killall|-k Kill all active player, the X server and exit"
+ echo "--nonroot|-n Sets NONROOT flag"
+ echo "--reset|-r Remove the configuration file (\$HOME/vdrplayer.conf)"
+ echo "--startx|-s [allways|true|false]"
+ echo "--ip|-i [ip] 127.0.0.1 for localhost or any other ip for a vdr-server in your local-network"
+ echo "--player|-p [shmclient|tvtime|vdr-sxfe|xine|xineliboutput|xine-network]"
+ echo "--version|-v Shows the script version and exit"
+ exit 0
+ ;;
+ --killall|-k)
+ KILLALL="true"
+ ;;
+ --nonroot|-n)
+ NONROOT="true"
+ ;;
+ --reset|-r)
+ if [ -f $HOME/vdrplayer.conf ]; then
+ rm -f $HOME/vdrplayer.conf
+ VDRIP=
+ VDRPLAYER=
+ fi
+ ;;
+ --startx|-s)
+ shift 1
+ STARTX="$1"
+ ;;
+ --ip|-i)
+ shift 1
+ VDRIP="$1"
+ ;;
+ --player|-p)
+ shift 1
+ VDRPLAYER="$1"
+ ;;
+ --version|-v)
+ echo "$VERSION"
+ exit 0
+ ;;
+ esac
+ shift 1
+done
+
+if [ -n "`ps x --user root | grep "/usr/.*bin/X.*:0" | grep -v grep`" ]; then # X is running
+ DIALOG="Xdialog"
+else
+ DIALOG="dialog"
+fi
+
+### Functions #################################################################################
+function _exit() {
+ case $1 in
+ 0) exit 0
+ ;;
+ 1) exit 1
+ ;;
+ 2) exit 2
+ ;;
+ esac
+ exit 0
+}
+
+function _vdr() {
+ # Max waiting time in Seconds
+ n=10
+ # Check if VDR is running
+ if [ `ps -C vdr | grep -cw "vdr"` -eq 0 ]; then
+ echo "vdr is not running"
+ echo -n "Waiting $n seconds ..."
+ # test if vdr is running
+ while [ `ps -C vdr | grep -cw "vdr"` -eq 0 ] && [ $n -gt 0 ]; do
+ sleep 1
+ (( n=$n-1 ))
+ echo -n " $n"
+ if [ $n -eq 0 ]; then
+ echo " exit"
+ return 1
+ fi
+ done
+ echo ""
+ echo "vdr is online"
+ fi
+ return 0
+}
+
+function _vdrip() {
+ VDRIP=`$DIALOG --inputbox "VDR Server IP" 10 50 "127.0.0.1" 3>&1 1>&2 2>&3`
+ [ $? != 0 ] && return 1
+ [ "$VDRIP" = "" ] && return 1
+ echo "VDRIP=$VDRIP" >> $HOME/vdrplayer.conf
+ return 0
+}
+
+function _x() {
+ case $STARTX in
+ allways) STARTX="allways";;
+ true) STARTX="true";;
+ *) STARTX="false"; return 0 ;;
+ esac
+ VT=vt7
+
+ # if no X is running and user=root, start it
+ if [ -n "`ps x --user root | grep "/usr/.*bin/X.*:1" | grep -v "grep"`" ]; then
+ # X:1 is running
+ export DISPLAY=:1
+ return 0
+ elif [ -n "`ps x --user root | grep "/usr/.*bin/X" | grep -v "grep"`" ]; then
+ # X:0 is running
+ if [ "$STARTX" = "allways" ]; then
+ if [ "$NONROOT" = "false" ]; then
+ [ "`id -u`" = "0" ] || return 1
+ fi
+ export DISPLAY=:1
+ VT=vt9
+ else
+ export DISPLAY=:0
+ return 0
+ fi
+ else
+ if [ "$NONROOT" = "false" ]; then
+ [ "`id -u`" = "0" ] || return 1
+ fi
+ export DISPLAY=:0
+ fi
+
+ # start X
+ echo "Starting the X server..."
+ /usr/bin/X -ac -dpi 100 $DISPLAY $VT & sleep 4
+# xhost local:localhost
+ return 0
+}
+
+function _shmclient() {
+ _x || return 1
+ CMD="--fullscreen"
+ ShmClient $CMD &
+ return 0
+}
+
+function _tvtime() {
+# chmod 666 /dev/rtc
+# echo 1024 > /proc/sys/dev/rtc/max-user-freq
+ _x || return 1
+ CMD="--fullscreen --display=$DISPLAY"
+ tvtime $CMD &
+ sleep 2
+ tvtime-command MENU_EXIT
+ return 0
+}
+
+function _vdrtvtime() {
+# chmod 666 /dev/rtc
+# echo 1024 > /proc/sys/dev/rtc/max-user-freq
+ _x || return 1
+ svdrpsend.pl PLUG vdrtvtime start &
+ return 0
+}
+
+function _vdrsxfe() {
+ [ -n "$VDRIP" ] || _vdrip || return 1
+ _x || return 1
+ CMD="--video=xv --fullscreen --post tvtime:method=LinearBlend,cheap_mode=1,pulldown=0,use_progressive_frame_flag=1"
+ MRL="xvdr+tcp://$VDRIP"
+ vdr-sxfe $CMD $MRL &
+ return 0
+}
+
+function _xineliboutput() {
+ [ -n "$VDRIP" ] || _vdrip || return 1
+ _x || return 1
+ CMD="--fullscreen --hide-gui"
+ MRL="xvdr+tcp://$VDRIP#nocache;demux:mpeg_block"
+ xine $CMD "$MRL" &
+ return 0
+}
+
+function _xine() {
+ _x || return 1
+ CMD="--fullscreen --hide-gui --post vdr --post vdr_audio"
+ MRL="vdr:/tmp/vdr-xine/stream#demux:mpeg_pes"
+ xine $CMD "$MRL" &
+ return 0
+}
+
+function _xinenetwork() {
+ [ -n "$VDRIP" ] || _vdrip || return 1
+ _x || return 1
+ CMD="--fullscreen --hide-gui --post vdr --post vdr_audio"
+ MRL="netvdr://$VDRIP#demux:mpeg_pes"
+ xine $CMD "$MRL" &
+ return 0
+}
+
+### Main Script ###############################################################################
+
+_vdr || exit 1 # Check if VDR is running
+
+[ -n "`ps x | grep ShmClient`" ] && killall -q -9 ShmClient # If ShmClient is running, stop it
+[ -n "`ps x | grep tvtime`" ] && killall -q -9 tvtime # If tvtime is running, stop it
+[ -n "`ps x | grep vdr-sxfe`" ] && killall -q -9 vdr-sxfe # If vdr-sxfe is running, stop it
+[ -n "`ps cx | grep xine`" ] && killall -q -9 xine # If xine is running, stop it
+[ "$VDRPLAYER" = "vdrtvtime" ] && svdrpsend.pl PLUG vdrtvtime stop
+
+if [ "$EXIT" = "true" ]; then # Exit
+ exit 0
+fi
+
+if [ "$KILLALL" = "true" ]; then # Stop X and Exit
+ [ -n "`ps x --user root | grep "/usr/.*bin/X" | grep -v "grep"`" ] && killall -q -9 Xorg
+ exit 0
+fi
+
+# Player
+if [ -n "$VDRPLAYER" ]; then
+ case $VDRPLAYER in
+ shmclient) _shmclient ;;
+ tvtime) _tvtime ;;
+ vdrtvtime) _vdrtvtime ;;
+ vdr-sxfe) _vdrsxfe ;;
+ xineliboutput) _xineliboutput ;;
+ xine) _xine ;;
+ xine-network) _xinenetwork ;;
+ *) VDRPLAYER="" ;;
+ esac
+fi
+
+# Dialog
+if [ -z "$VDRPLAYER" ]; then
+ option=`$DIALOG --menu \
+ 'Aktiviere den Player, den du nutzen moechtest.' 0 0 8 \
+ '1' 'ShmClient (Softdevice)' \
+ '2' 'Tvtime (FF-Karte)' \
+ '3' 'vdrtvtime (tvtime als Plugin, FF-Karte)' \
+ '4' 'vdr-sxfe (Xineliboutput)' \
+ '5' 'Xine' \
+ '6' 'Xine (Xineliboutput)' \
+ '7' 'Xine-Network' 3>&1 1>&2 2>&3`
+ [ $? != 0 ] && exit 1
+ VDRIP=
+ case $option in
+ 1) echo "VDRPLAYER=\"shmclient\"" > $HOME/vdrplayer.conf && _shmclient ;;
+ 2) echo "VDRPLAYER=\"tvtime\"" > $HOME/vdrplayer.conf && _tvtime ;;
+ 3) echo "VDRPLAYER=\"vdrtvtime\"" > $HOME/vdrplayer.conf && _vdrtvtime ;;
+ 4) echo "VDRPLAYER=\"vdr-sxfe\"" > $HOME/vdrplayer.conf && _vdrsxfe ;;
+ 5) echo "VDRPLAYER=\"xine\"" > $HOME/vdrplayer.conf && _xine ;;
+ 6) echo "VDRPLAYER=\"xineliboutput\"" > $HOME/vdrplayer.conf && _xineliboutput ;;
+ 7) echo "VDRPLAYER=\"xine-network\"" > $HOME/vdrplayer.conf && _xinenetwork ;;
+ esac
+fi
+
+exit 0 \ No newline at end of file
diff --git a/vdr/scripts/vdrreaddvd b/vdr/scripts/vdrreaddvd
new file mode 100644
index 0000000..ff1a84d
--- /dev/null
+++ b/vdr/scripts/vdrreaddvd
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# vdrreaddvd - x-vdr version
+#
+# This script will be called by the vdr-plugins dvdselect and dvdswitch to copy a DVD to the local drive.
+#
+# It gets the following parameters:
+#
+# dvdselect and dvdswitch
+# $1 = directory for dvd's (see plugin configuration menu)
+# $2 = name of dvd
+# $3 = original dvd-device
+# dvdswitch only
+# $4 = mountpoint - default is "(none)"
+# $5 = "IMAGE" or "DIR"
+
+# Load VDR configuration
+. /etc/default/vdr
+
+# vdr2root
+if [ $# -eq 3 ]; then
+ # dvdselect
+ echo "sudo $VDRSCRIPTDIR/vdr2root readdvd \"$1\" \"$2\" \"$3.iso\" (none) IMAGE" | at now
+elif [ $# -eq 5 ]; then
+ # dvdswitch
+ echo "sudo $VDRSCRIPTDIR/vdr2root readdvd \"$1\" \"$2\" \"$3\" \"$4\" \"$5\"" | at now
+else
+ exit 1
+fi
+
+exit 0
diff --git a/vdr/scripts/vdrreccmds b/vdr/scripts/vdrreccmds
new file mode 100644
index 0000000..5259b43
--- /dev/null
+++ b/vdr/scripts/vdrreccmds
@@ -0,0 +1,32 @@
+#!/bin/sh
+# 24.06.2007
+
+# Load VDR configuration
+. /etc/default/vdr
+
+function NoadExclude() {
+ Channel="$*"
+ [ -r $VDRCONFDIR/noad-exclude-channels.conf ] || return 1
+ cat $VDRCONFDIR/noad-exclude-channels.conf | while read NewLine; do
+ [ -n "`echo "$Channel" | grep "D\ .*\ -"`" ] && Channel="`echo "$Channel" | cut -c1,2,3`"
+ [ "$NewLine" = "$Channel" ] && killall -9 $(basename $0)
+ done
+}
+
+case "$1" in
+ before)
+ echo "Start recording $2"
+ ;;
+ after)
+ echo "Finished recording $2"
+ [ "$noad" = "on" ] || exit
+ [ $# -ge 3 ] && NoadExclude "$3"
+ $VDRSCRIPTDIR/vdrnoad -start $2
+ ;;
+ edited)
+ echo "Edited recording $2"
+ ;;
+ *)
+ echo "ERROR: unknown state: $1"
+ ;;
+esac \ No newline at end of file
diff --git a/vdr/scripts/vdrsettime b/vdr/scripts/vdrsettime
new file mode 100644
index 0000000..6bd83bb
--- /dev/null
+++ b/vdr/scripts/vdrsettime
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# Load VDR configuration
+. /etc/default/vdr
+
+sudo $VDRSCRIPTDIR/vdr2root settime "$1"
+
+
diff --git a/vdr/scripts/vdrsetup b/vdr/scripts/vdrsetup
new file mode 100644
index 0000000..e45e39f
--- /dev/null
+++ b/vdr/scripts/vdrsetup
@@ -0,0 +1,1896 @@
+#!/bin/bash
+#
+# (x-)vdrsetup 0.0.8 - script for OSDServer on localhost
+# by Marc Wernecke - www.zulu-entertainment.de
+# 12.02.2009
+
+script="$0"
+
+# convenient return values
+true=0
+false=1
+
+
+# Some generic stuff for handling a connection
+
+function error() {
+ # Fatal error. Send quit command, close FIFO and terminate netcat
+ DoLog "fatal error, disconnecting..."
+ [ "${reply2xx[0]}" != 202 ] && SendCmd Quit
+
+ exec 3>&-
+ exec 4>&-
+
+ kill $pid
+
+ exit 1
+}
+
+function ConnectServer() {
+ # Connect to the OSDServer
+ DoLog "connecting to the OSDServer..."
+ # Set up temporary fifo and open as file descriptor 3 and 4
+ mkfifo --mode=700 /tmp/pipe-in$$ /tmp/pipe-out$$
+ exec 3<> /tmp/pipe-in$$
+ exec 4<> /tmp/pipe-out$$
+ rm /tmp/pipe-in$$ /tmp/pipe-out$$
+
+ # Connect to server using the fifo
+ {
+ netcat $1 $2
+
+ # In case of connection loss:
+ echo 499 disconnected
+ echo 202 Good Bye.
+ } <&3 >&4 &
+ pid=$!
+
+ # Sending to the server: use >&3
+ # Receive from the server: use <&4
+}
+
+
+function ReadReply() {
+ # Read a complete server reply until 2xx return code,
+ # and store replies in each category by number
+ reply2xx=()
+ reply3xx=()
+ reply4xx=()
+ reply5xx=()
+ reply6xx=()
+
+ while read -r code line <&4 ; do
+ echo "< $code $line"
+ # screen echo
+
+ # vdrsetup debug
+ if [ "$vdrsetup_use_debug" = "on" ]; then
+ [ "$vdrsetup_use_log" = "on" ] && echo "< $code $line" >> "$vdrsetup_log"
+ [ "$vdrsetup_use_syslog" = "on" ] && $LOGGER "< $code $line"
+ fi
+
+ case $code in
+ 2*) IFS=$' \t\n\r' reply2xx=($code "$line")
+ ;;
+ 3*) IFS=$' \t\n\r' reply3xx=($code $line)
+ ;;
+ 4*) IFS=$' \t\n\r' reply4xx=($code "$line")
+ ;;
+ 5*) IFS=$' \t\n\r' reply5xx=($code "$line")
+ ;;
+ 6*) IFS=$' \t\n\r' reply6xx=($code "$line")
+ ;;
+ esac
+ [ -n "${reply2xx[0]}" ] && break
+ done
+
+ [ -n "${reply4xx[0]}" ] && return $false
+ return $true
+}
+
+function SendCmd() {
+ # Send a command and read the reply
+
+ echo "> $*"
+ # screen echo
+
+ echo "$*" >&3
+ # network send
+
+ # vdrsetup debug
+ if [ "$vdrsetup_use_debug" = "on" ]; then
+ [ "$vdrsetup_use_log" = "on" ] && echo "> $*" >> "$vdrsetup_log"
+ [ "$vdrsetup_use_syslog" = "on" ] && $LOGGER "> $*"
+ fi
+
+ ReadReply
+}
+
+function IsEvent() {
+ # Helper to check reply for a certain event
+
+ [ "${reply3xx[0]}" != 300 ] && return $false
+ [ "${reply3xx[1]}" != "$1" ] && return $false
+ [ "${reply3xx[2]}" != "$2" ] && return $false
+
+ return $true
+}
+
+
+function QuoteString() {
+ # Quote arbitrary string for use in '' and ""
+ local str="${!1}"
+
+ str="${str//'\'/\\\\}"
+ str="${str//'\\'/\\\\}"
+ # work around bash bug: double quoted '\'
+
+ str="${str//\'/$'\\\''}"
+ # This is bogus, anyone knows something better to replace ' by \' ?
+
+ str="${str//\"/\\\"}"
+ str="${str//$'\r'/\\r}"
+ str="${str//$'\n'/\\n}"
+ str="${str//$'\t'/\\t}"
+
+ eval "$1=\$str"
+}
+
+function UnquoteString() {
+ # Unquote string
+ local str="${!1}"
+
+ str="${str//\\r/$'\r'}"
+ str="${str//\\n/$'\n'}"
+ str="${str//\\t/$'\t'}"
+ str="${str//\\\"/\"}"
+ str="${str//\\\'/\'}"
+ str="${str//\\\\/\\}"
+
+ eval "$1=\$str"
+}
+
+
+##############
+# vdrsetup #
+##############
+vdrsetup_ok_ends="on"
+vdrsetup_key_timeout=1000
+# logging
+LOGGER="logger -- ${0##*/} - "
+vdrsetup_use_screen="on" # echo setup changings to the screen
+vdrsetup_use_log="off" # echo setup changings to $vdrsetup_log
+vdrsetup_log="/tmp/vdrsetup.log" # log file
+vdrsetup_use_syslog="on" # echo setup changings (with LOGGER) to syslog
+vdrsetup_use_debug="off" # enable comunications log
+
+# vdr configuration
+config=/etc/default/vdr # path to vdr configuration
+. $config # load vdr configuration
+[ -f "$VDRCONFDIR/plugins/vdrsetup.conf" ] && . "$VDRCONFDIR/plugins/vdrsetup.conf"
+
+# x-vdr
+have_xvdr="on"
+[ ! -f /usr/local/src/x-vdr/setup.conf ] && have_xvdr="off"
+
+# /tmp/vdr-help.tmp
+[ ! -f /tmp/vdr-help.tmp ] && $VDRPRG --help | sed -e '/^$/d' -e 's/^. //' > /tmp/vdr-help.tmp
+
+# vdr-desc.cache
+[ ! -f /tmp/vdr-desc.cache ] && $VDRPRG --version | sed -e 's/\(^[^ ]*\)\(.*$\)/\1_desc="\1\2"/' -e '/^streamdev/s/-/_/' -e 's/^\[.*//' | sort > /tmp/vdr-desc.cache
+. /tmp/vdr-desc.cache
+vdr_version=$(echo $vdr_desc | sed -e 's/[^)]*$//')
+plugin_api=$(echo $vdr_desc | sed -e 's/[^)]*$//' -e 's/^[^\/]*//g' -e 's/\///' -e 's/\/*)//')
+
+# reset logfile
+[ "$vdrsetup_use_log" = "on" ] && echo "$0" > "$vdrsetup_log"
+
+# helper functions =>
+function DoLog() {
+ [ "$vdrsetup_use_log" = "on" ] && echo "$*" >> "$vdrsetup_log"
+ [ "$vdrsetup_use_screen" = "on" ] && echo ">> $*"
+ [ "$vdrsetup_use_syslog" = "on" ] && $LOGGER "$*"
+}
+
+function CreateDir() {
+ directory="$*"
+ if [ ! -d "$directory" ]; then
+ SendCmd "Message -seconds 10 'Create $directory?'" || return $false
+ if IsEvent Message keyOk ; then
+ mkdir -p "$directory"
+ chown -R $VDRUSER:$VDRGROUP "$directory"
+ [ -d "$directory" ] && DoLog "creating \"$directory\""
+ fi
+ else
+ DoLog "directory \"$directory\" already exist"
+ fi
+}
+
+# Menu functions =>
+
+##### Script-Setup Menu #####
+function ScriptSetup() {
+ # Menu --------------------------------------------------------------------------------------------------------------------------------->
+ SendCmd "enterlocal" || return $false
+ SendCmd "menu=New Menu 'Skript Intern'" || return $false
+ SendCmd "menu.SetColorKeyText -blue 'Help'" || return $false
+ SendCmd "menu.SetColumns 24" || return $false
+ SendCmd "menu.EnableEvent keyOk keyBlue close" || return $false
+ # List --------------------------------------------------------------------------------------------------------------------------------->
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Einstellungen ---'" || return $false
+ SendCmd "opt1=menu.AddNew EditListItem -selectname '$vdrsetup_ok_ends' 'Beim Speichern beenden' on off" || return $false
+ SendCmd "opt2=menu.AddNew EditIntItem 'Tasten Timeout (ms)' '$vdrsetup_key_timeout'" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable ''" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Logging ---'" || return $false
+ SendCmd "opt3=menu.AddNew EditListItem -selectname '$vdrsetup_use_log' 'Benutze Log Datei' on off" || return $false
+ SendCmd "opt4=menu.AddNew EditStrItem 'Log Datei' $vdrsetup_log'" || return $false
+ SendCmd "opt5=menu.AddNew EditListItem -selectname '$vdrsetup_use_syslog' 'Syslog benutzen' on off" || return $false
+ SendCmd "opt6=menu.AddNew EditListItem -selectname '$vdrsetup_use_debug' 'Debug Nachrichten' on off" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable ''" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Befehle ---'" || return $false
+ SendCmd "opt7=menu.AddNew OsdItem 'Cache neu erstellen'" || return $false
+ SendCmd "opt7.EnableEvent keyRed focus blur" || return $false
+ # <--------------------------------------------------------------------------------------------------------------------------------- List
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "opt1.SetCurrent" || return $false
+ SendCmd "menu.show" || return $false
+ # <--------------------------------------------------------------------------------------------------------------------------------- Menu
+
+ while true; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk
+ if IsEvent menu keyOk ; then
+ echo "# $script" > "$VDRCONFDIR/plugins/vdrsetup.conf"
+ # vdrsetup_ok_ends
+ SendCmd "opt1.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ vdrsetup_ok_ends="${reply6xx[1]}"
+ echo "vdrsetup_ok_ends=\"$vdrsetup_ok_ends\"" >> "$VDRCONFDIR/plugins/vdrsetup.conf"
+ # key_timeout
+ SendCmd "opt2.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ vdrsetup_key_timeout="${reply6xx[1]}"
+ echo "vdrsetup_key_timeout=\"$vdrsetup_key_timeout\"" >> "$VDRCONFDIR/plugins/vdrsetup.conf"
+ # vdrsetup_use_log
+ SendCmd "opt3.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ vdrsetup_use_log="${reply6xx[1]}"
+ echo "vdrsetup_use_log=\"$vdrsetup_use_log\"" >> "$VDRCONFDIR/plugins/vdrsetup.conf"
+ # vdrsetup_log
+ SendCmd "opt4.GetValue -quoted" || return $false
+ if [ "${reply5xx[0]}" = 500 ]; then
+ value=$(echo " ${reply5xx[1]}" | sed -e 's/^ //g' -e 's/\\r//g')
+ [ -d "$(dirname "$value")" ] && vdrsetup_log="$value"
+ fi
+ echo "vdrsetup_log=\"$vdrsetup_log\"" >> "$VDRCONFDIR/plugins/vdrsetup.conf"
+ # vdrsetup_use_syslog
+ SendCmd "opt5.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ vdrsetup_use_syslog="${reply6xx[1]}"
+ echo "vdrsetup_use_syslog=\"$vdrsetup_use_syslog\"" >> "$VDRCONFDIR/plugins/vdrsetup.conf"
+ # vdrsetup_use_debug
+ SendCmd "opt6.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ vdrsetup_use_debug="${reply6xx[1]}"
+ echo "vdrsetup_use_debug=\"$vdrsetup_use_debug\"" >> "$VDRCONFDIR/plugins/vdrsetup.conf"
+ # close the submenu
+ if [ "$vdrsetup_ok_ends" = "on" ]; then
+ SendCmd "menu.SendState osBack" || return $false
+# SendCmd "delete menu" || return $false
+# SendCmd "leavelocal" || return $false
+# return $true
+ fi
+ fi
+ if IsEvent opt7 focus ; then
+ SendCmd "menu.SetColorKeyText -red Create" || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ if IsEvent opt7 blur ; then
+ SendCmd "menu.SetColorKeyText -red ''" || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ if IsEvent opt7 keyRed ; then
+ SendCmd "Message -seconds 10 '/tmp/vdr-desc.cache erstellen?'" || return $false
+ if IsEvent Message keyOk ; then
+ $VDRPRG --version | sed -e 's/\(^[^ ]*\)\(.*$\)/\1_desc="\1\2"/' -e '/^streamdev/s/-/_/' -e 's/^\[.*//' | sort > /tmp/vdr-desc.cache
+ . /tmp/vdr-desc.cache
+ fi
+ fi
+ # keyBlue (Help)
+ if IsEvent menu keyBlue ; then
+ SendCmd "Message -seconds 5 'Auswahl mit Links und Rechts, speichern mit Ok'" || return $false
+ fi
+ # close the submenu
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ done
+}
+
+##### System-Start Menu #####
+function SystemStart() {
+ Gdm="$(find /etc/rc*d/S*gdm)"
+ if [ -n "$Gdm" ]; then
+ DESKTOP_MANGER="gdm"
+ [ -f /etc/rc2.d/S30gdm ] && echo warning
+ [ -f /etc/rc3.d/S30gdm ] && DESKTOP="on"
+ fi
+
+ RUNLEVEL_STR="$(cat /etc/inittab | grep -m1 ^id:)"
+ RUNLEVEL=$(echo $RUNLEVEL_STR | cut -f2 -d":")
+ if [ $RUNLEVEL -eq 5 ] || [ "$DESKTOP_MANGER" ="gdm" -a $RUNLEVEL -gt 2 ]; then
+ DESKTOP="on"
+ else
+ DESKTOP="off"
+ fi
+
+ # Menu ------------------------------------------------------------------------------------------------------------->
+ SendCmd "enterlocal" || return $false
+ SendCmd "menu=New Menu 'Systemstart'" || return $false
+ SendCmd "menu.SetColorKeyText -blue 'Help'" || return $false
+ SendCmd "menu.SetColumns 24" || return $false
+ SendCmd "menu.EnableEvent keyOk close" || return $false
+ # List ------------------------------------------------------------------------------------------------------------->
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Programme ---'" || return $false
+ SendCmd "opt1=menu.AddNew EditListItem -selectname '$AUTOSTART' 'VDR' on off" || return $false
+ SendCmd "opt1.EnableEvent keyBlue" || return $false
+ SendCmd "opt2=menu.AddNew EditListItem -selectname '$XPLAYER' 'Xserver und Player' on off" || return $false
+ SendCmd "opt2.EnableEvent keyBlue" || return $false
+ SendCmd "opt3=menu.AddNew EditListItem -selectname '$DESKTOP' 'Desktop-Manager' on off" || return $false
+ SendCmd "opt3.EnableEvent keyBlue" || return $false
+ SendCmd "opt4=menu.AddNew EditListItem -selectname '$vdradmin' 'VDR-Admin' on off" || return $false
+ SendCmd "opt4.EnableEvent keyBlue" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable ''" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Module ---'" || return $false
+ SendCmd "optA=menu.AddNew EditListItem -selectname '$em8300' 'DXR3' on off" || return $false
+ SendCmd "optA.EnableEvent keyBlue" || return $false
+ SendCmd "optB=menu.AddNew EditListItem -selectname '$graphlcd_base' 'GraphLCD' on off" || return $false
+ SendCmd "optB.EnableEvent keyBlue" || return $false
+ SendCmd "optC=menu.AddNew EditListItem -selectname '$LCDproc' 'LCDproc' on off" || return $false
+ SendCmd "optC.EnableEvent keyBlue" || return $false
+ SendCmd "optD=menu.AddNew EditListItem -selectname '$lirc' 'Lirc' on off" || return $false
+ SendCmd "optD.EnableEvent keyBlue" || return $false
+ SendCmd "optE=menu.AddNew EditIntItem -min 1 -max 2 'Lirc Port' '$lirc_port'" || return $false
+ SendCmd "optE.EnableEvent keyBlue" || return $false
+ # <------------------------------------------------------------------------------------------------------------- List
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "opt1.SetCurrent" || return $false
+ SendCmd "menu.show" || return $false
+ # <------------------------------------------------------------------------------------------------------------- Menu
+
+ while true; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk
+ if IsEvent menu keyOk ; then
+ # AUTOSTART
+ SendCmd "opt1.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$AUTOSTART" != "${reply6xx[1]}" ]; then
+ DoLog "changing AUTOSTART to ${reply6xx[1]}"
+ sed -i $config -e "/^AUTOSTART=/s/$AUTOSTART/${reply6xx[1]}/"
+ AUTOSTART=${reply6xx[1]}
+ fi
+ # Xserver and Player
+ SendCmd "opt2.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$XPLAYER" != "${reply6xx[1]}" ]; then
+ DoLog "changing XPLAYER to ${reply6xx[1]}"
+ sed -i $config -e "/^XPLAYER=/s/$XPLAYER/${reply6xx[1]}/"
+ XPLAYER=${reply6xx[1]}
+ fi
+ # Desktop-Manager
+ SendCmd "opt3.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$DESKTOP" != "${reply6xx[1]}" ] || [ "$DESKTOP" = "$XPLAYER" ]; then
+ DESKTOP=${reply6xx[1]}
+ [ "$XPLAYER" = "on" ] && DESKTOP="off"
+ DoLog "changing Desktop-Manager to $DESKTOP"
+ # runlevel
+ if [ $RUNLEVEL -eq 5 -a "$DESKTOP" = "off" ]; then
+ sed -i /etc/inittab -e "s/$RUNLEVEL_STR/id:3:initdefault:/"
+ elif [ $RUNLEVEL -ne 5 -a "$DESKTOP" = "on" ]; then
+ sed -i /etc/inittab -e "s/$RUNLEVEL_STR/id:5:initdefault:/"
+ fi
+ XWRAPPER_STR="$(cat /etc/X11/Xwrapper.config | grep -m1 ^allowed_users)"
+ XWRAPPER=$(echo $XWRAPPER_STR | cut -f2 -d"=")
+ if [ "$DESKTOP" != "on" -a "$XWRAPPER" != "anybody" ]; then
+ log "Setting 'allowed_users' to 'anybody' in /etc/X11/Xwrapper.config"
+ sed -i /etc/X11/Xwrapper.config -e "s/$XWRAPPER_STR/allowed_users=anybody/g"
+ fi
+ fi
+ # vdradmin
+ SendCmd "opt4.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$vdradmin" != "${reply6xx[1]}" ]; then
+ DoLog "changing vdradmin to ${reply6xx[1]}"
+ sed -i $config -e "/^vdradmin=/s/$vdradmin/${reply6xx[1]}/"
+ vdradmin=${reply6xx[1]}
+ fi
+ # dxr3
+ SendCmd "optA.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$em8300" != "${reply6xx[1]}" ]; then
+ DoLog "changing em8300 to ${reply6xx[1]}"
+ sed -i $config -e "/^em8300=/s/$em8300/${reply6xx[1]}/"
+ em8300=${reply6xx[1]}
+ fi
+ # graphlcd_base
+ SendCmd "optB.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$graphlcd_base" != "${reply6xx[1]}" ]; then
+ DoLog "changing graphlcd_base to ${reply6xx[1]}"
+ sed -i $config -e "/^graphlcd_base=/s/$graphlcd_base/${reply6xx[1]}/"
+ graphlcd_base=${reply6xx[1]}
+ fi
+ # LCDproc
+ SendCmd "optC.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$LCDproc" != "${reply6xx[1]}" ]; then
+ DoLog "changing LCDproc to ${reply6xx[1]}"
+ sed -i $config -e "/^LCDproc=/s/$LCDproc/${reply6xx[1]}/"
+ LCDproc=${reply6xx[1]}
+ fi
+ # lirc
+ SendCmd "optD.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$lirc" != "${reply6xx[1]}" ]; then
+ DoLog "changing lirc to ${reply6xx[1]}"
+ sed -i $config -e "/^lirc=/s/$lirc/${reply6xx[1]}/"
+ lirc=${reply6xx[1]}
+ fi
+ # lirc_port
+ SendCmd "optE.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$lirc_port" != "${reply6xx[1]}" ]; then
+ DoLog "changing lirc_port to ${reply6xx[1]}"
+ sed -i $config -e "/^lirc_port=/s/$lirc_port/${reply6xx[1]}/"
+ lirc_port=${reply6xx[1]}
+ fi
+ # close the submenu
+ if [ "$vdrsetup_ok_ends" = "on" ]; then
+ SendCmd "menu.SendState osBack" || return $false
+# SendCmd "delete menu" || return $false
+# SendCmd "leavelocal" || return $false
+# return $true
+ fi
+ fi
+
+ # keyBlue (Help)
+ if IsEvent opt1 keyBlue ; then
+ SendCmd "Message -seconds 5 'VDR automatisch starten on/off'" || return $false
+ fi
+ if IsEvent opt2 keyBlue ; then
+ SendCmd "Message -seconds 5 'Xserver und Player automatisch starten on/off'" || return $false
+ fi
+ if IsEvent opt3 keyBlue ; then
+ SendCmd "Message -seconds 5 'Desktop-Manager automatisch starten on/off'" || return $false
+ fi
+ if IsEvent opt4 keyBlue ; then
+ SendCmd "Message -seconds 5 'VDRAdmin automatisch starten on/off'" || return $false
+ fi
+
+ if IsEvent optA keyBlue ; then
+ SendCmd "Message -seconds 5 'Modul automatisch laden on/off'" || return $false
+ fi
+ if IsEvent optB keyBlue ; then
+ SendCmd "Message -seconds 5 'Modul automatisch laden on/off'" || return $false
+ fi
+ if IsEvent optC keyBlue ; then
+ SendCmd "Message -seconds 5 'Modul automatisch laden on/off'" || return $false
+ fi
+ if IsEvent optD keyBlue ; then
+ SendCmd "Message -seconds 5 'Modul automatisch laden on/off'" || return $false
+ fi
+ if IsEvent optE keyBlue ; then
+ SendCmd "Message -seconds 5 'Lirc-Port 1/2'" || return $false
+ fi
+ # close the submenu
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ done
+}
+
+##### VDR-Setup Menu #####
+function VdrSetup() {
+ # directorys
+ videodir=$( grep "^VIDEODIR=" $config | tail -n1 | sed -e "s/^VIDEODIR=//" -e 's/"//g' -e 's/#.*//')
+ musicdir=$( grep "^MUSICDIR=" $config | tail -n1 | sed -e "s/^MUSICDIR=//" -e 's/"//g' -e 's/#.*//')
+ dvdisodir=$( grep "^DVDISODIR=" $config | tail -n1 | sed -e "s/^DVDISODIR=//" -e 's/"//g' -e 's/#.*//')
+ picturedir=$(grep "^PICTUREDIR=" $config | tail -n1 | sed -e "s/^PICTUREDIR=//" -e 's/"//g' -e 's/#.*//')
+ divxdir=$( grep "^DIVXDIR=" $config | tail -n1 | sed -e "s/^DIVXDIR=//" -e 's/"//g' -e 's/#.*//')
+ vdrvardir=$( grep "^VDRVARDIR=" $config | tail -n1 | sed -e "s/^VDRVARDIR=//" -e 's/"//g' -e 's/#.*//')
+ dvdburner=$( grep "^DVDBURNER=" $config | tail -n1 | sed -e "s/^DVDBURNER=//" -e 's/"//g' -e 's/#.*//')
+
+ ls_dev=$(ls -r /dev/*)
+
+ # cd / dvd
+ all_dvd=$(echo "$ls_dev" | grep "^/dev/[c,d][d,v][r,d]" | sort -r)
+ if [ -n "$all_dvd" ] && [ $(echo $all_dvd | grep -cw "$dvdburner") -eq 0 ]; then
+ dvdburner_old="$dvdburner"
+ dvdburner=$(echo $all_dvd | cut -f 1 -d " ")
+ sed -i $config -e "/^DVDBURNER=/s?$dvdburner_old?$dvdburner?"
+ SendCmd "Message -seconds 5 \"Resetting DVDBURNER to $dvdburner\"" || return $false
+ fi
+
+ # vdr keyb tty
+ all_tty=$(echo "$ls_dev" | grep "^/dev/tty[0-9]$")
+ if [ $(echo $all_tty | grep -cw "$KEYB_TTY") -eq 0 ]; then
+ KEYB_TTY_OLD="$KEYB_TTY"
+ KEYB_TTY=""
+ sed -i $config -e "/^KEYB_TTY=/s/$KEYB_TTY_OLD/$KEYB_TTY/"
+ SendCmd "Message -seconds 5 \"Resetting KEYB_TTY to $KEYB_TTY\"" || return $false
+ fi
+
+ # vdr language
+ all_lang=$(locale -a | grep "_")
+ if [ $(echo $all_lang | grep -cw "$VDRLANG") -eq 0 ]; then
+ VDRLANG_OLD="$VDRLANG"
+ VDRLANG=$(echo $VDRLANG | cut -f 1 -d ".")
+ [ $(echo $all_lang | grep -cw "$VDRLANG") -eq 0 ] && VDRLANG=$(echo $all_lang | cut -f 1 -d " ")
+ sed -i $config -e "/^VDRLANG=/s/$VDRLANG_OLD/$VDRLANG/"
+ SendCmd "Message -seconds 5 \"Resetting VDRLANG to $VDRLANG\"" || return $false
+ fi
+
+ # Menu -------------------------------------------------------------------------------------------------------------->
+ SendCmd "enterlocal" || return $false
+ SendCmd "menu=New Menu '$vdr_version'" || return $false
+ SendCmd "menu.SetColorKeyText -blue 'Help'" || return $false
+ SendCmd "menu.SetColumns 24" || return $false
+ SendCmd "menu.EnableEvent keyOk keyBlue close" || return $false
+ # List -------------------------------------------------------------------------------------------------------------->
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Einstellungen ---'" || return $false
+ SendCmd "opt1=menu.AddNew EditListItem -selectname '$noad' 'Schnittmarken erkennen' on off" || return $false
+ SendCmd "opt2=menu.AddNew EditListItem -selectname '$KEYB_TTY' 'KEYB TTY' \"\" $(echo $all_tty)" || return $false
+ SendCmd "opt3=menu.AddNew EditListItem -selectname '$VDRLANG' 'Sprache (LANG)' $(echo $all_lang)" || return $false
+ SendCmd "opt4=menu.AddNew EditIntItem 'Watchdog Timeout (sec)' '$WATCHDOG'" || return $false
+ SendCmd "opt5=menu.AddNew EditIntItem 'XV Display' '$XV_DISPLAY'" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Laufwerke & Verzeichnisse ---'" || return $false
+ SendCmd "optA=menu.AddNew EditStrItem 'Video' '$videodir'" || return $false
+ SendCmd "optB=menu.AddNew EditStrItem 'Musik' '$musicdir'" || return $false
+ SendCmd "optC=menu.AddNew EditStrItem 'DVD-Isos' '$dvdisodir'" || return $false
+ SendCmd "optD=menu.AddNew EditStrItem 'Bilder und Fotos' '$picturedir'" || return $false
+ SendCmd "optE=menu.AddNew EditStrItem 'DivX und Co' '$divxdir'" || return $false
+ SendCmd "optF=menu.AddNew EditStrItem 'EPG Daten' '$vdrvardir'" || return $false
+ SendCmd "optG=menu.AddNew EditListItem -selectname '$dvdburner' 'DVD Brenner' \"\" $(echo $all_dvd)" || return $false
+ # <-------------------------------------------------------------------------------------------------------------- List
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "opt1.SetCurrent" || return $false
+ SendCmd "menu.show" || return $false
+ # <-------------------------------------------------------------------------------------------------------------- Menu
+
+ while true; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk
+ if IsEvent menu keyOk ; then
+ # noad
+ SendCmd "opt1.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ value="${reply6xx[1]}"
+ if [ "$noad" != "$value" ]; then
+ DoLog "changing noad to $value"
+ sed -i $config -e "/^noad=/s/$noad/$value/"
+ noad="$value"
+ fi
+ # KEYB_TTY
+ SendCmd "opt2.GetValue -name" || return $false
+ if [ "${reply6xx[0]}" = 600 ]; then
+ value="${reply6xx[1]}"
+ elif [ "${reply2xx[0]}" = 200 ]; then
+ value=""
+ else
+ return $false
+ fi
+ if [ "$KEYB_TTY" != "$value" ]; then
+ DoLog "changing KEYB_TTY to \"$value\""
+ sed -i $config -e "/^KEYB_TTY=/s/\"//g" -e "s?^KEYB_TTY=$KEYB_TTY?KEYB_TTY=\"$value\"?"
+ KEYB_TTY="$value"
+ fi
+
+ # VDRLANG
+ SendCmd "opt3.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ value="${reply6xx[1]}"
+ if [ "$VDRLANG" != "$value" ]; then
+ DoLog "changing VDRLANG to $value"
+ sed -i $config -e "/^VDRLANG=/s/$VDRLANG/$value/"
+ VDRLANG="$value"
+ fi
+
+ # WATCHDOG
+ SendCmd "opt4.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ value="${reply6xx[1]}"
+ if [ "$WATCHDOG" != "$value" ]; then
+ DoLog "changing WATCHDOG to $value"
+ sed -i $config -e "/^WATCHDOG=/s/$WATCHDOG/$value/"
+ WATCHDOG="$value"
+ fi
+ # XV_DISPLAY
+ SendCmd "opt5.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ value="${reply6xx[1]}"
+ if [ "$XV_DISPLAY" != "$value" ]; then
+ DoLog "changing XV_DISPLAY to $value"
+ sed -i $config -e "/^XV_DISPLAY=/s/$XV_DISPLAY/$value/"
+ XV_DISPLAY="$value"
+ fi
+ # VIDEODIR
+ SendCmd "optA.GetValue -quoted" || return $false
+ [ "${reply5xx[0]}" != 500 ] && return $false
+ value="${reply5xx[1]}"
+ if [ "$videodir" != "$value" ]; then
+ [ ! -d "$value" ] && CreateDir "$value"
+ if [ -d "$value" ]; then
+ DoLog "changing VIDEODIR to $value"
+ sed -i $config -e "/^VIDEODIR=/s?$videodir?$value?"
+ else
+ DoLog "error: directory \"$value\" does not exists"
+ fi
+ fi
+ # MUSICDIR
+ SendCmd "optB.GetValue -quoted" || return $false
+ [ "${reply5xx[0]}" != 500 ] && return $false
+ value="${reply5xx[1]}"
+ if [ "$musicdir" != "$value" ]; then
+ [ ! -d "$value" ] && CreateDir "$value"
+ if [ -d "$value" ]; then
+ DoLog "changing MUSICDIR to $value"
+ sed -i $config -e "/^MUSICDIR=/s?$musicdir?$value?"
+ else
+ DoLog "error: directory \"$value\" does not exists"
+ fi
+ fi
+ # DVDISODIR
+ SendCmd "optC.GetValue -quoted" || return $false
+ [ "${reply5xx[0]}" != 500 ] && return $false
+ value="${reply5xx[1]}"
+ if [ "$dvdisodir" != "$value" ]; then
+ [ ! -d "$value" ] && CreateDir "$value"
+ if [ -d "$value" ]; then
+ DoLog "changing DVDISODIR to $value"
+ sed -i $config -e "/^DVDISODIR=/s?$dvdisodir?$value?"
+ else
+ DoLog "error: directory \"$value\" does not exists"
+ fi
+ fi
+ # PICTUREDIR
+ SendCmd "optD.GetValue -quoted" || return $false
+ [ "${reply5xx[0]}" != 500 ] && return $false
+ value="${reply5xx[1]}"
+ if [ "$picturedir" != "$value" ]; then
+ [ ! -d "$value" ] && CreateDir "$value"
+ if [ -d "$value" ]; then
+ DoLog "changing PICTUREDIR to $value"
+ sed -i $config -e "/^PICTUREDIR=/s?$picturedir?$value?"
+ else
+ DoLog "error: directory \"$value\" does not exists"
+ fi
+ fi
+ # DIVXDIR
+ SendCmd "optE.GetValue -quoted" || return $false
+ [ "${reply5xx[0]}" != 500 ] && return $false
+ value="${reply5xx[1]}"
+ if [ "$divxdir" != "$value" ]; then
+ [ ! -d "$value" ] && CreateDir "$value"
+ if [ -d "$value" ]; then
+ DoLog "changing DIVXDIR to $value"
+ sed -i $config -e "/^DIVXDIR=/s?$divxdir?$value?"
+ else
+ DoLog "error: directory \"$value\" does not exists"
+ fi
+ fi
+ # VDRVARDIR
+ SendCmd "optF.GetValue -quoted" || return $false
+ [ "${reply5xx[0]}" != 500 ] && return $false
+ value="${reply5xx[1]}"
+ if [ "$vdrvardir" != "$value" ]; then
+ [ ! -d "$value" ] && CreateDir "$value"
+ if [ -d "$value" ]; then
+ DoLog "changing VDRVARDIR to $value"
+ sed -i $config -e "/^VDRVARDIR=/s?$vdrvardir?$value?"
+ else
+ DoLog "error: directory \"$value\" does not exists"
+ fi
+ fi
+ # DVDBURNER
+ SendCmd "optG.GetValue -name" || return $false
+ if [ "${reply6xx[0]}" = 600 ]; then
+ value="${reply6xx[1]}"
+ elif [ "${reply2xx[0]}" = 200 ]; then
+ value=""
+ else
+ return $false
+ fi
+ if [ "$dvdburner" != "$value" ]; then
+ DoLog "changing DVDBURNER to \"$value\""
+ [ ! -e "$value" ] && DoLog "warning: \"$value\" is no valid"
+# sed -i $config -e "/^DVDBURNER=/s?$dvdburner?$value?"
+ sed -i $config -e "/^DVDBURNER=/s/\"//g" -e "s?^DVDBURNER=$dvdburner?DVDBURNER=\"$value\"?"
+ fi
+ # close the submenu
+ if [ "$vdrsetup_ok_ends" = "on" ]; then
+ SendCmd "menu.SendState osBack" || return $false
+# SendCmd "delete menu" || return $false
+# SendCmd "leavelocal" || return $false
+# return $true
+ fi
+ fi
+ # keyBlue (Help)
+ if IsEvent menu keyBlue ; then
+ SendCmd "Message -seconds 5 'Speichern mit Ok oder Menue verlassen mit Exit'" || return $false
+ fi
+ # close the submenu
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ done
+}
+
+##### Plugin Menus #####
+function PluginSetup() {
+ plugin=$1
+ plugin_have_args=$(grep "^${plugin}_args=" $config | tail -n1)
+ plugin_version=$(grep "^${plugin}_desc=" /tmp/vdr-desc.cache | tail -n1 | sed -e "s/^${plugin}_desc=//" -e 's/[^)]*$//' -e 's/"//g' -e 's/#.*//')
+ [ -n "$plugin_version" ] || plugin_version="$plugin"
+ # Menu -------------------------------------------------------------------------------------------------------------------->
+ SendCmd "enterlocal" || return $false
+ SendCmd "menu=New Menu '$plugin_version'" || return $false
+ SendCmd "menu.SetColorKeyText -green 'About' -blue 'Help'" || return $false
+ SendCmd "menu.SetColumns 14" || return $false
+ SendCmd "menu.EnableEvent keyOk keyGreen keyBlue close" || return $false
+ # List -------------------------------------------------------------------------------------------------------------------->
+ SendCmd "opt1=menu.AddNew EditListItem -selectname '${!plugin}' 'Status' on off" || return $false
+ if [ "$plugin" = "remote" ]; then
+ SendCmd "optA=menu.AddNew EditStrItem 'Remote Event' '$remote_event'" || return $false
+ fi
+ if [ -n "$plugin_have_args" ]; then
+ plugin_args=$(echo "$plugin_have_args" | sed -e "s/^${plugin}_args=//" -e 's/"//g' -e 's/#.*//')
+ SendCmd "opt2=menu.AddNew EditStrItem 'Argumente' '$plugin_args'" || return $false
+ else
+ SendCmd "menu.AddNew OsdItem -unselectable 'Argumente:\tPlugin kennt keine Argumente'" || return $false
+ fi
+ # <-------------------------------------------------------------------------------------------------------------------- List
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "opt1.SetCurrent" || return $false
+ SendCmd "menu.show" || return $false
+ # <-------------------------------------------------------------------------------------------------------------------- Menu
+
+ while true; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk
+ if IsEvent menu keyOk ; then
+ # plugin status
+ SendCmd "opt1.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ value="${reply6xx[1]}"
+ if [ "${!plugin}" != "$value" ]; then
+ DoLog "changing $plugin to $value"
+ sed -i $config -e "/^$plugin=/s/${!plugin}/$value/"
+ eval $plugin="$value"
+ fi
+ # plugin arguments
+ if [ -n "$plugin_have_args" ]; then
+ SendCmd "opt2.GetValue -quoted" || return $false
+ if [ "${reply5xx[0]}" = 500 ] || [ "${reply2xx[0]}" = 200 ]; then
+ value=$(echo " ${reply5xx[1]}" | sed -e 's/^ //g' -e 's/\\r//g')
+ if [ "$plugin_args" != "$value" ]; then
+ DoLog "changing arguments for $plugin to $value"
+ sed -i $config -e "/^${plugin}_args=/s/\"//g" -e "s?^${plugin}_args=$plugin_args?${plugin}_args=\"$value\"?"
+ fi
+ fi
+ fi
+ # remote_event for remote plugin
+ if [ "$plugin" = "remote" ]; then
+ SendCmd "optA.GetValue -quoted" || return $false
+ [ "${reply5xx[0]}" = 500 ] || return $false
+ value=$(echo " ${reply5xx[1]}" | sed -e 's/^ //g' -e 's/\\r//g')
+ if [ "$remote_event" != "$value" ]; then
+ DoLog "changing arguments for remote_event to $value"
+ sed -i $config -e "/^remote_event=/s?$remote_event?$value?"
+ fi
+ fi
+ # close the submenu
+ if [ "$vdrsetup_ok_ends" = "on" ]; then
+ SendCmd "menu.SendState osBack" || return $false
+# SendCmd "delete menu" || return $false
+# SendCmd "leavelocal" || return $false
+# return $true
+ fi
+ fi
+ # keyGreen (About)
+ if IsEvent menu keyGreen ; then
+ desc=$(grep "^${plugin}_desc=" /tmp/vdr-desc.cache | tail -n1 | sed -e "s/^${plugin}_desc=\"${plugin} ([^)]*) - //" -e 's/"//g' -e 's/#.*//')
+ SendCmd "Message -seconds 5 \"$desc\"" || return $false
+ fi
+ # keyBlue (Help)
+ if IsEvent menu keyBlue ; then
+ SendCmd "Message -seconds 5 'Auswahl mit Links und Rechts, speichern mit Ok'" || return $false
+ fi
+ # close the submenu
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ done
+}
+
+function PluginStatusList() {
+ # Menu ---------------------------------------------------------------------------------------------------->
+ SendCmd "enterlocal" || return $false
+ SendCmd "menu=New Menu 'Plugin Status Liste'" || return $false
+ SendCmd "menu.SetColorKeyText -green 'About' -blue 'Help'" || return $false # -red 'Edit'
+ SendCmd "menu.SetColumns 24" || return $false
+ SendCmd "menu.EnableEvent keyOk keyGreen keyBlue close" || return $false # keyRed
+ # List ---------------------------------------------------------------------------------------------------->
+ SendCmd "Message -status 'Menu wird aufgebaut ...'" || return $false
+ files=$(ls "$VDRLIBDIR" | grep "^libvdr-" | grep "${plugin_api}$" | sed -e "s/^libvdr-//g" -e "s/.so.${plugin_api}$//g")
+ if [ -n "$files" ]; then
+ for p in $files ; do
+ plugin=$(echo $p | sed -e "s/-/_/g") # this is for streamdev-server ...
+ if [ -z "${!plugin}" ]; then
+ DoLog "creating $plugin=\"off\""
+ echo "" >> $config
+ echo "# $plugin" >> $config
+ echo "${plugin}=\"off\"" >> $config
+ eval ${plugin}="off"
+ # plugin args
+ nl=0; (( nl=$(grep -n "^$p " /tmp/vdr-help.tmp | cut -f 1 -d ":") +1 ))
+ [ $nl -gt 1 ] && [ $(sed -n "${nl}p" /tmp/vdr-help.tmp | grep -c "^-") -gt 0 ] && echo "${plugin}_args=\"\"" >> $config
+ fi
+ SendCmd "$plugin=menu.AddNew EditListItem -selectname \"${!plugin}\" \"$p\" on off" || return $false
+ done
+ fi
+ SendCmd "Message -statusclear" || return $false
+ # <---------------------------------------------------------------------------------------------------- List
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "menu.Show" || return $false
+ # <---------------------------------------------------------------------------------------------------- Menu
+
+ while true ; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk (save settings and clsoe the submenu)
+ if IsEvent menu keyOk ; then
+ if [ -n "$files" ]; then
+ SendCmd "Message 'Einstellungen werden gespeichert'" || return $false
+ for p in $files ; do
+ plugin=$(echo $p | sed -e "s/-/_/g") # this is for streamdev-server ...
+ SendCmd "${plugin}.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "${!plugin}" != "${reply6xx[1]}" ]; then
+ DoLog "changing $plugin to ${reply6xx[1]}"
+ sed -i $config -e "/^${plugin}=/s/${!plugin}/${reply6xx[1]}/"
+ eval ${plugin}="${reply6xx[1]}"
+ fi
+ done
+ fi
+ # close the submenu
+ if [ "$vdrsetup_ok_ends" = "on" ]; then
+ SendCmd "menu.SendState osBack" || return $false
+# SendCmd "delete menu" || return $false
+# SendCmd "leavelocal" || return $false
+# return $true
+ fi
+ fi
+ # keyRed (Edit) !!! Bug Inside !!!
+ if IsEvent menu keyRed ; then
+ SendCmd "menu.GetCurrent"
+ [ "${reply3xx[0]}" != 302 ] && return $false
+ PluginSetup "${reply3xx[2]}" || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyGreen (About)
+ if IsEvent menu keyGreen ; then
+ SendCmd "menu.GetCurrent"
+ [ "${reply3xx[0]}" != 302 ] && return $false
+ desc=$(grep "^${reply3xx[2]}_desc=" /tmp/vdr-desc.cache | tail -n1 | sed -e "s/^${reply3xx[2]}_desc=\"${reply3xx[2]} ([^)]*) - //" -e 's/"//g' -e 's/#.*//')
+ SendCmd "Message -seconds 5 \"$desc\"" || return $false
+ fi
+ # keyBlue (Help)
+ if IsEvent menu keyBlue ; then
+ SendCmd "Message -seconds 5 'Auswahl mit Links und Rechts, speichern mit Ok'" || return $false
+ fi
+ # close the submenu
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ done
+}
+
+function ListPlugins() {
+ # Menu ------------------------------------------------------------------------------------------>
+ SendCmd "enterlocal" || return $false
+ SendCmd "menu=New Menu 'Installierte Plugins'" || return $false
+ SendCmd "menu.SetColorKeyText -red 'Edit' -green 'Status' -blue 'Help'" || return $false
+ SendCmd "menu.SetColumns 4" || return $false
+ SendCmd "menu.EnableEvent keyOk keyRed keyGreen keyBlue close" || return $false
+ SendCmd "menu.EnableEvent key1 key2 key3 key4 key5 key6 key7 key8 key9 key0" || return $false
+ # List------------------------------------------------------------------------------------------->
+ SendCmd "Message -status 'Menu wird aufgebaut ...'" || return $false
+ files=$(ls "$VDRLIBDIR" | grep "^libvdr-" | grep "${plugin_api}$" | sed -e "s/^libvdr-//g" -e "s/.so.${plugin_api}$//g")
+ if [ -n "$files" ]; then
+ n=0
+ for p in $files ; do
+ ((n=n+1))
+ plugin=$(echo $p | sed -e "s/-/_/g") # this is for streamdev-server ...
+ if [ -z "${!plugin}" ]; then
+ DoLog "creating $plugin=\"off\""
+ echo "" >> $config
+ echo "# $plugin" >> $config
+ echo "${plugin}=\"off\"" >> $config
+ eval ${plugin}="off"
+ # plugin args
+ nl=0; (( nl=$(grep -n "^$p " /tmp/vdr-help.tmp | cut -f 1 -d ":") +1 ))
+ [ $nl -gt 1 ] && [ $(sed -n "${nl}p" /tmp/vdr-help.tmp | grep -c "^-") -gt 0 ] && echo "${plugin}_args=\"\"" >> $config
+ fi
+ plugin_desc="${plugin}_desc"
+ desc="${!plugin_desc}"
+ [ -n "$(echo $n | grep "^[0-9][0-9][0-9]$")" ] && N="$n"
+ [ -n "$(echo $n | grep "^[0-9][0-9]$")" ] && N=" $n"
+ [ -n "$(echo $n | grep "^[0-9]$")" ] && N=" $n"
+ SendCmd "$plugin=menu.AddNew OsdItem \"$N \t$desc\"" || return $false
+ done
+ fi
+ SendCmd "Message -statusclear" || return $false
+ # <------------------------------------------------------------------------------------------ List
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "menu.Show" || return $false
+ # <------------------------------------------------------------------------------------------ Menu
+
+ while true ; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk and keyRed
+ if IsEvent menu keyOk || IsEvent menu keyRed; then
+ SendCmd "menu.GetCurrent"
+ [ "${reply3xx[0]}" != 302 ] && return $false
+ PluginSetup "${reply3xx[2]}" || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyGreen (Status)
+ if IsEvent menu keyGreen ; then
+ SendCmd "menu.GetCurrent"
+ [ "${reply3xx[0]}" != 302 ] && return $false
+ plugin="${reply3xx[2]}"
+ SendCmd "Message -seconds 5 'Status: ${!plugin}'" || return $false
+ fi
+ # keyBlue (Help)
+ if IsEvent menu keyBlue ; then
+ SendCmd "Message -seconds 5 'Auswahl mit OK oder Menue verlassen mit Exit'" || return $false
+ fi
+ # close the submenu
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ # keyNr
+ if [ $n -gt 0 ]; then
+ mykey=;
+ k1=;
+ for k1 in 0 1 2 3 4 5 6 7 8 9 ; do
+ if IsEvent menu key$k1 ; then
+ mykey=$k1
+ [ $n -gt 9 ] || break
+ SendCmd "menu.SleepEvent -timeoutms $vdrsetup_key_timeout" || return $false
+ if IsEvent menu keyOk ; then break; fi
+ k2=;
+ for k2 in 0 1 2 3 4 5 6 7 8 9 ; do
+ if IsEvent menu key$k2 ; then
+ mykey=${k1}${k2}
+ [ $n -gt 99 ] || break
+ SendCmd "menu.SleepEvent -timeoutms $vdrsetup_key_timeout" || return $false
+ if IsEvent menu keyOk ; then break; fi
+ k3=;
+ for k3 in 0 1 2 3 4 5 6 7 8 9 ; do
+ if IsEvent menu key$k3 ; then
+ mykey=${k1}${k2}${k3}
+ break
+ fi
+ done
+ break
+ fi
+ done
+ break
+ fi
+ done
+
+ if [ -n "$mykey" ]; then
+ [ $mykey -gt $n ] && mykey=$n
+ ((mykey=mykey-1)) # we do this, because 0 is the first item
+ [ $mykey -lt 0 ] && mykey=0
+ SendCmd "menu.SetCurrent $mykey" || return $false
+# SendCmd "menu.GetCurrent"
+# [ "${reply3xx[0]}" != 302 ] && return $false
+# PluginSetup "${reply3xx[2]}" || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ fi
+ done
+}
+
+##### Wakeup Menu #####
+function Wakeup() {
+ shutdown="$VDRCONFDIR/shutdown.conf"
+ . $shutdown
+
+ # settings
+# WAKEUP_MODE=$(grep "^WAKEUP_MODE=" $shutdown | tail -n1 | sed -e "s/^WAKEUP_MODE=//" -e 's/"//g' -e 's/#.*//')
+ (( WAKEUP_MODE_T = $WAKEUP_MODE + 1 ))
+# NVRAM_CONFIG=$(grep "^NVRAM_CONFIG=" $shutdown | tail -n1 | sed -e "s/^NVRAM_CONFIG=//" -e 's/"//g' -e 's/#.*//')
+# NVRAM_IWNAME=$(grep "^NVRAM_IWNAME=" $shutdown | tail -n1 | sed -e "s/^NVRAM_IWNAME=//" -e 's/"//g' -e 's/#.*//')
+# NVRAM_OPT=$(grep "^NVRAM_OPT=" $shutdown | tail -n1 | sed -e "s/^NVRAM_OPT=//" -e 's/"//g' -e 's/#.*//')
+# NEED_REBOOT=$(grep "^NEED_REBOOT=" $shutdown | tail -n1 | sed -e "s/^NEED_REBOOT=//" -e 's/"//g' -e 's/#.*//')
+ (( NEED_REBOOT_T = $NEED_REBOOT + 1 ))
+# LILO=$(grep "^LILO=" $shutdown | tail -n1 | sed -e "s/^LILO=//" -e 's/"//g' -e 's/#.*//')
+ (( LILO_T = $LILO + 1 ))
+
+# WAKEUP_BEFORE=$(grep "^WAKEUP_BEFORE=" $shutdown | tail -n1 | sed -e "s/^WAKEUP_BEFORE=//" -e 's/"//g' -e 's/#.*//')
+# MAX_POWEROFF_TIME=$(grep "^MAX_POWEROFF_TIME=" $shutdown | tail -n1 | sed -e "s/^MAX_POWEROFF_TIME=//" -e 's/"//g' -e 's/#.*//')
+# INTERVAL=$(grep "^INTERVAL=" $shutdown | tail -n1 | sed -e "s/^INTERVAL=//" -e 's/"//g' -e 's/#.*//')
+# DREAMTIME=$(grep "^DREAMTIME=" $shutdown | tail -n1 | sed -e "s/^DREAMTIME=//" -e 's/"//g' -e 's/#.*//')
+# MIN_WAKEUP_VAR=$(grep "^MIN_WAKEUP_VAR=" $shutdown | tail -n1 | sed -e "s/^MIN_WAKEUP_VAR=//" -e 's/"//g' -e 's/#.*//')
+# WAITING_PERIOD=$(grep "^WAITING_PERIOD=" $shutdown | tail -n1 | sed -e "s/^WAITING_PERIOD=//" -e 's/"//g' -e 's/#.*//')
+
+ # Menu --------------------------------------------------------------------------------------------------------------------------->
+ SendCmd "enterlocal" || return $false
+ SendCmd "menu=New Menu 'Wakeup'" || return $false
+ SendCmd "menu.SetColorKeyText -blue Help" || return $false
+ SendCmd "menu.SetColumns 24" || return $false
+ SendCmd "menu.EnableEvent keyOk close" || return $false
+ # List --------------------------------------------------------------------------------------------------------------------------->
+ SendCmd "menu.AddNew OsdItem -unselectable '--- System ---'" || return $false
+ SendCmd "opt1=menu.AddNew EditListItem -select '$WAKEUP_MODE_T' 'Aufwach Methode' keine acpi nvram extension-board" || return $false
+ SendCmd "opt1.EnableEvent keyBlue" || return $false
+ SendCmd "opt2=menu.AddNew EditListItem -select '$NEED_REBOOT_T' 'Neustart erforderlich' nein ja immer" || return $false
+ SendCmd "opt2.EnableEvent keyBlue" || return $false
+ SendCmd "opt3=menu.AddNew EditListItem -select '$LILO_T' 'Bootmanger' grub lilo" || return $false
+ SendCmd "opt3.EnableEvent keyBlue" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Nvram ---'" || return $false
+ SendCmd "opt4=menu.AddNew EditStrItem 'Konfiguration' '$NVRAM_CONFIG'" || return $false
+ SendCmd "opt4.EnableEvent keyBlue" || return $false
+ SendCmd "opt5=menu.AddNew EditStrItem 'IW Name' '$NVRAM_IWNAME'" || return $false
+ SendCmd "opt5.EnableEvent keyBlue" || return $false
+ SendCmd "opt6=menu.AddNew EditStrItem 'Optionen' '$NVRAM_OPT'" || return $false
+ SendCmd "opt6.EnableEvent keyBlue" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Nur fuer Experten ---'" || return $false
+ SendCmd "optA=menu.AddNew EditIntItem 'Vorlauf in Minuten' '$WAKEUP_BEFORE'" || return $false
+ SendCmd "optA.EnableEvent keyBlue" || return $false
+ SendCmd "optB=menu.AddNew EditStrItem 'Maximale Auszeit' '$MAX_POWEROFF_TIME'" || return $false
+ SendCmd "optB.EnableEvent keyBlue" || return $false
+ SendCmd "optC=menu.AddNew EditIntItem -max 31 'Interval in Tagen' '$INTERVAL'" || return $false
+ SendCmd "optC.EnableEvent keyBlue" || return $false
+ SendCmd "optD=menu.AddNew EditStrItem 'Wunsch Aufwachzeit' '$DREAMTIME'" || return $false
+ SendCmd "optD.EnableEvent keyBlue" || return $false
+ SendCmd "optE=menu.AddNew EditIntItem -max 3 'Aktion' '$MIN_WAKEUP_VAR'" || return $false
+ SendCmd "optE.EnableEvent keyBlue" || return $false
+ SendCmd "optF=menu.AddNew EditIntItem 'Warte Zeit' '$WAITING_PERIOD'" || return $false
+ SendCmd "optF.EnableEvent keyBlue" || return $false
+ # <---------------------------------------------------------------------------------------------------------------------------- List
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "opt1.SetCurrent" || return $false
+ SendCmd "menu.show" || return $false
+ # <---------------------------------------------------------------------------------------------------------------------------- Menu
+
+ while true; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk
+ if IsEvent menu keyOk ; then
+ # WAKEUP_MODE
+ SendCmd "opt1.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$WAKEUP_MODE_T" != "${reply6xx[1]}" ]; then
+ (( WAKEUP_MODE_N = ${reply6xx[1]} - 1 ))
+ (( WAKEUP_MODE = $WAKEUP_MODE_T - 1 ))
+ DoLog "changing WAKEUP_MODE to $WAKEUP_MODE_N"
+ sed -i $shutdown -e "/^WAKEUP_MODE=/s/$WAKEUP_MODE/$WAKEUP_MODE_N/"
+ fi
+ # NEED_REBOOT
+ SendCmd "opt2.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$NEED_REBOOT_T" != "${reply6xx[1]}" ]; then
+ (( NEED_REBOOT_N = ${reply6xx[1]} - 1 ))
+ (( NEED_REBOOT = $NEED_REBOOT_T - 1 ))
+ DoLog "changing NEED_REBOOT to $NEED_REBOOT_N"
+ sed -i $shutdown -e "/^NEED_REBOOT=/s/$NEED_REBOOT/$NEED_REBOOT_N/"
+ fi
+ # LILO
+ SendCmd "opt3.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$LILO_T" != "${reply6xx[1]}" ]; then
+ (( LILO_N = ${reply6xx[1]} - 1 ))
+ (( LILO = $LILO_T - 1 ))
+ DoLog "changing LILO to $LILO_N"
+ sed -i $shutdown -e "/^LILO=/s/$LILO/$LILO_N/"
+ fi
+ # NVRAM_CONFIG
+ SendCmd "opt4.GetValue -quoted" || return $false
+ if [ "${reply5xx[0]}" = 500 ] || [ "${reply2xx[0]}" = 200 ]; then
+ value=$(echo " ${reply5xx[1]}" | sed -e 's/^ //g' -e 's/\\r//g')
+ if [ "$NVRAM_CONFIG" != "$value" ]; then
+ if [ -f "$value" ]; then
+ DoLog "changing NVRAM_CONFIG to $value"
+ sed -i $shutdown -e "/^NVRAM_CONFIG=/s/\"//g" -e "s?^NVRAM_CONFIG=$NVRAM_CONFIG?NVRAM_CONFIG=\"$value\"?"
+ else
+ DoLog "error: file \"$value\" for NVRAM_CONFIG does not exist"
+ fi
+ fi
+ fi
+ # NVRAM_IWNAME
+ SendCmd "opt5.GetValue -quoted" || return $false
+ if [ "${reply5xx[0]}" = 500 ] || [ "${reply2xx[0]}" = 200 ]; then
+ value=$(echo " ${reply5xx[1]}" | sed -e 's/^ //g' -e 's/\\r//g')
+ if [ "$NVRAM_IWNAME" != "$value" ]; then
+ DoLog "changing NVRAM_IWNAME to $value"
+ sed -i $shutdown -e "/^NVRAM_IWNAME=/s/\"//g" -e "s?^NVRAM_IWNAME=$NVRAM_IWNAME?NVRAM_IWNAME=\"$value\"?"
+ fi
+ fi
+ # NVRAM_OPT
+ SendCmd "opt6.GetValue -quoted" || return $false
+ if [ "${reply5xx[0]}" = 500 ] || [ "${reply2xx[0]}" = 200 ]; then
+ value=$(echo " ${reply5xx[1]}" | sed -e 's/^ //g' -e 's/\\r//g')
+ if [ "$NVRAM_OPT" != "$value" ]; then
+ DoLog "changing NVRAM_OPT to $value"
+ sed -i $shutdown -e "/^NVRAM_OPT=/s/\"//g" -e "s?^NVRAM_OPT=$NVRAM_OPT?NVRAM_OPT=\"$value\"?"
+ fi
+ fi
+ # WAKEUP_BEFORE
+ SendCmd "optA.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$WAKEUP_BEFORE" != "${reply6xx[1]}" ]; then
+ DoLog "changing WAKEUP_BEFORE to ${reply6xx[1]}"
+ sed -i $shutdown -e "/^WAKEUP_BEFORE=/s/$WAKEUP_BEFORE/${reply6xx[1]}/"
+ fi
+ # MAX_POWEROFF_TIME
+ SendCmd "optB.GetValue -quoted" || return $false
+ if [ "${reply5xx[0]}" = 500 ] || [ "${reply2xx[0]}" = 200 ]; then
+ value=$(echo " ${reply5xx[1]}" | sed -e 's/^ //g' -e 's/\\r//g')
+ if [ "$MAX_POWEROFF_TIME" != "$value" ]; then
+ DoLog "changing MAX_POWEROFF_TIME to $value"
+ sed -i $shutdown -e "/^MAX_POWEROFF_TIME=/s/\"//g" -e "s?^MAX_POWEROFF_TIME=$MAX_POWEROFF_TIME?MAX_POWEROFF_TIME=\"$value\"?"
+ fi
+ fi
+ # INTERVAL
+ SendCmd "optC.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$INTERVAL" != "${reply6xx[1]}" ]; then
+ DoLog "changing INTERVAL to ${reply6xx[1]}"
+ sed -i $shutdown -e "/^INTERVAL=/s/$INTERVAL/${reply6xx[1]}/"
+ fi
+ # DREAMTIME
+ SendCmd "optD.GetValue -quoted" || return $false
+ if [ "${reply5xx[0]}" = 500 ] || [ "${reply2xx[0]}" = 200 ]; then
+ value=$(echo " ${reply5xx[1]}" | sed -e 's/^ //g' -e 's/\\r//g')
+ if [ "$DREAMTIME" != "$value" ]; then
+ [ -n "$(echo $value | grep '^[0-9]:[0-9][0-9]$')" ] && value="0${value}"
+ if [ -n "$(echo $value | grep '^[0-9][0-9]:[0-9][0-9]$')" ]; then
+ DoLog "changing DREAMTIME to $value"
+ sed -i $shutdown -e "/^DREAMTIME=/s/\"//g" -e "s?^DREAMTIME=$DREAMTIME?DREAMTIME=\"$value\"?"
+ else
+ DoLog "error: value \"$value\" for DREAMTIME has bad format"
+ fi
+ fi
+ fi
+ # MIN_WAKEUP_VAR
+ SendCmd "optE.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$MIN_WAKEUP_VAR" != "${reply6xx[1]}" ]; then
+ DoLog "changing MIN_WAKEUP_VAR to ${reply6xx[1]}"
+ sed -i $shutdown -e "/^MIN_WAKEUP_VAR=/s/$MIN_WAKEUP_VAR/${reply6xx[1]}/"
+ fi
+ # WAITING_PERIOD
+ SendCmd "optF.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "$WAITING_PERIOD" != "${reply6xx[1]}" ]; then
+ DoLog "changing WAITING_PERIOD to ${reply6xx[1]}"
+ sed -i $shutdown -e "/^WAITING_PERIOD=/s/$WAITING_PERIOD/${reply6xx[1]}/"
+ fi
+ # close the submenu
+ if [ "$vdrsetup_ok_ends" = "on" ]; then
+ SendCmd "menu.SendState osBack" || return $false
+# SendCmd "delete menu" || return $false
+# SendCmd "leavelocal" || return $false
+# return $true
+ fi
+ fi
+ # keyBlue (Help)
+ if IsEvent opt1 keyBlue ; then
+ SendCmd "Message -seconds 5 'Optionen: keine, acpi, nvram, extension-board'" || return $false
+ fi
+ if IsEvent opt2 keyBlue ; then
+ SendCmd "Message -seconds 5 'Optionen: nein, ja, immer'" || return $false
+ fi
+ if IsEvent opt3 keyBlue ; then
+ SendCmd "Message -seconds 5 'Optionen: grub, lilo'" || return $false
+ fi
+ if IsEvent opt4 keyBlue ; then
+ SendCmd "Message -seconds 5 'Pfad zur nvram-wakeup Konfiguration'" || return $false
+ fi
+ if IsEvent opt5 keyBlue ; then
+ SendCmd "Message -seconds 5 'Specify the iw (infowriter) name (e.g: gigabyte_5aa)'" || return $false
+ fi
+ if IsEvent opt6 keyBlue ; then
+ SendCmd "Message -seconds 5 'Versuche \"nvram-wakeup --help\" auf einem Terminal'" || return $false
+ fi
+ if IsEvent optA keyBlue ; then
+ SendCmd "Message -seconds 5 'Optionen: 0, MAXIMAL, INTERVAL oder Zeit in Minuten'" || return $false
+ fi
+ if IsEvent optB keyBlue ; then
+ SendCmd "Message -seconds 5 'Gebe den Interval in Tagen an'" || return $false
+ fi
+ if IsEvent optC keyBlue ; then
+ SendCmd "Message -seconds 5 'Aufwachzeit in Stunden:Minuten zB 03:00'" || return $false
+ fi
+ if IsEvent optD keyBlue ; then
+ SendCmd "Message -seconds 5 'Aktion wenn \$MIN_WAKEUPTIME -gt \$WAKEUPTIME'" || return $false
+ fi
+ if IsEvent optE keyBlue ; then
+ SendCmd "Message -seconds 5 'Wartezeit bis zum erneuten Shutdown in Minuten'" || return $false
+ fi
+ # close the submenu
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ done
+}
+
+##### DVB-Modul Menu #####
+function DVBModul() {
+ # dvb_ttpci parameter description
+ debug_desc="debug level (bitmask, default 0)"
+ vidmode_desc="analog video out: 0 off, 1 CVBS+RGB (default), 2 CVBS+YC, 3 YC"
+ pids_off_desc="clear video/audio/PCR PID filters when demux is closed"
+ adac_desc="audio DAC type: 0 TI, 1 CRYSTAL, 2 MSP (use if autodetection fails)"
+ hw_sections_desc="0 use software section filter, 1 use hardware"
+ rgb_on_desc="For Siemens DVB-C cards only: Enable RGB control signal on SCART pin 16 to switch SCART video mode from CVBS to RGB"
+ volume_desc="initial volume: default 255 (range 0-255)"
+ budgetpatch_desc="use budget-patch hardware modification: default 0 (0 no, 1 autodetect, 2 always)"
+ wss_cfg_4_3_desc="WSS 4:3 - default 0x4008 - bit 15: disable, 14: burst mode, 13..0: wss data"
+ wss_cfg_16_9_desc="WSS 16:9 - default 0x0007 - bit 15: disable, 14: burst mode, 13..0: wss data"
+ tv_standard_desc="TV standard: 0 PAL (default), 1 NTSC"
+
+
+# { 0x7, "16:9" },
+# { 0x8, "4:3" },
+# { 0x1, "L14:9" },
+# { 0xb, "L16:9" },
+# { 0xd, "L>16:9" }
+
+
+ TT_PARAMETERS="options dvb_ttpci"
+ if [ -d /sys/module/dvb_ttpci/parameters ]; then
+ for p in $(ls /sys/module/dvb_ttpci/parameters); do
+ eval ${p}=`cat /sys/module/dvb_ttpci/parameters/${p}`
+ done
+ fi
+
+ # defaults and some tests
+ vidmode=$(echo $vidmode | grep '^[0,1,2,3]$')
+ [ -n "$vidmode" ] || vidmode=1
+ [ "$vidmode" = "0" ] && vidmode=4
+ tv_standard=$(echo $tv_standard | grep '^[0,1]$')
+ [ -n "$tv_standard" ] || tv_standard=0
+ (( tv_standard = $tv_standard + 1 ))
+ wss_cfg_16_9=$(echo $wss_cfg_16_9 | grep '^[[:digit:]]*$')
+ [ -n "$wss_cfg_16_9" ] || wss_cfg_16_9=7
+ wss_cfg_4_3=$(echo $wss_cfg_4_3 | grep '^[[:digit:]]*$')
+ [ -n "$wss_cfg_4_3" ] || wss_cfg_4_3=16392
+ debug=$(echo $debug | grep '^[[:digit:]]*$')
+ [ -n "$debug" ] || debug=0
+ ir_inversion=$(echo $ir_inversion | cut -f1 -d ',' | grep '^[0,1]$')
+ [ -n "$ir_inversion" ] || ir_inversion=0
+ (( ir_inversion = $ir_inversion + 1 ))
+ volume=$(echo $volume | grep '^[[:digit:]]*$')
+ [ -n "$volume" ] || volume=255
+
+
+ SendCmd "enterlocal" || return $false # Preserve global variable space, so we can re-use 'menu'
+ SendCmd "menu=New Menu 'DVB Module'" || return $false
+ SendCmd "menu.SetColorKeyText -blue Help" || return $false
+ SendCmd "menu.SetColumns 24" || return $false
+ SendCmd "menu.EnableEvent keyOk close" || return $false
+ # List ->
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Video ---'" || return $false
+ SendCmd "opt1=menu.AddNew EditListItem -select '$vidmode' 'Video Ausgang' RGB/Composite S-Video/Composite S-Video off" || return $false
+ SendCmd "opt1.EnableEvent keyBlue" || return $false
+ SendCmd "opt2=menu.AddNew EditListItem -select '$tv_standard' 'TV Standard' PAL NTSC" || return $false
+ SendCmd "opt2.EnableEvent keyBlue" || return $false
+ SendCmd "opt3=menu.AddNew EditIntItem 'WSS 16:9' '$wss_cfg_16_9'" || return $false
+# SendCmd "opt3=menu.AddNew EditListItem -select '$wss_cfg_16_9' 'WSS 16:9' 16:9 1 2 " || return $false
+ SendCmd "opt3.EnableEvent keyBlue" || return $false
+ SendCmd "opt4=menu.AddNew EditIntItem 'WSS 4:3' '$wss_cfg_4_3'" || return $false
+ SendCmd "opt4.EnableEvent keyBlue" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable ''" || return $false
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Sonstiges ---'" || return $false
+ SendCmd "opt5=menu.AddNew EditIntItem 'Debug Level' '$debug'" || return $false
+ SendCmd "opt5.EnableEvent keyBlue" || return $false
+ SendCmd "opt6=menu.AddNew EditListItem -select '$ir_inversion' 'IR invertieren' off on" || return $false
+ SendCmd "opt6.EnableEvent keyBlue" || return $false
+ SendCmd "opt7=menu.AddNew EditIntItem -max 255 'Lautstaerke' '$volume'" || return $false
+ SendCmd "opt7.EnableEvent keyBlue" || return $false
+ # <- List
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "opt1.SetCurrent" || return $false
+ SendCmd "menu.show" || return $false
+
+ while true; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk
+ if IsEvent menu keyOk ; then
+ # vidmode
+ SendCmd "opt1.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "1" != "${reply6xx[1]}" ]; then
+ vidmode="${reply6xx[1]}"
+ [ "$vidmode" = "4" ] && vidmode=0
+ DoLog "adding vidmode=${reply6xx[1]} to TT_PARAMETERS"
+ TT_PARAMETERS="$TT_PARAMETERS vidmode=${reply6xx[1]}"
+ fi
+ # tv_standard
+ SendCmd "opt2.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "1" != "${reply6xx[1]}" ]; then
+ (( tv_standard = ${reply6xx[1]} - 1 ))
+ DoLog "adding tv_standard=$tv_standard to TT_PARAMETERS"
+ TT_PARAMETERS="$TT_PARAMETERS tv_standard=$tv_standard"
+ fi
+ # wss_cfg_16_9
+ SendCmd "opt3.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "7" != "${reply6xx[1]}" ]; then
+ DoLog "adding wss_cfg_16_9=${reply6xx[1]} to TT_PARAMETERS"
+ TT_PARAMETERS="$TT_PARAMETERS wss_cfg_16_9=${reply6xx[1]}"
+ fi
+ # wss_cfg_4_3
+ SendCmd "opt4.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "16392" != "${reply6xx[1]}" ]; then
+ DoLog "adding wss_cfg_4_3=${reply6xx[1]} to TT_PARAMETERS"
+ TT_PARAMETERS="$TT_PARAMETERS wss_cfg_4_3=${reply6xx[1]}"
+ fi
+ # debug
+ SendCmd "opt5.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "0" != "${reply6xx[1]}" ]; then
+ DoLog "adding debug=${reply6xx[1]} to TT_PARAMETERS"
+ TT_PARAMETERS="$TT_PARAMETERS debug=${reply6xx[1]}"
+ fi
+ # ir_inversion
+ SendCmd "opt6.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "1" != "${reply6xx[1]}" ]; then
+ (( ir_inversion = ${reply6xx[1]} - 1 ))
+ DoLog "adding tv_standard=$ir_inversion to TT_PARAMETERS"
+ TT_PARAMETERS="$TT_PARAMETERS tv_standard=$ir_inversion"
+ fi
+ # volume
+ SendCmd "opt7.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ if [ "255" != "${reply6xx[1]}" ]; then
+ DoLog "adding volume=${reply6xx[1]} to TT_PARAMETERS"
+ TT_PARAMETERS="$TT_PARAMETERS volume=${reply6xx[1]}"
+ fi
+
+ # write config to /etc/modprobe.d/dvb
+ echo $TT_PARAMETERS > /etc/modprobe.d/dvb
+
+ # close the submenu
+ if [ "$vdrsetup_ok_ends" = "on" ]; then
+ SendCmd "menu.SendState osBack" || return $false
+# SendCmd "delete menu" || return $false
+# SendCmd "leavelocal" || return $false
+# return $true
+ fi
+ fi
+ # keyBlue (Help)
+ if IsEvent opt1 keyBlue ; then
+ SendCmd "Message -seconds 5 'Video Modus des J2 - default RGB'" || return $false
+ fi
+ if IsEvent opt2 keyBlue ; then
+ SendCmd "Message -seconds 5 'TV Standard - default Pal'" || return $false
+ fi
+ if IsEvent opt3 keyBlue ; then
+ SendCmd "Message -seconds 5 'WSS 16/9 - default 7'" || return $false
+ fi
+ if IsEvent opt4 keyBlue ; then
+ SendCmd "Message -seconds 5 'WSS 4/3 - default 16392'" || return $false
+ fi
+ if IsEvent opt5 keyBlue ; then
+ SendCmd "Message -seconds 5 'Debug Level - default 0'" || return $false
+ fi
+ if IsEvent opt6 keyBlue ; then
+ SendCmd "Message -seconds 5 'IR-Signal invertieren - default off'" || return $false
+ fi
+ if IsEvent opt7 keyBlue ; then
+ SendCmd "Message -seconds 5 'Start Lautstaerke von 0-255 - default 255'" || return $false
+ fi
+ # close the submenu
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ done
+}
+
+
+##### x-vdr #############
+function InstallPlugins {
+ [ "$have_xvdr" = "on" ] || return $false
+ xdir=/usr/local/src/x-vdr
+ cmd=$1
+ # Menu -------------------------------------------------------------------------------------------------------->
+ SendCmd "enterlocal" || return $false
+ if [ "$cmd" = "installed" ]; then
+ SendCmd "menu=New Menu 'Installierte Plugins'" || return $false
+ SendCmd "menu.SetColorKeyText -red 'Edit' -green 'Reinstall' -yellow 'Remove' -blue 'Help'" || return $false
+ SendCmd "menu.SetColumns 4" || return $false
+ elif [ "$cmd" = "standby" ]; then
+ SendCmd "menu=New Menu 'Installierbare Plugins'" || return $false
+ SendCmd "menu.SetColorKeyText -red 'Edit' -green 'Install' -blue 'Help'" || return $false
+ SendCmd "menu.SetColumns 4 16" || return $false
+ else
+ SendCmd "menu=New Menu 'Alle Plugins'" || return $false
+ SendCmd "menu.SetColorKeyText -red 'Edit' -green 'Install' -yellow 'Remove' -blue 'Help'" || return $false
+ SendCmd "menu.SetColumns 4 16" || return $false
+ fi
+
+ SendCmd "menu.EnableEvent keyOk keyRed keyGreen keyYellow keyBlue close" || return $false
+ SendCmd "menu.EnableEvent key1 key2 key3 key4 key5 key6 key7 key8 key9 key0" || return $false
+ # List--------------------------------------------------------------------------------------------------------->
+ SendCmd "Message -status 'Menu wird aufgebaut ...'" || return $false
+ plugs=$(ls -B "$xdir/plugins")
+ if [ -n "$plugs" ]; then
+ n=0
+ for plug in $plugs ; do
+# eval local $(grep -r -m1 "^${plug}=" $xdir/setup.conf) # status
+# if [ "x${!plug}" = "xon" ] || [ "x${!plug}" = "xoff" ]; then
+# fi
+ ins_status="nicht installiert"
+ if [ "$plug" = "streamdev" ]; then
+ [ -f "${VDRLIBDIR}/libvdr-streamdev-server.so.${plugin_api}" ] && ins_status="installiert"
+ [ -f "${VDRLIBDIR}/libvdr-streamdev-client.so.${plugin_api}" ] && ins_status="installiert"
+ plugin_desc="streamdev_server_desc"
+ desc="${!plugin_desc}"
+ [ -n "$desc" ] || {
+ plugin_desc="streamdev_client_desc"
+ desc="${!plugin_desc}"
+ }
+ [ -n "$desc" ] || desc="$plug"
+ else
+ [ -f "${VDRLIBDIR}/libvdr-${plug}.so.${plugin_api}" ] && ins_status="installiert"
+ plugin_desc="${plug}_desc"
+ desc="${!plugin_desc}"
+ [ -n "$desc" ] || desc="$plug"
+ fi
+ if [ "$cmd" = "installed" ]; then
+ if [ "$ins_status" = "installiert" ]; then
+ ((n=n+1))
+ [ -n "$(echo $n | grep "^[0-9][0-9][0-9]$")" ] && N="$n"
+ [ -n "$(echo $n | grep "^[0-9][0-9]$")" ] && N=" $n"
+ [ -n "$(echo $n | grep "^[0-9]$")" ] && N=" $n"
+ SendCmd "$plug=menu.AddNew OsdItem '$N \t$desc'" || return $false
+ fi
+ elif [ "$cmd" = "standby" ]; then
+ if [ "$ins_status" != "installiert" ]; then
+ ((n=n+1))
+ [ -n "$(echo $n | grep "^[0-9][0-9][0-9]$")" ] && N="$n"
+ [ -n "$(echo $n | grep "^[0-9][0-9]$")" ] && N=" $n"
+ [ -n "$(echo $n | grep "^[0-9]$")" ] && N=" $n"
+ SendCmd "$plug=menu.AddNew OsdItem '$N \t$plug \t$ins_status'" || return $false
+ fi
+ else # all
+ ((n=n+1))
+ [ -n "$(echo $n | grep "^[0-9][0-9][0-9]$")" ] && N="$n"
+ [ -n "$(echo $n | grep "^[0-9][0-9]$")" ] && N=" $n"
+ [ -n "$(echo $n | grep "^[0-9]$")" ] && N=" $n"
+ SendCmd "$plug=menu.AddNew OsdItem '$N \t$plug \t$ins_status'" || return $false
+ fi
+ done
+ fi
+ SendCmd "Message -statusclear" || return $false
+ # <-------------------------------------------------------------------------------------------------------- List
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "menu.Show" || return $false
+ # <-------------------------------------------------------------------------------------------------------- Menu
+
+ while true ; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk and keyRed
+ # if IsEvent menu keyOk || IsEvent menu keyRed; then
+ # keyRed (Edit)
+ if IsEvent menu keyRed; then
+ SendCmd "menu.GetCurrent"
+ [ "${reply3xx[0]}" != 302 ] && return $false
+ PluginSetup "${reply3xx[2]}" || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyGreen (Install)
+ if IsEvent menu keyGreen ; then
+ SendCmd "menu.GetCurrent"
+ [ "${reply3xx[0]}" != 302 ] && return $false
+ n="${reply3xx[1]}"; N=;
+ [ -n "$(echo $n | grep "^[0-9][0-9][0-9]$")" ] && N="$n"
+ [ -n "$(echo $n | grep "^[0-9][0-9]$")" ] && N=" $n"
+ [ -n "$(echo $n | grep "^[0-9]$")" ] && N=" $n"
+ plugin="${reply3xx[2]}"
+ if [ "$cmd" = "installed" ]; then
+ SendCmd "Message -warn -seconds 10 '$plugin neu installieren?'" || return $false
+ else
+ SendCmd "Message -warn -seconds 10 '$plugin installieren?'" || return $false
+ fi
+ if IsEvent Message keyOk ; then
+ SendCmd "Message -status 'Installiere $plugin ...'" || return $false
+ cd $xdir/plugins/$plugin
+ plugin_status=$(./plugin.sh -s)
+ case $plugin_status in
+ 0 ) ./plugin.sh -m && {
+ $VDRPRG --version | sed -e 's/\(^[^ ]*\)\(.*$\)/\1_desc="\1\2"/' -e '/^streamdev/s/-/_/' -e 's/^\[.*//' | sort > /tmp/vdr-desc.cache
+ . /tmp/vdr-desc.cache
+ } ;;
+ * ) ./plugin.sh -r ;;
+ esac
+ SendCmd "Message -statusclear" || return $false
+ SendCmd "$plugin.SETTEXT '$N \t$plugin \tinstalliert'"
+ SendCmd "menu.Show" || return $false
+ fi
+ fi
+ # keyYellow (Remove)
+ if [ "$cmd" != "standby" ]; then
+ if IsEvent menu keyYellow ; then
+ SendCmd "menu.GetCurrent"
+ [ "${reply3xx[0]}" != 302 ] && return $false
+ n="${reply3xx[1]}"; N=;
+ [ -n "$(echo $n | grep "^[0-9][0-9][0-9]$")" ] && N="$n"
+ [ -n "$(echo $n | grep "^[0-9][0-9]$")" ] && N=" $n"
+ [ -n "$(echo $n | grep "^[0-9]$")" ] && N=" $n"
+ plugin="${reply3xx[2]}"
+ cd $xdir/plugins/$plugin
+ plugin_status=$(./plugin.sh -s)
+ case $plugin_status in
+ 0 ) SendCmd "Message -seconds 5 '$plugin ist nicht installiert'" || return $false ;;
+ * ) SendCmd "Message -warn -seconds 10 'Soll $plugin entfernt werden?'" || return $false
+ if IsEvent Message keyOk ; then
+ SendCmd "Message -status 'Entferne $plugin ...'" || return $false
+ ./plugin.sh -c
+ SendCmd "Message -statusclear" || return $false
+ SendCmd "$plugin.SETTEXT '$N \t$plugin'"
+ SendCmd "menu.Show" || return $false
+ fi ;;
+ esac
+ fi
+ fi
+ # keyBlue (Help)
+ if IsEvent menu keyBlue ; then
+ SendCmd "Message -seconds 5 'Auswahl mit Farbtasten oder Menue verlassen mit Exit'" || return $false
+ fi
+ # close the submenu
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ # keyNr
+ if [ $n -gt 0 ]; then
+ mykey=;
+ k1=;
+ for k1 in 0 1 2 3 4 5 6 7 8 9 ; do
+ if IsEvent menu key$k1 ; then
+ mykey=$k1
+ [ $n -gt 9 ] || break
+ SendCmd "menu.SleepEvent -timeoutms $vdrsetup_key_timeout" || return $false
+ if IsEvent menu keyOk ; then break; fi
+ k2=;
+ for k2 in 0 1 2 3 4 5 6 7 8 9 ; do
+ if IsEvent menu key$k2 ; then
+ mykey=${k1}${k2}
+ [ $n -gt 99 ] || break
+ SendCmd "menu.SleepEvent -timeoutms $vdrsetup_key_timeout" || return $false
+ if IsEvent menu keyOk ; then break; fi
+ k3=;
+ for k3 in 0 1 2 3 4 5 6 7 8 9 ; do
+ if IsEvent menu key$k3 ; then
+ mykey=${k1}${k2}${k3}
+ break
+ fi
+ done
+ break
+ fi
+ done
+ break
+ fi
+ done
+
+ if [ -n "$mykey" ]; then
+ [ $mykey -gt $n ] && mykey=$n
+ ((mykey=mykey-1)) # we do this, because 0 is the first item
+ [ $mykey -lt 0 ] && mykey=0
+ SendCmd "menu.SetCurrent $mykey" || return $false
+# SendCmd "menu.GetCurrent"
+# [ "${reply3xx[0]}" != 302 ] && return $false
+# PluginSetup "${reply3xx[2]}" || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ fi
+ done
+}
+
+function BackupVdrConf() {
+ [ "$have_xvdr" = "on" ] || return $false
+ xdir=/usr/local/src/x-vdr
+ SendCmd "Message -status 'Backup wird erstellt ...'" || return $false
+ BACKUPDIR="/tmp/vdr-backup"
+ BACKUPPATH="$xdir/backup"
+ [ ! -d $BACKUPPATH ] && mkdir -p $BACKUPPATH
+ [ -d $BACKUPDIR ] && rm -rf $BACKUPDIR
+ mkdir -p $BACKUPDIR
+ cp -pfR --parents $VDRCONFDIR $BACKUPDIR
+ cp -pfR --parents $VDRSCRIPTDIR $BACKUPDIR
+ cp -pf --parents $VDRBINDIR/runvdr $BACKUPDIR
+ cp -pf --parents /etc/default/vdr $BACKUPDIR
+ cp -pf --parents /etc/init.d/vdr $BACKUPDIR
+ BACKUPFILE=$BACKUPPATH/`date +%y%m%d-%H%M`-vdr-conf.tar.gz
+ cd $BACKUPDIR
+ tar -zcf $BACKUPFILE * && SendCmd "Message -seconds 5 'Backup erstellt'" || return $false
+ cd ..
+ rm -rf $BACKUPDIR
+ SendCmd "Message -statusclear" || return $false
+}
+
+function Xvdr() {
+ [ "$have_xvdr" = "on" ] || return $false
+ xdir=/usr/local/src/x-vdr
+ # Menu --------------------------------------------------------------------------------------------------------------->
+ SendCmd "enterlocal" || return $false
+ SendCmd "menu=New Menu 'x-vdr'" || return $false
+ SendCmd "menu.SetColorKeyText -red 'Reboot' -green 'Shutdown' -yellow 'VDR Restart' -blue 'Help'" || return $false
+ SendCmd "menu.SetColumns 1 2" || return $false
+ SendCmd "menu.EnableEvent keyRed keyGreen keyYellow close" || return $false
+ SendCmd "menu.EnableEvent key1 key2 key3 key4 key5 key6 key7 key8 key9 key0" || return $false
+ # List --------------------------------------------------------------------------------------------------------------->
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Plugins ---'" || return $false
+ SendCmd "optP1=menu.AddNew OsdItem '\t1\tAlle Plugins'" || return $false
+ SendCmd "optP1.EnableEvent keyOk keyBlue" || return $false
+ SendCmd "optP2=menu.AddNew OsdItem '\t2\tInstallierte Plugins'" || return $false
+ SendCmd "optP2.EnableEvent keyOk keyBlue" || return $false
+ SendCmd "optP3=menu.AddNew OsdItem '\t3\tInstallierbare Plugins'" || return $false
+ SendCmd "optP3.EnableEvent keyOk keyBlue"
+
+ SendCmd "menu.AddNew OsdItem -unselectable '--- Backup ---'" || return $false
+ SendCmd "optB1=menu.AddNew OsdItem '\t3\tKonfiguration und Skripte'" || return $false
+ SendCmd "optB1.EnableEvent keyOk keyBlue" || return $false
+ # <--------------------------------------------------------------------------------------------------------------- List
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "opt1.SetCurrent" || return $false
+ SendCmd "menu.show" || return $false
+ # <--------------------------------------------------------------------------------------------------------------- Menu
+
+ while true; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk (SubMenu InstallPlugins)
+ if IsEvent optP1 keyOk || IsEvent menu key1 ; then
+ InstallPlugins all || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ if IsEvent optP2 keyOk || IsEvent menu key2 ; then
+ InstallPlugins installed || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ if IsEvent optP3 keyOk || IsEvent menu key2 ; then
+ InstallPlugins standby || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyOk (Backup)
+ if IsEvent optB1 keyOk || IsEvent menu key3 ; then
+ BackupVdrConf || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyRed (Reboot)
+ if IsEvent menu keyRed ; then
+ SendCmd "Message -warn -seconds 10 'System jetzt neustarten?'" || return $false
+ if IsEvent Message keyOk ; then
+ SendCmd "Message 'System wird neugestartet...'" || return $false
+ SendCmd "menu.SendState osEnd" || return $false
+ shutdown -r now
+ fi
+ fi
+ # keyGreen (Shutdown)
+ if IsEvent menu keyGreen ; then
+ SendCmd "Message -warn -seconds 10 'System jetzt ausschalten?'" || return $false
+ if IsEvent Message keyOk ; then
+# SendCmd "Message 'System wird ausgeschaltet...'" || return $false
+ SendCmd "menu.SendState osEnd" || return $false
+# shutdown -h now
+ /usr/bin/svdrpsend.pl HITK Power
+ return $true
+ fi
+ fi
+ # keyYellow (Restart)
+ if IsEvent menu keyYellow ; then
+ SendCmd "Message -warn -seconds 10 'VDR jetzt neustarten?'" || return $false
+ if IsEvent Message keyOk ; then
+ SendCmd "Message 'VDR wird neugestartet...'" || return $false
+ SendCmd "menu.SendState osEnd" || return $false
+ sleep 1
+ killall -9 vdr
+ fi
+ fi
+ # keyBlue (Help)
+ if IsEvent optP1 keyBlue ; then
+ SendCmd "Message -seconds 5 'Zeigt alle verfuegbaren Plugins'" || return $false
+ fi
+ if IsEvent optP2 keyBlue ; then
+ SendCmd "Message -seconds 5 'Zeigt nur die installierten Plugins'" || return $false
+ fi
+ if IsEvent optP3 keyBlue ; then
+ SendCmd "Message -seconds 5 'Zeigt nur die nicht installierten Plugins'" || return $false
+ fi
+ if IsEvent optB1 keyBlue ; then
+ SendCmd "Message -seconds 5 'Erstellt ein Backup von Konfiguration und Skripten'" || return $false
+ fi
+
+ # close the submenu
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ done
+}
+
+
+##### Main Menu #####
+function MainMenu() {
+ # Menu --------------------------------------------------------------------------------------------------------------->
+ SendCmd "menu=New Menu 'vdrsetup'" || return $false
+ SendCmd "menu.SetColorKeyText -red 'Reboot' -green 'Shutdown' -yellow 'VDR Restart' -blue 'Help'" || return $false
+ SendCmd "menu.SetColumns 1 2" || return $false
+ SendCmd "menu.EnableEvent keyRed keyGreen keyYellow keyBlue close" || return $false
+ SendCmd "menu.EnableEvent key1 key2 key3 key4 key5 key6 key7 key8 key9 key0" || return $false
+ # List --------------------------------------------------------------------------------------------------------------->
+ SendCmd "opt1=menu.AddNew OsdItem '\t1\tVDR Einstellungen'" || return $false
+ SendCmd "opt1.EnableEvent keyOk" || return $false
+ SendCmd "opt2=menu.AddNew OsdItem '\t2\tInstallierte Plugins'" || return $false
+ SendCmd "opt2.EnableEvent keyOk" || return $false
+ SendCmd "opt3=menu.AddNew OsdItem '\t3\tPlugin Status Liste'" || return $false
+ SendCmd "opt3.EnableEvent keyOk" || return $false
+ SendCmd "opt4=menu.AddNew OsdItem '\t4\tSystemstart'" || return $false
+ SendCmd "opt4.EnableEvent keyOk" || return $false
+ SendCmd "opt5=menu.AddNew OsdItem '\t5\tWakeup'" || return $false
+ SendCmd "opt5.EnableEvent keyOk" || return $false
+ SendCmd "opt6=menu.AddNew OsdItem '\t6\tSkript Intern'" || return $false
+ SendCmd "opt6.EnableEvent keyOk" || return $false
+ SendCmd "opt7=menu.AddNew OsdItem '\t7\tDVB Modul'" || return $false
+ SendCmd "opt7.EnableEvent keyOk" || return $false
+ if [ "$have_xvdr" = "on" ]; then
+ SendCmd "opt8=menu.AddNew OsdItem '\t8\tX-VDR'" || return $false
+ SendCmd "opt8.EnableEvent keyOk" || return $false
+ fi
+ # <--------------------------------------------------------------------------------------------------------------- List
+ SendCmd "opt1.SetCurrent" || return $false
+ SendCmd "menu.Show" || return $false
+ # <--------------------------------------------------------------------------------------------------------------- Menu
+
+ while true ; do
+ SendCmd "menu.SleepEvent" || return $false
+ # keyOk (SubMenu VdrSetup)
+ if IsEvent opt1 keyOk || IsEvent menu key1 ; then
+ VdrSetup || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyOk (SubMenu ListPlugins)
+ if IsEvent opt2 keyOk || IsEvent menu key2 ; then
+ ListPlugins || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyOk (SubMenu PluginStatusList)
+ if IsEvent opt3 keyOk || IsEvent menu key3 ; then
+ PluginStatusList || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyOk (SubMenu SystemStart)
+ if IsEvent opt4 keyOk || IsEvent menu key4 ; then
+ SystemStart || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyOk (SubMenu Wakeup)
+ if IsEvent opt5 keyOk || IsEvent menu key5 ; then
+ Wakeup || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyOk (SubMenu ScriptSetup)
+ if IsEvent opt6 keyOk || IsEvent menu key6 ; then
+# SendCmd "Message -seconds 5 'Einstellungen gelten nur fuer diese Sitzung'" || return $false
+ ScriptSetup || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyOk (SubMenu DVB)
+ if IsEvent opt7 keyOk || IsEvent menu key7 ; then
+ DVBModul || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ # keyOk (SubMenu Xvdr)
+ if [ "$have_xvdr" = "on" ]; then
+ if IsEvent opt8 keyOk || IsEvent menu key8 ; then
+ Xvdr || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ fi
+ # keyRed (Reboot)
+ if IsEvent menu keyRed ; then
+ SendCmd "Message -warn -seconds 10 'System jetzt neustarten?'" || return $false
+ if IsEvent Message keyOk ; then
+ SendCmd "Message 'System wird neugestartet...'" || return $false
+ SendCmd "menu.SendState osEnd" || return $false
+ shutdown -r now
+ fi
+ fi
+ # keyGreen (Shutdown)
+ if IsEvent menu keyGreen ; then
+ SendCmd "Message -warn -seconds 10 'System jetzt ausschalten?'" || return $false
+ if IsEvent Message keyOk ; then
+# SendCmd "Message 'System wird ausgeschaltet...'" || return $false
+ SendCmd "menu.SendState osEnd" || return $false
+# shutdown -h now
+ /usr/bin/svdrpsend.pl HITK Power
+ return $true
+ fi
+ fi
+ # keyYellow (Restart)
+ if IsEvent menu keyYellow ; then
+ SendCmd "Message -warn -seconds 10 'VDR jetzt neustarten?'" || return $false
+ if IsEvent Message keyOk ; then
+ SendCmd "Message 'VDR wird neugestartet...'" || return $false
+ SendCmd "menu.SendState osEnd" || return $false
+ sleep 1
+ killall -9 vdr
+ fi
+ fi
+ # keyBlue (Help)
+ if IsEvent menu keyBlue ; then
+ SendCmd "Message -seconds 5 'Auswahl mit OK oder Menue verlassen mit Exit'" || return $false
+ fi
+ # close the menu
+ if IsEvent menu close ; then
+ SendCmd "menu.SendState osEnd" || return $false
+ return $true
+ fi
+ done
+}
+
+
+###############
+# Main Code #
+###############
+
+
+ConnectServer localhost 2010
+# Connect to the server process
+
+ReadReply || error
+# Read server welcome
+
+SendCmd "Version 0.1" || error
+# Identify to server with protocol version
+
+MainMenu || error
+# Do vdrsetup
+
+SendCmd Quit
+DoLog "disconnecting from OSDServer"
+# ... and good bye
+
+exec 3>&-
+exec 4>&-
+# close FIFOs
+
diff --git a/vdr/scripts/vdrshutdown b/vdr/scripts/vdrshutdown
new file mode 100644
index 0000000..bda6766
--- /dev/null
+++ b/vdr/scripts/vdrshutdown
@@ -0,0 +1,214 @@
+#!/bin/bash
+
+# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis)
+# von Marc Wernecke - www.zulu-entertainment.de
+# 26.01.2009
+
+# vdrshutdown: shutdown script for x-vdr
+
+# no arguments, no action
+[ $# -gt 0 ] || exit 1
+
+# defaults
+DEBUG=0
+LOGGER="logger -s ${0##*/} "
+WAKEUPTIME=0
+
+# load VDR configuration
+if [ -f /etc/default/vdr ]; then
+ . /etc/default/vdr
+else
+ $LOGGER "exit, because /etc/default/vdr does not exists"
+ exit 1
+fi
+
+# load Shutdown configuration
+if [ -f "$VDRCONFDIR/shutdown.conf" ]; then
+ . "$VDRCONFDIR/shutdown.conf"
+else
+ $LOGGER "exit, because $VDRCONFDIR/shutdown.conf does not exists"
+ exit 1
+fi
+
+# check acpi
+if [ "$WAKEUP_MODE" = "1" ]; then
+ if [ -f /sys/class/rtc/rtc0/wakealarm ]; then
+ ACPI="/sys/class/rtc/rtc0/wakealarm"
+ elif [ -f /proc/acpi/alarm ]; then
+ ACPI="/proc/acpi/alarm"
+ else
+ $LOGGER "acpi-wakeup is not supported by your kernel, exit"
+ echo "$VDRBINDIR/svdrpsend.pl MESG 'acpi-wakeup is not supported by your kernel, exit'"| at now
+ exit 1
+ fi
+fi
+
+# check procs
+while read i; do
+ CMD=$(eval $i 2>/dev/null)
+ if [ $? -eq 0 ] && [ -n "$CMD" ]; then
+ $LOGGER "stop shutdown, because $CMD..."
+ $LOGGER "waiting period $WAITING_PERIOD minutes up to the next shutdown..."
+ echo "$VDRBINDIR/svdrpsend.pl MESG 'Shutdown abgebrochen, weil $CMD'"| at now
+ sleep 1
+ echo "$VDRBINDIR/svdrpsend.pl MESG 'Erneuter Shutdown Versuch in $WAITING_PERIOD Minuten.'"| at now
+ sleep 1
+ echo "$VDRBINDIR/svdrpsend.pl HITK Power"| at now +$WAITING_PERIOD minutes
+ exit 1
+ fi
+done < <(echo "$CHECK_PROCS" | sed '/^[ ]*$/d')
+
+# no wakeup-mode
+if [ "$WAKEUP_MODE" = "0" ]; then
+ echo "$VDRBINDIR/svdrpsend.pl MESG 'Shutdown now!'"| at now
+ sudo $VDRSCRIPTDIR/vdr2root shutdown
+ exit 0
+fi
+
+# extension-board
+if [ "$WAKEUP_MODE" = "3" ]; then
+ echo "$VDRBINDIR/svdrpsend.pl MESG 'Shutdown now!'"| at now
+ sudo $VDRSCRIPTDIR/vdr2root extb-poweroff
+ exit 0
+fi
+
+# check MAX_POWEROFF_TIME for special commands and set the value
+if [ "$MAX_POWEROFF_TIME" = "MAXIMAL" ]; then # calculate the maximal wakeup-time
+ MONTH_NOW=`date +%-m` # if this month has no 31th, set the wakeup to the 31th of the next month
+ if [ $MONTH_NOW==2 ] || [ $MONTH_NOW==4 ] || [ $MONTH_NOW==6 ] || [ $MONTH_NOW==9 ] || [ $MONTH_NOW==11 ]; then
+ YEAR_NOW=`date +%Y`
+ NEXT_WAKEUP=`date -d "$YEAR_NOW-$(($MONTH_NOW+1))-31 23:59:59" +%s`
+ MAX_POWEROFF_TIME=$((($NEXT_WAKEUP-`date +%s`) / 60))
+ else # sleep exactly one month
+ MAX_POWEROFF_TIME=44640
+ fi
+ WAKEUPTIME=$((`date +%s` + $MAX_POWEROFF_TIME * 60))
+elif [ "$MAX_POWEROFF_TIME" = "INTERVAL" ]; then # calculate the next wakeup-time for housekeeping
+ DAY_IN_YEAR=`date +%j`
+ DREAMDAY=0
+ while [ $DREAMDAY -le $DAY_IN_YEAR ]; do
+ DREAMDAY=$(($DREAMDAY + $INTERVAL))
+ done
+ YEAR_NOW=`date +%Y`
+ if [ $DREAMDAY -gt 365 ]; then
+ DREAMDAY=$(($DREAMDAY - 365))
+ YEAR_NOW=$(($YEAR_NOW + 1))
+ fi
+ WAKEUPTIME=$((`date -d "$YEAR_NOW-01-01 $DREAMTIME:00" +%s` + $DREAMDAY * 3600 * 24))
+elif [ -n "$MAX_POWEROFF_TIME" ] && (($MAX_POWEROFF_TIME > 0)); then # calculate, at what time the machine should be powered on
+ WAKEUPTIME=$((`date +%s` + $MAX_POWEROFF_TIME * 60))
+else
+ WAKEUPTIME=$1
+fi
+
+# final test
+if [ $WAKEUPTIME -gt $1 ] && [ $1 -gt 0 ]; then
+ WAKEUPTIME=$1
+fi
+
+# wakeupbefore - minutes before the programmed wakeuptime the computer should wake up
+[ -z "$WAKEUP_BEFORE" ] && WAKEUP_BEFORE=0
+WAKEUPTIME=$(($WAKEUPTIME - $WAKEUP_BEFORE * 60))
+
+# wakeup-time is greater then zero
+if [ $WAKEUPTIME -gt 0 ]; then
+ # calculate the minimal wakeup-time
+ MinEventTimeout=`grep -m1 "MinEventTimeout" $VDRCONFDIR/setup.conf | cut -f 2 -d "=" | sed -e 's/^ //g' -e 's/ $//g'`
+ [ $MinEventTimeout -lt 10 ] && MinEventTimeout=10
+ MIN_WAKEUPTIME=$(($NOW + $MinEventTimeout * 60 + 1))
+ if [ $MIN_WAKEUPTIME -gt $WAKEUPTIME ]; then
+ case "$MIN_WAKEUP_VAR" in
+ 0) VAR=`date -d "1970-01-01 UTC $MIN_WAKEUPTIME seconds" +"%Y-%m-%d %R:%S"`
+ echo "$VDRBINDIR/svdrpsend.pl MESG 'Timer wird auf $VAR gestellt.'"| at now
+ sleep 2
+ ;;
+ 1) WAKEUPTIME=$(($WAKEUPTIME - $MinEventTimeout * 60 + 600))
+ [ $WAKEUPTIME -lt $(($NOW + 600)) ] && WAKEUPTIME=$(($NOW + 600))
+ VAR=`date -d "1970-01-01 UTC $WAKEUPTIME seconds" +"%Y-%m-%d %R:%S"`
+ echo "$VDRBINDIR/svdrpsend.pl MESG 'Timer wird auf $VAR gestellt.'"| at now
+ sleep 2
+ ;;
+ 2) echo "$VDRBINDIR/svdrpsend.pl MESG 'Es werden keine Timer gestellt.'"| at now
+ sleep 2
+ [ "$WAKEUP_MODE" = "1" ] && sudo $VDRSCRIPTDIR/vdr2root poweroff && exit 0
+ sudo $VDRSCRIPTDIR/vdr2root shutdown && exit 0
+ ;;
+ 3) echo "$VDRBINDIR/svdrpsend.pl MESG 'Shutdown abgebrochen.'"| at now
+ sleep 2
+ exit 0
+ ;;
+ esac
+ fi
+
+ # debug
+ if [ "$DEBUG" = "1" ]; then
+ echo `date '+%F %T'` > /tmp/wakeuptime.txt
+ echo "Next Wakeup Time:" >> /tmp/wakeuptime.txt
+ echo "ACPI -> `date -d "1970-01-01 UTC $WAKEUPTIME seconds" +"%Y-%m-%d %R:%S"` > $ACPI" >> /tmp/wakeuptime.txt
+ echo "NVRAM -> $WAKEUPTIME" >> /tmp/wakeuptime.txt
+ fi
+
+ # acpi-wakeup
+ if [ "$WAKEUP_MODE" = "1" ]; then
+ echo "$VDRBINDIR/svdrpsend.pl MESG 'Shutdown now!'"| at now
+ if [ "$ACPI" = "/sys/class/rtc/rtc0/wakealarm" ]; then
+ VAR="$WAKEUPTIME"
+ sudo $VDRSCRIPTDIR/vdr2root acpi-wakeup "0" "$ACPI"
+ else
+ VAR=`date -d "1970-01-01 UTC $WAKEUPTIME seconds" +"%Y-%m-%d %R:%S"`
+ sudo $VDRSCRIPTDIR/vdr2root acpi-wakeup "$VAR" "$ACPI"
+ fi
+ sudo $VDRSCRIPTDIR/vdr2root acpi-wakeup "$VAR" "$ACPI"
+ sleep 1
+ sudo $VDRSCRIPTDIR/vdr2root poweroff
+ exit 0
+ fi
+
+ # nvram-wakeup
+ if [ "$WAKEUP_MODE" = "2" ]; then
+ echo "$VDRBINDIR/svdrpsend.pl MESG 'Shutdown now!'"| at now
+ VAR="-s $WAKEUPTIME $NVRAM_OPT ${NVRAM_CONFIG:+-C $NVRAM_CONFIG} ${NVRAM_IWNAME:+-I $NVRAM_IWNAME}"
+# VAR="-s $WAKEUPTIME $NVRAM_OPT -w 0 ${NVRAM_CONFIG:+-C $NVRAM_CONFIG} ${NVRAM_IWNAME:+-I $NVRAM_IWNAME}"
+# sudo $VDRSCRIPTDIR/vdr2root nvram-wakeup -d
+ sudo $VDRSCRIPTDIR/vdr2root nvram-wakeup "$VAR"
+ sleep 1
+ if [ "$NEED_REBOOT" = "0" ]; then
+ sudo $VDRSCRIPTDIR/vdr2root shutdown
+ else
+ if [ "$LILO" = "1" ]; then
+ sudo $VDRSCRIPTDIR/vdr2root lilo
+ else
+ sudo $VDRSCRIPTDIR/vdr2root grub $GRUB_POWEROFF
+ fi
+ sudo $VDRSCRIPTDIR/vdr2root reboot
+ fi
+ exit 0
+ fi
+
+else # wakeup-time is equal to zero
+ if [ "$WAKEUP_MODE" = "2" ]; then
+ # disable nvram-wakeup
+ sudo $VDRSCRIPTDIR/vdr2root nvram-wakeup -d
+ sleep 1
+ # if wakeup-lan works only with a shutdown via poweroff-kernel
+ if [ "$NEED_REBOOT" = "2" ]; then
+ if [ "$LILO" = "1" ]; then
+ sudo $VDRSCRIPTDIR/vdr2root lilo
+ else
+ sudo $VDRSCRIPTDIR/vdr2root grub $GRUB_POWEROFF
+ fi
+ sudo $VDRSCRIPTDIR/vdr2root reboot
+ exit 0
+ fi
+ fi
+fi
+
+# wakeuptime is equal to zero, shutdown
+echo "$VDRBINDIR/svdrpsend.pl MESG 'Shutdown now!'"| at now
+if [ "$WAKEUP_MODE" = "1" ]; then
+ sudo $VDRSCRIPTDIR/vdr2root poweroff
+else
+ sudo $VDRSCRIPTDIR/vdr2root shutdown
+fi
+
+exit 0
diff --git a/vdr/scripts/vdrwritedvd b/vdr/scripts/vdrwritedvd
new file mode 100644
index 0000000..2c4ad1c
--- /dev/null
+++ b/vdr/scripts/vdrwritedvd
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# vdrwritedvd - x-vdr version
+#
+# This script will be called by the vdr-plugins dvdselect and dvdswitch to write a dvd.
+#
+# It gets the following parameter:
+#
+# $1 = filename
+
+# Load VDR configuration
+. /etc/default/vdr
+
+# vdr2root
+echo "sudo $VDRSCRIPTDIR/vdr2root writedvd \"$1\"" | at now
+
+exit 0
diff --git a/vdr/scripts/x-lcd b/vdr/scripts/x-lcd
new file mode 100644
index 0000000..ef28a7c
--- /dev/null
+++ b/vdr/scripts/x-lcd
@@ -0,0 +1,26 @@
+#! /bin/sh
+# /etc/init.d/x-lcd
+
+# Load VDR configuration
+. /etc/default/vdr
+
+STARTLOGO=$VDRCONFDIR/plugins/graphlcd/splash/start
+STOPLOGO=$VDRCONFDIR/plugins/graphlcd/splash/stop
+
+case "$1" in
+ start)
+ echo "Displaying Startlogo"
+ /usr/bin/showpic -c /etc/graphlcd.conf -d ks0108 -s 200 $(ls $STARTLOGO/*.glcd) &
+ ;;
+ stop)
+ echo "Displaying Shutdownlogo"
+ /usr/bin/showpic -c /etc/graphlcd.conf -d ks0108 -s 200 $(ls $STOPLOGO/*.glcd) &
+ ;;
+ *)
+ echo "Usage: /etc/init.d/x-lcd {start|stop}"
+ exit 1
+ ;;
+esac
+
+exit 0
+