From feebef9b0f45af2e8f35c1370de37b0993fd7279 Mon Sep 17 00:00:00 2001 From: KRKeegan <-NOSPAM-kevin@krkeegan.com> Date: Sat, 1 Mar 2008 14:43:30 -0800 Subject: [PATCH] Clean up admin.py. Add settings to known. Fix auto-subshare help --- plugins/admin/admin.py | 73 +---------------------------------- plugins/admin/templates/settings.tmpl | 2 +- 2 files changed, 3 insertions(+), 72 deletions(-) diff --git a/plugins/admin/admin.py b/plugins/admin/admin.py index 3100c5b..338edb4 100644 --- a/plugins/admin/admin.py +++ b/plugins/admin/admin.py @@ -55,83 +55,14 @@ class Admin(Plugin): t.server_data = dict(config.items('Server', raw=True)) t.server_known = ["port", "guid", "ffmpeg", "beacon", "hack83", "debug", \ "optres", "audio_br", "video_br", "max_video_br", "width",\ - "height", "ffmpeg_prams", "bufsize"] + "height", "ffmpeg_prams", "bufsize", "precache"] t.shares_data = shares_data t.shares_known = ["type", "path", "auto_subshares"] t.tivos_data = [ (section, dict(config.items(section, raw=True))) for section in config.sections() \ if section.startswith('_tivo_')] - t.tivos_known = ["aspect169", "audio_br", "video_br", "width", "height", "ffmpeg_prams"] + t.tivos_known = ["aspect169", "audio_br", "video_br", "width", "height", "ffmpeg_prams", "shares"] handler.wfile.write(t) - def QueryContainer(self, handler, query): - #Read config file new each time in case there was any outside edits - config = ConfigParser.ConfigParser() - config.read(config_file_path) - - def build_inputs(settings, data, section): - output = '' - for key in settings: - try: - output += "" + key + ": " - del data[key] - except: - output += "" + key + ": " - #print remaining miscellaneous settings - if len(data) > 0: - output += 'User Defined Settings' - for item in data: - output += "" + item + ": " - output += 'Add a User Defined Setting to this Share' - output += "" - return output - - server_data = dict(config.items('Server')) - server = '' - #build an array with configuration settings to use - settings = ["port", "guid", "ffmpeg", "beacon", "hack83", "debug", "optres", "audio_br", "video_br", "max_video_br", "width", "height", "ffmpeg_prams", "bufsize"] - server += build_inputs(settings, server_data, 'Server') - - #Keep track of the different sections - section_map = '' - section_count = 1 - - shares_data = [ (section, dict(config.items(section))) for section in config.sections() if not(section.startswith('_tivo_') or section.startswith('Server')) and (config.has_option(section,'type') and config.get(section,'type').lower() != 'admin')] - shares ='' - for name, data in shares_data: - shares += '----------------------------------' - shares += '[]' - #build an array with configuration settings to use - settings = ["type", "path", "auto_subshares"] - shares += build_inputs(settings, data, "section-" + str(section_count)) - shares += 'Mark this share for deletion ' - section_map += "section-" + str(section_count) + "|" + name + "]" - section_count += 1 - - tivos_data = [ (section, dict(config.items(section))) for section in config.sections() if section.startswith('_tivo_')] - tivos ='' - for name, data in tivos_data: - tivos += '----------------------------------' - tivos += '[]' - #build an array with configuration settings to use - settings = ["aspect169", "audio_br", "video_br", "width", "height", "ffmpeg_prams"] - tivos += build_inputs(settings, data, "section-" + str(section_count)) - tivos += 'Mark this TiVo for deletion ' - section_map += "section-" + str(section_count) + "|" + name + "]" - section_count += 1 - - subcname = query['Container'][0] - cname = subcname.split('/')[0] - handler.send_response(200) - handler.end_headers() - t = Template(file=os.path.join(SCRIPTDIR,'templates', 'admin.tmpl')) - t.container = cname - t.server = server - t.shares = shares - t.tivos = tivos - t.section_map = section_map - handler.wfile.write(t) - config.read(config_file_path + '.dist') - def UpdateSettings(self, handler, query): config = ConfigParser.ConfigParser() config.read(config_file_path) diff --git a/plugins/admin/templates/settings.tmpl b/plugins/admin/templates/settings.tmpl index 5d7b9cc..272c772 100644 --- a/plugins/admin/templates/settings.tmpl +++ b/plugins/admin/templates/settings.tmpl @@ -824,7 +824,7 @@ shares will not work at all.
-