Exemple #1
0
def autostate():
	try:
		global prev_save
		cur_save = time.time()

		if prev_save + converter.time(config['state']['interval']) <= cur_save:
			save_state()
			prev_save = cur_save
	except KeyError as e: # no interval specified
		pass
Exemple #2
0
def autopulse():
	for key, cond in config['pulse'].items():
		value = None
		if key == 'keys':
			value = keys
			cond = converter.general(cond)
		elif key == 'clicks':
			value = clicks
			cond = converter.general(cond)
		elif key == 'download':
			value = total_bytes['rx']
			cond = converter.size(cond)
		elif key == 'upload':
			value = total_bytes['tx']
			cond = converter.size(cond)
		elif key == 'uptime':
			value = total_time
			cond = converter.time(cond)

		if value >= cond:
			pulse()
			break