Ejemplo n.º 1
0
    def Admin(self, handler, query):
        #Read config file new each time in case there was any outside edits
        config = ConfigParser.ConfigParser()
        config.read(config_file_path)

        shares_data = []
        for section in config.sections():
            if not(section.startswith('_tivo_') or section.startswith('Server')):
                if not(config.has_option(section,'type')):
                    shares_data.append((section, dict(config.items(section, raw=True))))
                elif config.get(section,'type').lower() != 'admin':
                    shares_data.append((section, dict(config.items(section, raw=True))))
        
        subcname = query['Container'][0]
        cname = subcname.split('/')[0]
        handler.send_response(200)
        handler.end_headers()
        t = Template(file=os.path.join(SCRIPTDIR,'templates', 'settings.tmpl'))
        t.container = cname
        t.server_data = dict(config.items('Server', raw=True))
        t.server_known = buildhelp.getknown('server')
        t.shares_data = shares_data
        t.shares_known = buildhelp.getknown('shares')
        t.tivos_data = [ (section, dict(config.items(section, raw=True))) for section in config.sections() \
                         if section.startswith('_tivo_')]
        t.tivos_known = buildhelp.getknown('tivos')
        t.help_list = buildhelp.gethelp()
        handler.wfile.write(t)
Ejemplo n.º 2
0
    def Settings(self, handler, query):
        # Read config file new each time in case there was any outside edits
        config.reset()

        shares_data = []
        for section in config.config.sections():
            if not section.startswith(('_tivo_', 'Server')):
                if (not (config.config.has_option(section, 'type')) or
                    config.config.get(section, 'type').lower() not in
                    ['settings', 'togo']):
                    shares_data.append((section,
                                        dict(config.config.items(section,
                                                                 raw=True))))

        t = Template(SETTINGS_TEMPLATE, filter=EncodeUnicode)
        t.mode = buildhelp.mode
        t.options = buildhelp.options
        t.container = handler.cname
        t.quote = quote
        t.server_data = dict(config.config.items('Server', raw=True))
        t.server_known = buildhelp.getknown('server')
        t.hd_tivos_data = dict(config.config.items('_tivo_HD', raw=True))
        t.hd_tivos_known = buildhelp.getknown('hd_tivos')
        t.sd_tivos_data = dict(config.config.items('_tivo_SD', raw=True))
        t.sd_tivos_known = buildhelp.getknown('sd_tivos')
        t.shares_data = shares_data
        t.shares_known = buildhelp.getknown('shares')
        t.tivos_data = [(section, dict(config.config.items(section, raw=True)))
                        for section in config.config.sections()
                        if section.startswith('_tivo_')
                        and not section.startswith(('_tivo_SD', '_tivo_HD'))]
        t.tivos_known = buildhelp.getknown('tivos')
        t.help_list = buildhelp.gethelp()
        t.has_shutdown = hasattr(handler.server, 'shutdown')
        handler.send_html(str(t))
Ejemplo n.º 3
0
    def Admin(self, handler, query):
        #Read config file new each time in case there was any outside edits
        config = ConfigParser.ConfigParser()
        config.read(config_file_path)

        shares_data = []
        for section in config.sections():
            if not (section.startswith('_tivo_')
                    or section.startswith('Server')):
                if not (config.has_option(section, 'type')):
                    shares_data.append(
                        (section, dict(config.items(section, raw=True))))
                elif config.get(section, 'type').lower() != 'admin':
                    shares_data.append(
                        (section, dict(config.items(section, raw=True))))

        subcname = query['Container'][0]
        cname = subcname.split('/')[0]
        handler.send_response(200)
        handler.end_headers()
        t = Template(
            file=os.path.join(SCRIPTDIR, 'templates', 'settings.tmpl'))
        t.container = cname
        t.server_data = dict(config.items('Server', raw=True))
        t.server_known = buildhelp.getknown('server')
        t.shares_data = shares_data
        t.shares_known = buildhelp.getknown('shares')
        t.tivos_data = [ (section, dict(config.items(section, raw=True))) for section in config.sections() \
                         if section.startswith('_tivo_')]
        t.tivos_known = buildhelp.getknown('tivos')
        t.help_list = buildhelp.gethelp()
        handler.wfile.write(t)
Ejemplo n.º 4
0
    def Settings(self, handler, query):
        # Read config file new each time in case there was any outside edits
        config.reset()

        shares_data = []
        for section in config.config.sections():
            if not (section.startswith('_tivo_')
                    or section.startswith('Server')):
                if (not (config.config.has_option(section, 'type')) or
                    config.config.get(section, 'type').lower() not in
                    ['settings', 'togo']):
                    shares_data.append((section,
                                        dict(config.config.items(section,
                                                                 raw=True))))

        cname = query['Container'][0].split('/')[0]
        t = Template(SETTINGS_TEMPLATE, filter=EncodeUnicode)
        t.container = cname
        t.quote = quote
        t.server_data = dict(config.config.items('Server', raw=True))
        t.server_known = buildhelp.getknown('server')
        if config.config.has_section('_tivo_HD'):
            t.hd_tivos_data = dict(config.config.items('_tivo_HD', raw=True))
        else:
            t.hd_tivos_data = {}
        t.hd_tivos_known = buildhelp.getknown('hd_tivos')
        if config.config.has_section('_tivo_SD'):
            t.sd_tivos_data = dict(config.config.items('_tivo_SD', raw=True))
        else:
            t.sd_tivos_data = {}
        t.sd_tivos_known = buildhelp.getknown('sd_tivos')
        t.shares_data = shares_data
        t.shares_known = buildhelp.getknown('shares')
        t.tivos_data = [(section, dict(config.config.items(section, raw=True)))
                        for section in config.config.sections()
                        if section.startswith('_tivo_')
                        and not section.startswith('_tivo_SD')
                        and not section.startswith('_tivo_HD')]
        t.tivos_known = buildhelp.getknown('tivos')
        t.help_list = buildhelp.gethelp()
        t.has_shutdown = hasattr(handler.server, 'shutdown')
        handler.send_response(200)
        handler.send_header('Content-Type', 'text/html; charset=utf-8')
        handler.send_header('Expires', '0')
        handler.end_headers()
        handler.wfile.write(t)