[mythtv-users] command-line to control frontend

Michael Watson michael at thewatsonfamily.id.au
Sat Dec 8 23:44:20 UTC 2012


Here is a python script that does that.

#!/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)



On 9/12/2012 10:03 AM, Josu Lazkano wrote:
> Hello all,
>
> I want to make some bash scripts top control mythfrontend.
>
> I try with this:
>
> /bin/echo "Four" >/dev/tcp/localhost/6546
>
> But it does not work.
>
> I want to execute a command to go to main menu before hibernate the box.
>
> Thanks and best regards.
>
> --
> Josu Lazkano
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-users
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2013.0.2793 / Virus Database: 2629/5916 - Release Date: 11/24/12
> Internal Virus Database is out of date.



More information about the mythtv-users mailing list