From 9b93d67c55bb90ec0a1f4ea2b4a8cf04f7b1fb47 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 17 Aug 2014 18:06:37 -0500
Subject: LinHES-system: add idle check for Standby mode in idle.py If Standby
 mode is detected the it's assumed the FE is idle.

---
 abs/core/LinHES-system/PKGBUILD |  4 ++--
 abs/core/LinHES-system/idle.py  | 17 +++++++++++++----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 7d57587..04d0d50 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=8.2
-pkgrel=1
+pkgrel=2
 arch=('i686' 'x86_64')
 install=system.install
 pkgdesc="Everything that makes LinHES an automated system"
@@ -119,7 +119,7 @@ md5sums=('a10cb96850951ae835c46f41f92463b2'
          '8b0298f70f97cc1dc2a58b9a73c64bd3'
          '911b0fbc8d9178dac1a193346c9decaf'
          '34fc1f58ad1eabf4eff4979d420760c0'
-         '0c6cab59e09c82e40f6e627c96d5a5f6'
+         '69ecfe682f1b61c2c4c95d890b9f523c'
          'a94fe6d980f4b810f2e2ae5352084b39'
          '384956b4fd9bf40907856bab0e67b169'
          'f4ce577e2ab1b6dbf9def46a8ab86e2d'
diff --git a/abs/core/LinHES-system/idle.py b/abs/core/LinHES-system/idle.py
index 6b813b4..4575e7d 100755
--- a/abs/core/LinHES-system/idle.py
+++ b/abs/core/LinHES-system/idle.py
@@ -48,7 +48,7 @@ def dailywake_check(cmdargs,cursor):
             print "error"
             return True
 
-        # Check for time periods that cross midnight    
+        # Check for time periods that cross midnight
         if (p1End < p1Start):
             if (now > p1End):
                 p1End = p1End + timedelta(days=1)
@@ -188,7 +188,7 @@ def userlogins_check(cmdargs):
         msg(cmdargs,"    Checking for users logged in...")
         users=subprocess.check_output("who")
         names=([x.split() for x in users.splitlines()])
-        for i in names: 
+        for i in names:
             if (i[0] == "mythtv" and i[4] == "(:0)"):
                 msg(cmdargs,"        Ignoring %s %s" %(i[0],i[4]))
             else:
@@ -202,6 +202,9 @@ def userlogins_check(cmdargs):
         return True
 
 def mythfe_check(cmdargs,cursor,mythDB):
+    #checks to see if a frontend is considered idle
+    # True means FE is idle
+
     if ( cmdargs.runningfe ):
         msg(cmdargs,"    Checking for running and playing mythfrontends...")
     else:
@@ -216,11 +219,16 @@ def mythfe_check(cmdargs,cursor,mythDB):
     for i in frontends:
         try:
             msg(cmdargs,"        Checking %s's mythfrontend status..." %i)
-            frontend = mythDB.getFrontend(''.join(i)) 
+            frontend = mythDB.getFrontend(''.join(i))
             if ( cmdargs.runningfe ):
                 msg(cmdargs,"            %s's mythfrontend is RUNNING." %i)
                 return False
-            location = frontend.sendQuery('Location') 
+            location = frontend.sendQuery('Location')
+
+            if location == "standbymode":
+                msg(cmdargs,"            %s's mythfrontend is in StandbyMode." %i)
+                return True
+
             if ( location.startswith('Playback ') ):
                 msg(cmdargs,"            %s's mythfrontend is PLAYING." %i)
                 return False
@@ -229,6 +237,7 @@ def mythfe_check(cmdargs,cursor,mythDB):
             if '.xml' in location or 'mainmenu' in location:
                 msg(cmdargs,"            %s's mythfrontend is in MENUS." %i)
             else:
+                #FE is not in menus, so it must be active in a plugin
                 msg(cmdargs,"            %s's mythfrontend is NOT in menus." %i)
                 return False
         except:
-- 
cgit v0.12

