Changeset 4ac7bd104dcba74f99af2a8b437f995e6589d961

Show
Ignore:
Timestamp:
02/25/08 18:31:56 (9 months ago)
Author:
KRKeegan <-NOSPAM-kevin@krkeegan.com>
git-committer:
KRKeegan <-NOSPAM-kevin@krkeegan.com> 1203985916 -0800
git-parent:

[386afdbc13017f56e8030efaf16190030aa8ac2e]

git-author:
KRKeegan <-NOSPAM-kevin@krkeegan.com> 1203985916 -0800
Message:

Enable rereading of pyTivo.conf without restart

Initial design. Causes config.py to reread the conf file.
httpserver.py unloads a reloads the container dict

Allof this is initiate through a restart command to the admin plugin.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • config.py

    rb469cf5 r4ac7bd1  
    77config = ConfigParser.ConfigParser() 
    88p = os.path.dirname(__file__) 
    9 config.read(os.path.join(p, 'pyTivo.conf')) 
     9config_file = os.path.join(p, 'pyTivo.conf') 
     10config.read(config_file) 
     11 
     12def reset(): 
     13    config.read(config_file) 
    1014 
    1115def getGUID(): 
  • httpserver.py

    rc58e713 r4ac7bd1  
    3939        except KeyError: 
    4040            print 'Unable to add container', name 
     41 
     42    def reset(self): 
     43        self.containers.clear() 
     44        for section, settings in config.getShares(): 
     45            self.add_container(section, settings) 
    4146 
    4247class TivoHTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler): 
  • plugins/admin/admin.py

    rf4ac6a3 r4ac7bd1  
    1 import os, socket, re, sys, ConfigParser 
     1import os, socket, re, sys, ConfigParser, config 
    22from ConfigParser import NoOptionError 
    33from Cheetah.Template import Template 
     
    1919 
    2020class Admin(Plugin): 
     21    CONTENT_TYPE = 'text/html' 
     22 
     23    def Restart(self, handler, query): 
     24        config.reset() 
     25        handler.server.reset() 
     26        handler.send_response(200) 
     27        handler.end_headers() 
    2128     
    22     CONTENT_TYPE = 'text/html' 
    2329    def Admin(self, handler, query): 
    2430        #Read config file new each time in case there was any outside edits