[mythtv-users] command-line to control frontend

Phil Bridges gravityhammer at gmail.com
Sun Dec 9 00:50:55 UTC 2012


On Sat, Dec 8, 2012 at 7:18 PM, Josu Lazkano <josu.lazkano at gmail.com> wrote:

> 2012/12/9 Michael Watson <michael at thewatsonfamily.id.au>:
> > #!/usr/bin/env python
> > # -*- coding: UTF-8 -*-
> > #
> >
> > import socket, time
> > from MythTV import MythDB
> >
> >
> > def shutdown_frontend(hostname):
> >     db = MythDB()
> >     frontend = db.getFrontend(hostname)
> >     location = frontend.sendQuery('Location')
> >
> >    # If we are currently in playback, set bookmark before exiting
> >     if str.split(location)[0] == "Playback":
> >         frontend.key['enter']
> >         frontend.jump['mainmenu']
> >         location = frontend.sendQuery('Location')
> >
> >     if location != "mainmenu":
> >         frontend.jump['mainmenu']
> >
> >     # Shutdown Frontend
> >     frontend.key['escape']
> >     frontend.key['down']
> >     frontend.key['enter']
> >     time.sleep(5)
> >
> >
> > if __name__ == '__main__':
> >     frontendhostname = socket.gethostname()
> >     shutdown_frontend(frontendhostname)
>
> Thanks Michael, I try it but this is the output:
>
> $ python shutdown.py
> Traceback (most recent call last):
>   File "shutdown.py", line 32, in <module>
>     shutdown_frontend(frontendhostname)
>   File "shutdown.py", line 11, in shutdown_frontend
>     frontend = db.getFrontend(hostname)
>   File "/usr/lib/python2.7/dist-packages/MythTV/methodheap.py", line
> 975, in getFrontend
>     return Frontend(host,port)
>   File "/usr/lib/python2.7/dist-packages/MythTV/methodheap.py", line
> 578, in __init__
>     FEConnection.__init__(self, *args, **kwargs)
>   File "/usr/lib/python2.7/dist-packages/MythTV/connections.py", line
> 462, in __init__
>     self.connect(test)
>   File "/usr/lib/python2.7/dist-packages/MythTV/connections.py", line
> 508, in connect
>     raise MythFEError(MythError.FE_CONNECTION, self.host, self.port)
> MythTV.exceptions.MythFEError: Connection to frontend htpc:6546 failed
>
> Need I to configure something? I am not familiar with python.
>
> Thanks for your help.
>
>
Have you activated the frontend network control socket?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20121208/5a81a180/attachment.html>


More information about the mythtv-users mailing list