fix ignore/ungignore

This commit is contained in:
chrys 2018-09-21 17:32:55 +02:00
parent e16c9a8e74
commit 93921dfd01
2 changed files with 9 additions and 3 deletions

View File

@ -13,12 +13,15 @@ def addScreenToIgnoreList(ignoreFileName = '/tmp/fenrirSuspend', screen = '1', u
if os.access(ignoreFileName, os.R_OK): if os.access(ignoreFileName, os.R_OK):
with open(ignoreFileName, 'r') as fp: with open(ignoreFileName, 'r') as fp:
try: try:
ignoreScreens = fp.read().split(',')#.replace('\n','').split(',') ignoreScreens = []
content = str(fp.read())
if content != '':
ignoreScreens = content.split(',')
except Exception as e: except Exception as e:
print(e) print(e)
added = False added = False
if not screen in ignoreScreens: if not screen in ignoreScreens:
ignoreScreens.extend(screen) ignoreScreens.append(screen)
added = True added = True
ignoreScreensStr = ','.join(ignoreScreens) ignoreScreensStr = ','.join(ignoreScreens)

View File

@ -13,7 +13,10 @@ def removeScreenFromIgnoreList(ignoreFileName = '/tmp/fenrirSuspend', screen = '
if os.access(ignoreFileName, os.R_OK): if os.access(ignoreFileName, os.R_OK):
with open(ignoreFileName, 'r') as fp: with open(ignoreFileName, 'r') as fp:
try: try:
ignoreScreens = fp.read().split(',')#.replace('\n','').split(',') ignoreScreens = []
content = str(fp.read())
if content != '':
ignoreScreens = content.split(',')
except Exception as e: except Exception as e:
print(e) print(e)
removed = False removed = False