gmyth-stream/server/lib/gmsconfig.py
branchtrunk
changeset 832 daa61fffb811
parent 824 e711a64ba03d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gmyth-stream/server/lib/gmsconfig.py	Wed Aug 29 14:42:10 2007 +0100
     1.3 @@ -0,0 +1,38 @@
     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 +    __CONFIG_DIRS__ =  [os.path.join (os.path.expanduser("~"), ".gms"), \
    1.21 +                       os.path.join ("/", "etc", "gms"), \
    1.22 +		       "."]
    1.23 +
    1.24 +    def __init__(self):
    1.25 +        for path in self.__CONFIG_DIRS__:
    1.26 +            file_name = os.path.join (path, self.__CONFIG_FILE__)
    1.27 +            if os.path.exists (file_name):
    1.28 +                fp = open (file_name, "r")
    1.29 +                self.config.readfp (fp)
    1.30 +                return
    1.31 +    # __init__()
    1.32 +
    1.33 +    def get_transcoded_location (self):
    1.34 +        try:
    1.35 +            return os.path.realpath (self.config.get("PATHS", "transcoded"))
    1.36 +        except:
    1.37 +            return None
    1.38 +    # get_transcoded_location()
    1.39 +
    1.40 +
    1.41 +# GmsConfig