From 2459ee1c82f7745aaccd9cb9be3a292366159327 Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Tue, 18 Jul 2017 00:00:36 +0200 Subject: [PATCH] Allow for string entries (in addition to hash entries) in the shows config hash. --- tivomirror.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tivomirror.py b/tivomirror.py index 885f9f5..5912b06 100755 --- a/tivomirror.py +++ b/tivomirror.py @@ -64,16 +64,20 @@ class Config: with open(file, 'r') as f: y = yaml.load(f) - for show in y['shows']: - for key in show: - value = show[key] - if value and 'short' in value: - IncludeShow(key, value['short']) - else: - IncludeShow(key) for key in y: setattr(self, key, y[key]) + for show in self.shows: + for key in show: + if isinstance(key, dict): + value = show[key] + if value and 'short' in value: + IncludeShow(key, value['short']) + else: + IncludeShow(key) + else: + IncludeShow(key) + def __repr__(self): return "Config options for tivomirror (singleton)"