[mythtv-users] Myth and Python

Her Him dvrhax at yahoo.com
Fri Nov 19 02:51:16 UTC 2010


Anyone with experience using either python and the Myth bindings or mysql 
directly with the myth database?  I wrote the below script to toggle back and 
forth between 5.1 audio and stereo audio so that I didn't have to go through 
setup every time I wanted to use my surround system.  However while it does work 
to toggle between 5.1 and stereo it doesn't take effect until after I go back 
through 'General' setup and click all the way through finish.  So for some 
reason even though the audio is set properly it doesn't honor that its changed 
until going back through the menu.

Any ideas would be appreciated.

Thanks

#!/usr/bin/python

import MythTV

from socket import gethostname
hostname = gethostname()

#Alternate May be necessary on windows
#import platform
#hostname=platform.node()
mythtv=MythTV.MythTV()

print 'Host: %s Max Channels: 
%s'%(hostname,mythtv.db.settings[hostname]['MaxChannels'])

if mythtv.db.settings[hostname]['MaxChannels']==u'2':
    mythtv.db.settings[hostname]['MaxChannels']=u'6'
elif mythtv.db.settings[hostname]['MaxChannels']==u'6':
    mythtv.db.settings[hostname]['MaxChannels']=u'2'

print 'Host: %s Max Channels: 
%s'%(hostname,mythtv.db.settings[hostname]['MaxChannels'])


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20101118/2cd65910/attachment.htm>


More information about the mythtv-users mailing list