Update of /cvsroot/freevo/freevo/WIP/RobShortt
In directory sc8-pr-cvs1:/tmp/cvs-serv28452

Added Files:
        conftest.py 
Log Message:
Anyone interested in building a configurator app look at this.  I will do more and 
explain leter tonight.  twisted.persisted is powerfull.


--- NEW FILE: conftest.py ---
import os

import twisted.persisted.aot as aot
import setup_freevo

DEBUG = 0

class MyConfObject:

    def __init__(self, filename):
        cfgfilepath = [ '.', os.path.expanduser('~/.freevo'), '/etc/freevo' ]

        CONF = setup_freevo.Struct()
        CONF.geometry = '800x600'
        CONF.width, CONF.height = 800, 600
        CONF.display = 'x11'
        CONF.tv = 'ntsc'
        CONF.chanlist = 'us-cable'
        CONF.version = 0

        SHARE_DIR = os.environ['FREEVO_SHARE']
        CONTRIB_DIR = os.environ['FREEVO_CONTRIB']
        SKIN_DIR  = os.path.join(SHARE_DIR, 'skins')
        ICON_DIR  = os.path.join(SHARE_DIR, 'icons')
        IMAGE_DIR = os.path.join(SHARE_DIR, 'images')
        FONT_DIR  = os.path.join(SHARE_DIR, 'fonts')

        RUNAPP = os.environ['RUNAPP']


        for dirname in cfgfilepath:
            freevoconf = dirname + '/freevo.conf'
            if os.path.isfile(freevoconf):
                if DEBUG:
                    print 'Loading configure settings: %s' % freevoconf
        
                c = open(freevoconf)
                for line in c.readlines():
                    vals = line.strip().split()
                    if DEBUG: print 'Cfg file data: "%s"' % line.strip()
                    try:
                        name, val = vals[0], vals[2]
                    except:
                        print 'Error parsing config file data "%s"' % line.strip()
                        continue
                    CONF.__dict__[name] = val
        
                c.close()
                w, h = CONF.geometry.split('x')
                CONF.width, CONF.height = int(w), int(h)
                break
        else:
            error('Error', 'freevo.conf not found', 'Freevo needs a basic 
configuration to guess ',
                  'the best settings for your system. Please run \'freevo setup\' 
first')
            sys.exit(1)

        execfile(filename, globals(), locals())


# import config

# execfile('/opt/freevo/freevo_config.py', globals(), locals())

theobj = MyConfObject('/opt/freevo/freevo_config.py')
theobj.RECORD_SERVER_PORT = 18002

aot.jellyToSource(aot.jellyToAOT(theobj), open('/tmp/cfgdump', 'w'))






-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to