From 8afa1bfec440dd9d11fa7ececccd5d9215f5c3fb Mon Sep 17 00:00:00 2001 From: Benex254 Date: Mon, 5 Aug 2024 09:47:05 +0300 Subject: [PATCH] feat(notifier)?: add notification bell --- fastanime/cli/commands/anilist/notifier.py | 14 ++++++++++++-- fastanime/constants.py | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/fastanime/cli/commands/anilist/notifier.py b/fastanime/cli/commands/anilist/notifier.py index 6e6b056..c3e710f 100644 --- a/fastanime/cli/commands/anilist/notifier.py +++ b/fastanime/cli/commands/anilist/notifier.py @@ -8,7 +8,13 @@ import requests from plyer import notification from ....anilist import AniList -from ....constants import APP_CACHE_DIR, APP_DATA_DIR, APP_NAME, PLATFORM +from ....constants import ( + APP_CACHE_DIR, + APP_DATA_DIR, + APP_NAME, + NOTIFICATION_BELL, + PLATFORM, +) from ..config import Config logger = logging.getLogger(__name__) @@ -91,9 +97,13 @@ def notifier(config: Config): message=message, app_name=APP_NAME, app_icon=ICON_PATH, - hints={"image-path": ICON_PATH}, + hints={ + "image-path": ICON_PATH, + "sound-file": NOTIFICATION_BELL, + }, timeout=notification_duration, ) + # os.system(f"play {NOTIFICATION_BELL}") time.sleep(30) except Exception as e: logger.error(e) diff --git a/fastanime/constants.py b/fastanime/constants.py index 76f5837..fefd808 100644 --- a/fastanime/constants.py +++ b/fastanime/constants.py @@ -14,6 +14,10 @@ APP_DIR = os.path.abspath(os.path.dirname(__file__)) CONFIGS_DIR = os.path.join(APP_DIR, "configs") ASSETS_DIR = os.path.join(APP_DIR, "assets") +# --- notification bell --- +NOTIFICATION_BELL = os.path.join(ASSETS_DIR, "tut_turu.mp3") + +# --- icon stuff --- if PLATFORM == "Windows": ICON_PATH = os.path.join(ASSETS_DIR, "logo.ico") else: