Changeset 4ac7bd104dcba74f99af2a8b437f995e6589d961
- 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
| rb469cf5 |
r4ac7bd1 |
|
| 7 | 7 | config = ConfigParser.ConfigParser() |
|---|
| 8 | 8 | p = os.path.dirname(__file__) |
|---|
| 9 | | config.read(os.path.join(p, 'pyTivo.conf')) |
|---|
| | 9 | config_file = os.path.join(p, 'pyTivo.conf') |
|---|
| | 10 | config.read(config_file) |
|---|
| | 11 | |
|---|
| | 12 | def reset(): |
|---|
| | 13 | config.read(config_file) |
|---|
| 10 | 14 | |
|---|
| 11 | 15 | def getGUID(): |
|---|
| rc58e713 |
r4ac7bd1 |
|
| 39 | 39 | except KeyError: |
|---|
| 40 | 40 | 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) |
|---|
| 41 | 46 | |
|---|
| 42 | 47 | class TivoHTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler): |
|---|
| rf4ac6a3 |
r4ac7bd1 |
|
| 1 | | import os, socket, re, sys, ConfigParser |
|---|
| | 1 | import os, socket, re, sys, ConfigParser, config |
|---|
| 2 | 2 | from ConfigParser import NoOptionError |
|---|
| 3 | 3 | from Cheetah.Template import Template |
|---|
| … | … | |
| 19 | 19 | |
|---|
| 20 | 20 | class 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() |
|---|
| 21 | 28 | |
|---|
| 22 | | CONTENT_TYPE = 'text/html' |
|---|
| 23 | 29 | def Admin(self, handler, query): |
|---|
| 24 | 30 | #Read config file new each time in case there was any outside edits |
|---|