From 24f840f1ac56c1f78272d4b0de50844cb876aa1b Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Wed, 3 Jan 2018 21:50:55 +0000
Subject: LinHES-system: idle.py: fix wrong status on standby

mythwelcome-config.py: add settings so mythbackend will alsow work to shutdown and use the mythfrontend idle screen
---
 abs/core/LinHES-system/PKGBUILD                 | 10 +++++-----
 abs/core/LinHES-system/idle.py                  |  8 ++++----
 abs/core/LinHES-system/mythwelcome-config.py    | 15 ++++++++-------
 abs/core/LinHES-system/mythwelcome-set-alarm.sh | 10 +++++-----
 4 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 3ff5184..5d4252b 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
-pkgver=8.5
-pkgrel=2
+pkgver=8.5.1
+pkgrel=1
 arch=('i686' 'x86_64')
 install=system.install
 pkgdesc="Everything that makes LinHES an automated system"
@@ -128,15 +128,15 @@ md5sums=('c6e6b83a1f4c35ef4501e277657ab2ac'
          '8b0298f70f97cc1dc2a58b9a73c64bd3'
          'd2f1bec810a740885d9c0a2893186587'
          'e30bf8ec8b9dcc2ceb7127375a91d8d1'
-         'e9f545c3bcf9c85b45496c281fc6a1b8'
+         'a8bbc553cd784ebed2197b96b60addc8'
          'a94fe6d980f4b810f2e2ae5352084b39'
          '0d1632ea63d8145c173c6aecf0b007f0'
          'ff689f2e9572a78d88384b2e5774f579'
          '28f29578e5b3ba84fdf2aa57cf475bcf'
          '4a1fda884dcd7d65fb2690fbdbd92a83'
          '29f451783db3220b612e00c29e3ded73'
-         'de3028ed75b53bd2f85ffbfdf64c44c2'
-         '95c092f67036a361ef7a57436f44332e'
+         '0b80d8e364652b144324f7c3e0f04ecb'
+         '3b27dd20cc35dce9bdad017087c9cf15'
          '410795ef9039e4c6c0484e706ecfd567'
          'eb879fee9603a05d5420d4ce8ed9e450'
          '02c810c2f47b7c4495fdacaf54189473'
diff --git a/abs/core/LinHES-system/idle.py b/abs/core/LinHES-system/idle.py
index 05dedac..2c1a749 100755
--- a/abs/core/LinHES-system/idle.py
+++ b/abs/core/LinHES-system/idle.py
@@ -226,8 +226,7 @@ def mythfe_check(cmdargs,cursor,mythDB):
     else:
         msg(cmdargs,"    Checking for playing mythfrontends...")
     try:
-        #frontends = mythDB.getFrontends() #use cursor instead so it doesn't test connection
-        cursor.execute("select hostname from settings where value = 'FrontendIdleTimeout'")
+        cursor.execute("select distinct hostname from settings where hostname is not null;")
         frontends=cursor.fetchall()
     except:
         return True
@@ -242,14 +241,15 @@ def mythfe_check(cmdargs,cursor,mythDB):
             location = frontend.sendQuery('Location')
 
             if location == "standbymode":
-                msg(cmdargs,"            %s's mythfrontend is in StandbyMode." %i)
-                return True
+                msg(cmdargs,"            %s's mythfrontend is in Standby Mode." %i)
+                continue
 
             if ( location.startswith('Playback ') ):
                 msg(cmdargs,"            %s's mythfrontend is PLAYING." %i)
                 return False
             else:
                 msg(cmdargs,"            %s's mythfrontend is NOT playing." %i)
+
             if '.xml' in location or 'mainmenu' in location:
                 msg(cmdargs,"            %s's mythfrontend is in MENUS." %i)
             else:
diff --git a/abs/core/LinHES-system/mythwelcome-config.py b/abs/core/LinHES-system/mythwelcome-config.py
index 204a6e9..5a8727f 100755
--- a/abs/core/LinHES-system/mythwelcome-config.py
+++ b/abs/core/LinHES-system/mythwelcome-config.py
@@ -1,6 +1,7 @@
 #!/usr/bin/env python2
 
-# This script will configure the myth db to allow MythWelcome to wake and shutdown the system.
+# This script will configure the myth db to allow MythWelcome
+# or mythbackend to wake and shutdown the system.
 
 from socket import gethostname
 from MythTV import MythDB
@@ -11,8 +12,8 @@ localhostname = gethostname()
 mythdb.settings[localhostname].MythShutdownNvramCmd = u'sudo sh -c \"/usr/LH/bin/mythwelcome-set-alarm.sh $time\"'
 mythdb.settings[localhostname].MythShutdownWakeupTimeFmt = u'time_t'
 mythdb.settings[localhostname].MythShutdownNvramRestartCmd = u''
-mythdb.settings[localhostname].MythShutdownReboot = u'sudo /sbin/reboot'
-mythdb.settings[localhostname].MythShutdownPowerOff = u'sudo /sbin/poweroff'
+mythdb.settings[localhostname].MythShutdownReboot = u'sudo /usr/bin/reboot'
+mythdb.settings[localhostname].MythShutdownPowerOff = u'sudo /usr/bin/poweroff'
 mythdb.settings[localhostname].MythShutdownXTermCmd = u'xterm'
 mythdb.settings[localhostname].MythWelcomeStartFECmd = u'/usr/LH/bin/mythfrontend-start'
 
@@ -24,7 +25,7 @@ if mythdb.settings[localhostname].HostSystemType == u'Master_backend':
     else:
         mythdb.settings.NULL.idleTimeoutSecs = u'0'
 
-mythdb.settings.NULL.WakeupTimeFormat = u'yyyy-MM-ddThh:mm:ss'
-mythdb.settings.NULL.SetWakeuptimeCommand = u'/usr/bin/mythshutdown --setwakeup $time'
-mythdb.settings.NULL.ServerHaltCommand = u'/usr/bin/mythshutdown --shutdown'
-mythdb.settings.NULL.preSDWUCheckCommand = u'/usr/LH/bin/idle.py -s -d -l -r'
+mythdb.settings.NULL.WakeupTimeFormat = u'time_t'
+mythdb.settings.NULL.SetWakeuptimeCommand = u'sudo /usr/LH/bin/mythwelcome-set-alarm.sh $time'
+mythdb.settings.NULL.ServerHaltCommand = u'sudo /usr/bin/poweroff'
+mythdb.settings.NULL.preSDWUCheckCommand = u'/usr/LH/bin/idle.py -s -d -l'
diff --git a/abs/core/LinHES-system/mythwelcome-set-alarm.sh b/abs/core/LinHES-system/mythwelcome-set-alarm.sh
index 990adf7..09ad062 100755
--- a/abs/core/LinHES-system/mythwelcome-set-alarm.sh
+++ b/abs/core/LinHES-system/mythwelcome-set-alarm.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #$1 is the first argument to the script. It is the time in seconds since 1970
-#This is defined in mythwelcome with the time_t argument
+#This is defined in mythwelcome and mythbackend with the time_t argument.
 
 # Configure mythwelcome --setup page:
 # Command to Set Wakeup Time:     sudo sh -c "/usr/LH/bin/mythwelcome-set-alarm.sh $time"
@@ -13,10 +13,10 @@
 
 # Configure mythtv-setup Shutdown/Wakeup Options page:
 # Idletimeout (secs):             any value greater that 0
-# Wakeup time format:             yyyy-MM-ddThh:mm:ss
-# Set wakeup time command:        /usr/bin/mythshutdown --setwakeup $time
-# Server Halt command:            /usr/bin/mythshutdown --shutdown
-# Pre shutdown check command:     /usr/bin/mythshutdown --check 
+# Wakeup time format:             time_t
+# Set wakeup time command:        sudo /usr/LH/bin/mythwelcome-set-alarm.sh $time
+# Server Halt command:            sudo /usr/bin/poweroff
+# Pre shutdown check command:     /usr/bin/mythshutdown --check
 
 echo 0 > /sys/class/rtc/rtc0/wakealarm      #this clears your alarm
 echo $1 > /sys/class/rtc/rtc0/wakealarm     #this writes your alarm
-- 
cgit v0.12