[mythtv-users] Mythbuntu 12.04 and sleep

Michael Watson michael at thewatsonfamily.id.au
Fri Sep 14 22:33:07 UTC 2012

On 15/09/2012 5:15 AM, Tom Bongiorno wrote:
> On Fri, Sep 14, 2012 at 10:41 AM, David Edwards <david at more.fool.me.uk 
> <mailto:david at more.fool.me.uk>> wrote:
>     On 14 September 2012 08:23, Joseph Fry <joe at thefrys.com
>     <mailto:joe at thefrys.com>> wrote:
>     > I'll admit, I've only been suspending for a couple of days, and
>     only testing
>     > it in my office.   If I start to see issues, I guess I'll need
>     to kill the
>     > frontend.  Thanks for the heads up.
>     This is my experience too; if mythfrontend is running when the
>     computer suspends, all sorts of things can go wrong when it resumes.
>     I have the power button on my remote set to run a script that kills
>     mythfrontend (I'm thinking of changing that to shut it down gracefully
>     using the python bindings), suspends, and then starts mythfrontend
>     again. I considered doing it all in /etc/pm/sleep.d, but it's easier
>     from a simple script because it's running as the correct user.
>     David
>     _______________________________________________
>     mythtv-users mailing list
>     mythtv-users at mythtv.org <mailto:mythtv-users at mythtv.org>
>     http://www.mythtv.org/mailman/listinfo/mythtv-users
> I have long wanted a way to gracefully kill a frontend.  Please share 
> if you find a way.
#!/usr/bin/env python

import socket, sys
from MythTV import MythDB, Frontend

# Set the following to the key sequence to exit frontend from the Main Menu
exitcommand = "escape down enter"

hostname = socket.gethostname()

     db = MythDB()
     print "Could Not Connect to Myth Database"

     frontend = db.getFrontend(hostname)
     print "Could Not Connect to Frontend: %s" % hostname

location = frontend.sendQuery('Location')

# Jump to Main Menu
if location != "mainmenu":

# Send Exit Key Sequence
for key in str.split(exitcommand):
     frontend.key['%s' % key]

More information about the mythtv-users mailing list