diff --git a/fishy/engine/semifisher/engine.py b/fishy/engine/semifisher/engine.py index b5453f4..4f62e61 100644 --- a/fishy/engine/semifisher/engine.py +++ b/fishy/engine/semifisher/engine.py @@ -5,6 +5,7 @@ import logging from threading import Thread from typing import Callable from typing import Optional +from playsound import playsound from fishy.engine.common.window import WindowClient from fishy.engine.semifisher.fishing_mode import Colors, FishingMode @@ -14,6 +15,7 @@ from fishy.engine.semifisher.fishing_mode import FishingMode from fishy.engine.semifisher.fishing_event import FishEvent from fishy.engine.semifisher import fishing_mode, fishing_event from fishy.engine.semifisher.pixel_loc import PixelLoc +from fishy.helper import helper from fishy.helper.luaparser import sv_color_extract @@ -84,6 +86,9 @@ class SemiFisherEngine(IEngine): if self.start: self.thread = Thread(target=self.run) self.thread.start() + playsound(helper.manifest_file("beep.wav"), False) + else: + helper.playsound_multiple(helper.manifest_file("beep.wav")) if __name__ == '__main__': diff --git a/fishy/helper/__init__.py b/fishy/helper/__init__.py index 2d3f6cf..07bc150 100644 --- a/fishy/helper/__init__.py +++ b/fishy/helper/__init__.py @@ -2,5 +2,5 @@ from .auto_update import auto_upgrade, upgrade_avail, versions from .config import Config from .helper import open_web, initialize_uid, install_thread_excepthook, unhandled_exception_logging, manifest_file, \ create_shortcut_first, addon_exists, get_addonversion, install_addon, remove_addon, restart, create_shortcut, \ - not_implemented, update, get_savedvarsdir + not_implemented, update, get_savedvarsdir, playsound_multiple from .luaparser import sv_color_extract diff --git a/fishy/helper/helper.py b/fishy/helper/helper.py index 66b6036..39fdfd2 100644 --- a/fishy/helper/helper.py +++ b/fishy/helper/helper.py @@ -7,6 +7,7 @@ import time import traceback import webbrowser import requests +from playsound import playsound from io import BytesIO from threading import Thread from zipfile import ZipFile @@ -23,6 +24,19 @@ import winshell from fishy import web +def playsound_multiple(path, count=2): + if count < 1: + logging.debug("Please don't make me beep 0 times or less.") + return + + def _ps_m(): + for i in range(count-1): + playsound(path, True) + playsound(path, False) + + Thread(target=_ps_m).start() + + def not_implemented(): logging.error("Not Implemented") diff --git a/fishy/helper/hotkey.py b/fishy/helper/hotkey.py index 74c57c3..5c6a7f3 100644 --- a/fishy/helper/hotkey.py +++ b/fishy/helper/hotkey.py @@ -3,9 +3,6 @@ from threading import Thread from typing import Dict, Callable, Optional import keyboard -from playsound import playsound - -from fishy.helper import helper class Key(Enum): @@ -27,7 +24,6 @@ def _get_callback(k): if not _hotkeys[k]: return - playsound(helper.manifest_file("beep.wav"), False) Thread(target=_hotkeys[k]).start() return callback