From 93921dfd0109a1e0ec8aa2b6cc84e97345510e95 Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 21 Sep 2018 17:32:55 +0200 Subject: [PATCH] fix ignore/ungignore --- tools/fenrir-ignore-screen | 7 +++++-- tools/fenrir-unignore-screen | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/fenrir-ignore-screen b/tools/fenrir-ignore-screen index f19735e5..fe005196 100755 --- a/tools/fenrir-ignore-screen +++ b/tools/fenrir-ignore-screen @@ -13,12 +13,15 @@ def addScreenToIgnoreList(ignoreFileName = '/tmp/fenrirSuspend', screen = '1', u if os.access(ignoreFileName, os.R_OK): with open(ignoreFileName, 'r') as fp: try: - ignoreScreens = fp.read().split(',')#.replace('\n','').split(',') + ignoreScreens = [] + content = str(fp.read()) + if content != '': + ignoreScreens = content.split(',') except Exception as e: print(e) added = False if not screen in ignoreScreens: - ignoreScreens.extend(screen) + ignoreScreens.append(screen) added = True ignoreScreensStr = ','.join(ignoreScreens) diff --git a/tools/fenrir-unignore-screen b/tools/fenrir-unignore-screen index c69b47f9..84727a72 100755 --- a/tools/fenrir-unignore-screen +++ b/tools/fenrir-unignore-screen @@ -13,7 +13,10 @@ def removeScreenFromIgnoreList(ignoreFileName = '/tmp/fenrirSuspend', screen = ' if os.access(ignoreFileName, os.R_OK): with open(ignoreFileName, 'r') as fp: try: - ignoreScreens = fp.read().split(',')#.replace('\n','').split(',') + ignoreScreens = [] + content = str(fp.read()) + if content != '': + ignoreScreens = content.split(',') except Exception as e: print(e) removed = False