-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathInput.py
33 lines (30 loc) · 956 Bytes
/
Input.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import Globals
import sys
import signal
from Logging import logWithTimestamp
from colorama import Fore
def async_input():
while Globals.acceptCommands:
data = input()
Globals.inputQueue.put(data)
def handle_input():
while not Globals.inputQueue.empty():
command = Globals.inputQueue.get()
success = False
if command == "stop":
Globals.acceptCommands = False
sys.exit(0)
success = True
elif command == "pause":
Globals.running = False
success = True
elif command == "resume":
Globals.running = True
success = True
elif command == "switch":
Globals.switchUserAgent()
success = True
if success:
logWithTimestamp("Command [" + command + "] successful", Fore.LIGHTGREEN_EX)
else:
logWithTimestamp("Unknown command: " + command, Fore.RED)