From f41e563ed54a49afafbac7d505cf9bd7198512ef Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Fri, 3 Apr 2009 14:13:40 -0500
Subject: LinHES-config: Add support for the hearbeat command with mplayer.
 /etc/mplayer/mplayer.conf REF FS#269

---
 abs/core-testing/LinHES-config/PKGBUILD        |  2 +-
 abs/core-testing/LinHES-config/systemconfig.sh | 36 ++++++++++++++++++++------
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 7d9156e..3599ca8 100644
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=1.0
-pkgrel=366
+pkgrel=369
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
 pkgdesc="Install and configure your system"
 depends=(bc libstatgrab  mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates )
diff --git a/abs/core-testing/LinHES-config/systemconfig.sh b/abs/core-testing/LinHES-config/systemconfig.sh
index 5b7d65e..695be64 100755
--- a/abs/core-testing/LinHES-config/systemconfig.sh
+++ b/abs/core-testing/LinHES-config/systemconfig.sh
@@ -996,6 +996,31 @@ function setup_web_auth {
 }
 
 
+function mplayer_saver_check () {
+    if [ ! -f $BASE/etc/mplayer/mplayer.conf ]
+    then
+        mkdir -p $BASE/etc/mplayer
+        touch $BASE/etc/mplayer/mplayer.conf
+        #cp -f $TEMPLATES/mplayer.conf.template $BASE/etc/mplayer/mplayer.conf
+    fi
+    grep -q stop-xscreensaver  $BASE/etc/mplayer/mplayer.conf
+    if [ $? = 0 ]
+    then
+        sed -i "s/^.*stop-xscreensaver.*$/stop-xscreensaver = 1 / g" $BASE/etc/mplayer/mplayer.conf
+    else
+        echo  stop-xscreensaver = 1 >> $BASE/etc/mplayer/mplayer.conf
+    fi
+    grep -q heartbeat-cmd  $BASE/etc/mplayer/mplayer.conf
+    if [ $? = 0 ]
+    then
+       sed -i '/^.*heartbeat-cmd.*$/d' $BASE/etc/mplayer/mplayer.conf
+       #sed -i "s/^.*heartbeat-cmd.*$/heartbeat-cmd=\"$1\"/ g" $BASE/etc/mplayer/mplayer.conf
+    fi
+    echo  "heartbeat-cmd = \"$1\"" >> $BASE/etc/mplayer/mplayer.conf
+}
+
+
+
 function killxscreensaver {
     xscreensaver-command --exit &
     killall xscreensaver &
@@ -1020,7 +1045,7 @@ case x$Screensavertype in
                     cp -f $TEMPLATES/xscreensaver.template $MYTHHOME/.xscreensaver
                 fi
                 #change the idle
-                    sed -ie "s/^timeout.*$/timeout:    0:$Screensaveridle:00/g" $MYTHHOME/.xscreensaver
+                    sed -i "s/^timeout.*$/timeout:    0:$Screensaveridle:00/g" $MYTHHOME/.xscreensaver
 
                 #set the mode
                     case x$Screensavertheme in
@@ -1039,12 +1064,7 @@ case x$Screensavertype in
 
                     ;;
                  esac
-
-
-
-
-
-
+                mplayer_saver_check "/usr/bin/xscreensaver-command -deactivate &"
                 ;;
     xgscreensaver)
                 gconftool-2 --direct   --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory  --type bool   --set /apps/gnome-screensaver/lock_enabled false
@@ -1064,7 +1084,7 @@ case x$Screensavertype in
                      gconftool-2  --direct  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --set --type list --list-type=string /apps/gnome-screensaver/themes [screensavers-$Screensavertheme]
                      ;;
                  esac
-
+                mplayer_saver_check "/usr/bin/gnome-screensaver-command -p &"
                 killxscreensaver
                 ;;
     xnone)       killgscreensaver
-- 
cgit v0.12