Created
November 1, 2020 05:15
-
-
Save naoko1010hh/77d15c8658a4fadfc7e945da80446e22 to your computer and use it in GitHub Desktop.
aegigoe.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyxhook | |
import time | |
import os, sys | |
import random | |
import subprocess | |
def kbevent(event): | |
files = os.listdir("./audio/") | |
r = random | |
r.seed() | |
play_no = r.randint(0, len(files)-1) | |
file = files[play_no] | |
subprocess.call("cvlc a ./audio/"+file+" --play-and-exit &", shell=True) | |
hookman = pyxhook.HookManager() | |
hookman.KeyDown = kbevent | |
hookman.HookKeyboard() | |
hookman.start() | |
running = True | |
ctrlflag = False | |
while running: | |
time.sleep(1) | |
hookman.cancel() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment