[U] Windows winsound support
This commit is contained in:
+8
-2
@@ -1,8 +1,8 @@
|
|||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import time
|
import time
|
||||||
import serial
|
import serial
|
||||||
import re
|
import re
|
||||||
from playsound import playsound
|
|
||||||
from pynput.keyboard import Key, Controller
|
from pynput.keyboard import Key, Controller
|
||||||
|
|
||||||
keyboard = Controller()
|
keyboard = Controller()
|
||||||
@@ -38,7 +38,13 @@ def parse_uid(data):
|
|||||||
PATH.write_text(uid)
|
PATH.write_text(uid)
|
||||||
|
|
||||||
# Play audio effect
|
# Play audio effect
|
||||||
playsound(str(AUDIO_EFFECT))
|
# If is Windows, use winsound
|
||||||
|
if os.name == 'nt':
|
||||||
|
import winsound
|
||||||
|
winsound.PlaySound(str(AUDIO_EFFECT), winsound.SND_FILENAME)
|
||||||
|
else:
|
||||||
|
from playsound import playsound
|
||||||
|
playsound(str(AUDIO_EFFECT))
|
||||||
|
|
||||||
# Press ENTER button
|
# Press ENTER button
|
||||||
keyboard.press(Key.enter)
|
keyboard.press(Key.enter)
|
||||||
|
|||||||
Reference in New Issue
Block a user