From dcf14876bb9b0b18201fdca28b0e57cc1202c7b5 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Fri, 6 Jun 2014 16:08:07 -0400 Subject: [PATCH] Allow filling in the names and addresses of TiVos found via Zeroconf (although this shouldn't be needed) or specified in pyTivo.conf -- allows bare _tivo_TSN sections to still be pullable. --- httpserver.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/httpserver.py b/httpserver.py index 9617bb7..1552006 100644 --- a/httpserver.py +++ b/httpserver.py @@ -107,10 +107,13 @@ class TivoHTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler): if not self.authorize(tsn): return - if tsn and not config.tivos_found and not tsn in config.tivos: - ip = self.address_string() - name = self.server.beacon.get_name(ip) - config.tivos[tsn] = {'address': ip, 'name': name} + if tsn and (not config.tivos_found or tsn in config.tivos): + attr = config.tivos.get(tsn, {}) + if 'address' not in attr: + attr['address'] = self.address_string() + if 'name' not in attr: + attr['name'] = self.server.beacon.get_name(attr['address']) + config.tivos[tsn] = attr if '?' in self.path: path, opts = self.path.split('?', 1) -- 2.11.4.GIT