#!/usr/bin/env

__author__ = "Renato Araujo Oliveira Filho"
__author_email__ = "renato.filho@indt.org.br"
__license__ = "GPL"
__version__ = "0.3"


import os
import ConfigParser

__all__ = ("GmsConfig")

class GmsConfig:
    config = ConfigParser.ConfigParser()
    __CONFIG_FILE__ = "server.conf"
    __CONFIG_DIRS__ =  [os.path.join (os.path.expanduser("~"), ".gms"), \
                       os.path.join ("/", "etc", "gms"), \
		       "."]

    def __init__(self):
        for path in self.__CONFIG_DIRS__:
            file_name = os.path.join (path, self.__CONFIG_FILE__)
            if os.path.exists (file_name):
                fp = open (file_name, "r")
                self.config.readfp (fp)
                return
    # __init__()

    def get_transcoded_location (self):
        try:
            return os.path.realpath (self.config.get("PATHS", "transcoded"))
        except:
            return None
    # get_transcoded_location()


# GmsConfig
