doe not bring success before write
This commit is contained in:
parent
4ea9740849
commit
cee38f304d
@ -16,16 +16,18 @@ def addScreenToIgnoreList(ignoreFileName = '/tmp/fenrirSuspend', screen = '1', u
|
||||
ignoreScreens = fp.read().split(',')#.replace('\n','').split(',')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
added = False
|
||||
if not screen in ignoreScreens:
|
||||
ignoreScreens.extend(screen)
|
||||
print('Add screen {0} to ignore file:{1}'.format(screen, ignoreFileName))
|
||||
else:
|
||||
print('Screen {0} already exists in ignore file:{1}'.format(screen, ignoreFileName))
|
||||
added = True
|
||||
ignoreScreensStr = ','.join(ignoreScreens)
|
||||
|
||||
with open(ignoreFileName, 'w') as fp:
|
||||
fp.write(ignoreScreensStr)
|
||||
if added:
|
||||
print('Add screen {0} to ignore file:{1}'.format(screen, ignoreFileName))
|
||||
else:
|
||||
print('Screen {0} already exists in ignore file:{1}'.format(screen, ignoreFileName))
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Ignore screens in fenrir. If no screen is given use current screen.')
|
||||
|
@ -16,16 +16,19 @@ def removeScreenFromIgnoreList(ignoreFileName = '/tmp/fenrirSuspend', screen = '
|
||||
ignoreScreens = fp.read().split(',')#.replace('\n','').split(',')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
removed = False
|
||||
if screen in ignoreScreens:
|
||||
ignoreScreens.remove(screen)
|
||||
print('Remove screen {0} to ignore file:{1}'.format(screen, ignoreFileName))
|
||||
else:
|
||||
print('Screen {0} does not exists in ignore file:{1}'.format(screen, ignoreFileName))
|
||||
removed = True
|
||||
|
||||
ignoreScreensStr = ','.join(ignoreScreens)
|
||||
|
||||
with open(ignoreFileName, 'w') as fp:
|
||||
fp.write(ignoreScreensStr)
|
||||
if removed:
|
||||
print('Remove screen {0} to ignore file:{1}'.format(screen, ignoreFileName))
|
||||
else:
|
||||
print('Screen {0} does not exists in ignore file:{1}'.format(screen, ignoreFileName))
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Unignore screens in fenrir to make it active again. If no screen is given use current screen.')
|
||||
|
Loading…
Reference in New Issue
Block a user