feat(notifier)?: add notification bell

This commit is contained in:
Benex254
2024-08-05 09:47:05 +03:00
parent 25b9b42fdf
commit 8afa1bfec4
2 changed files with 16 additions and 2 deletions

View File

@@ -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)

View File

@@ -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: