Refactored code for TRUE multithreaded performance startup time decreased from 2 secs to 0.2 secs updates song time decreased from 3 secs to 0.1 secs introduced proper and full error handler, can fully recover from errors (including performing a full restart) implemented web server to push updates and restart application (flask) getting lyrics is truely mulithreaded now, all in memory.
10 lines
212 B
Python
10 lines
212 B
Python
from pynput import mouse
|
|
from functools import partial
|
|
|
|
def click(x, y, button, pressed, foo):
|
|
return False
|
|
|
|
bar = partial(click, foo="bar")
|
|
|
|
with mouse.Listener(on_click=bar) as listener:
|
|
listener.join() |