From f67494e81206ba5719197e6de9c5bc7ee4203c11 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Mon, 22 Dec 2008 17:11:26 -0500 Subject: [PATCH] More trivial stuff that bugs me. --- beacon.py | 16 ++++++---------- config.py | 8 ++++---- pyTivo.py | 9 +++------ 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/beacon.py b/beacon.py index ead2516..b69bb74 100644 --- a/beacon.py +++ b/beacon.py @@ -18,17 +18,13 @@ class Beacon: return ';'.join(self.services) def format_beacon(self, conntype, services=True): - beacon = [] + beacon = ['tivoconnect=1', + 'swversion=1', + 'method=%s' % conntype, + 'identity=%s' % config.getGUID(), + 'machine=%s' % gethostname(), + 'platform=pc'] - guid = config.getGUID() - - beacon.append('tivoconnect=1') - beacon.append('swversion=1') - beacon.append('method=%s' % conntype) - beacon.append('identity=%s' % guid) - - beacon.append('machine=%s' % gethostname()) - beacon.append('platform=pc') if services: beacon.append('services=' + self.format_services()) else: diff --git a/config.py b/config.py index b903b0c..6d5c6c3 100644 --- a/config.py +++ b/config.py @@ -15,7 +15,7 @@ config_files = [ ] config_exists = False for config_file in config_files: - if os.path.exists(config_file): + if os.path.exists(config_file): config_exists = True if not config_exists: print 'ERROR: pyTivo.conf does not exist.\n' + \ @@ -52,10 +52,10 @@ def getPort(): return config.get('Server', 'Port') def get169Blacklist(tsn): # tivo does not pad 16:9 video - return tsn != '' and not isHDtivo(tsn) and not get169Letterbox(tsn) + return tsn and not isHDtivo(tsn) and not get169Letterbox(tsn) def get169Letterbox(tsn): # tivo pads 16:9 video for 4:3 display - return tsn != '' and tsn[:3] in ('649') + return tsn and tsn[:3] in ('649') def get169Setting(tsn): if not tsn: @@ -150,7 +150,7 @@ def getFFmpegPrams(tsn): return None def isHDtivo(tsn): # tsn's of High Definition Tivo's - return tsn != '' and tsn[:3] in ['648', '652', '658'] + return tsn and tsn[:3] in ['648', '652', '658'] def getValidWidths(): return [1920, 1440, 1280, 720, 704, 544, 480, 352] diff --git a/pyTivo.py b/pyTivo.py index 53c579d..57cbcfe 100755 --- a/pyTivo.py +++ b/pyTivo.py @@ -9,12 +9,9 @@ import config from plugin import GetPlugin def init_logging(): - config.config_files - p = os.path.dirname(__file__) - - if config.config.has_section('loggers') and\ - config.config.has_section('handlers') and\ - config.config.has_section('formatters'): + if (config.config.has_section('loggers') and + config.config.has_section('handlers') and + config.config.has_section('formatters')): logging.config.fileConfig(config.config_files) -- 2.11.4.GIT