Skip to content

Commit

Permalink
Ok, less is more.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluecube committed Dec 1, 2012
1 parent b1515a7 commit 05f7e8a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions inhibit_shutdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import xbmc
import subprocess
import functools

# Set of (protocol, local port) tuples.
watched = {
Expand All @@ -12,7 +11,8 @@
}
sleep_time = 60 * 1000 # sleep time between checks in miliseconds

log = functools.partial(print, "service.inhibit_shutdown:")
def log(msg):
print("service.inhibit_shutdown: " + msg)

def check_services():
""" Check if any of the watched services is running. """
Expand All @@ -34,9 +34,7 @@ def check_services():

while not xbmc.abortRequested:
if check_services():
log("Inhibiting idle shutdown")
xbmc.executebuiltin('InhibitIdleShutdown(true)')
else:
log("Allowing idle shutdown")
xbmc.executebuiltin('InhibitIdleShutdown(false)')
xbmc.sleep(sleep_time)

0 comments on commit 05f7e8a

Please sign in to comment.