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