From 88bbc1410b52d4b669c54abc42f68c5677c3b951 Mon Sep 17 00:00:00 2001 From: KRKeegan <-NOSPAM-kevin@krkeegan.com> Date: Fri, 14 Mar 2008 22:46:38 -0700 Subject: [PATCH] Add form to change MAK and save path --- plugins/admin/admin.py | 41 ++++++++++++++++++++++++++++++++++++---- plugins/admin/templates/npl.tmpl | 10 ++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/plugins/admin/admin.py b/plugins/admin/admin.py index fc4ddbc..adf6382 100644 --- a/plugins/admin/admin.py +++ b/plugins/admin/admin.py @@ -29,6 +29,10 @@ class Admin(Plugin): def Reset(self, handler, query): config.reset() handler.server.reset() + if 'last_page' in query: + last_page = query['last_page'][0] + else: + last_page = 'Admin' subcname = query['Container'][0] cname = subcname.split('/')[0] @@ -37,10 +41,10 @@ class Admin(Plugin): t = Template(file=os.path.join(SCRIPTDIR,'templates', 'redirect.tmpl')) t.container = cname t.time = '3' - t.url = '/TiVoConnect?Command=Admin&Container=' + cname + t.url = '/TiVoConnect?Command='+ last_page +'&Container=' + cname t.text = '

The pyTivo Server has been soft reset.


pyTivo has reloaded the pyTivo.conf'+\ 'file and all changed should now be in effect.
The'+ \ - ' Admin page will reload in 3 seconds.' + ' previous page will reload in 3 seconds.' handler.wfile.write(t) def Admin(self, handler, query): @@ -146,6 +150,10 @@ class Admin(Plugin): tivo_mak = data['tivo_mak'] else: tivo_mak = "" + if 'togo_path' in data: + togo_path = data['togo_path'] + else: + togo_path = "" if 'TiVo' in query: tivoIP = query['TiVo'][0] @@ -224,7 +232,6 @@ class Admin(Plugin): data = [] tivoIP = '' - print len(data) subcname = query['Container'][0] cname = subcname.split('/')[0] handler.send_response(200) @@ -232,7 +239,8 @@ class Admin(Plugin): t = Template(file=os.path.join(SCRIPTDIR,'templates', 'npl.tmpl')) t.folder = folder t.status = status - print handler.tivos + t.tivo_mak = tivo_mak + t.togo_path = togo_path t.tivos = handler.tivos t.tivoIP = tivoIP t.container = cname @@ -348,3 +356,28 @@ class Admin(Plugin): t.text = '

Transfer Stopped.


Your transfer has been stopped.'+\ '
The ToGo page will reload in 3 seconds.' handler.wfile.write(t) + + + def SaveNPL(self, handler, query): + config = ConfigParser.ConfigParser() + config.read(config_file_path) + if 'tivo_mak' in query: + config.set(query['Container'][0], 'tivo_mak', query['tivo_mak'][0]) + if 'togo_path' in query: + config.set(query['Container'][0], 'togo_path', query['togo_path'][0]) + f = open(config_file_path, "w") + config.write(f) + f.close() + + subcname = query['Container'][0] + cname = subcname.split('/')[0] + handler.send_response(200) + handler.end_headers() + t = Template(file=os.path.join(SCRIPTDIR,'templates', 'redirect.tmpl')) + t.container = cname + t.time = '2' + t.url = '/TiVoConnect?last_page=NPL&Command=Reset&Container=' + cname + t.text = '

Your Settings have been saved.


You settings have been saved to the pyTivo.conf file.'+\ + 'pyTivo will now do a Soft Reset to allow these changes to take effect.'+\ + '
The Reset will occur in 2 seconds.' + handler.wfile.write(t) diff --git a/plugins/admin/templates/npl.tmpl b/plugins/admin/templates/npl.tmpl index 1457bb7..c8a1763 100644 --- a/plugins/admin/templates/npl.tmpl +++ b/plugins/admin/templates/npl.tmpl @@ -109,6 +109,16 @@ #else +
+ + + + + + + +
ToGo Settings
MAK:
Save Path:
+

Instructions

Required Settings:
-- 2.11.4.GIT