gmyth-stream/server/0.3/lib/gmsconfig.py
branchtrunk
changeset 815 7f290a3a34b1
child 823 8b729aff6f81
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gmyth-stream/server/0.3/lib/gmsconfig.py	Tue Aug 21 16:04:44 2007 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +#!/usr/bin/env
     1.5 +
     1.6 +__author__ = "Renato Araujo Oliveira Filho"
     1.7 +__author_email__ = "renato.filho@indt.org.br"
     1.8 +__license__ = "GPL"
     1.9 +__version__ = "0.3"
    1.10 +
    1.11 +
    1.12 +import os
    1.13 +import ConfigParser
    1.14 +
    1.15 +__all__ = ("GmsConfig")
    1.16 +
    1.17 +class GmsConfig:
    1.18 +    config = ConfigParser.ConfigParser()
    1.19 +    __CONFIG_FILE__ = "server.conf"
    1.20 +
    1.21 +    def __init__(self):
    1.22 +        file_name = os.path.join (os.path.expanduser("~"), ".gms", self.__CONFIG_FILE__)
    1.23 +        print "test config file: %s" % file_name
    1.24 +        if os.path.exists (file_name):
    1.25 +            fp = open (file_name, "r")
    1.26 +            self.config.readfp (fp)
    1.27 +            return
    1.28 +
    1.29 +        file_name = os.path.join ("/", "etc", "gms", self.__CONFIG_FILE__)
    1.30 +        print "test config file: %s" % file_name
    1.31 +        if os.path.exists (file_name):
    1.32 +            fp = open (file_name, "r")
    1.33 +            self.config.readfp (fp)
    1.34 +            return
    1.35 +    # __init__()
    1.36 +
    1.37 +    def get_transcoded_location (self):
    1.38 +        try:
    1.39 +            return self.config.get("PATHS", "transcoded")
    1.40 +        except:
    1.41 +            return None
    1.42 +    # get_transcoded_location()
    1.43 +
    1.44 +
    1.45 +# GmsConfig