feat(notifier): add icon

This commit is contained in:
Benex254
2024-08-05 09:47:04 +03:00
parent f27830953f
commit f8958be669
4 changed files with 10 additions and 3 deletions

BIN
fastanime/assets/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
fastanime/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

@@ -7,7 +7,7 @@ import click
from plyer import notification
from ....anilist import AniList
from ....constants import APP_DATA_DIR, APP_NAME
from ....constants import APP_DATA_DIR, APP_NAME, ICON_PATH
from ..config import Config
logger = logging.getLogger(__name__)
@@ -26,7 +26,6 @@ def notifier(config: Config):
timeout = 2
if os.path.exists(notified):
with open(notified, "r") as f:
past_notifications = json.load(f)
else:
past_notifications = {}
@@ -62,7 +61,10 @@ def notifier(config: Config):
json.dump(past_notifications, f)
logger.info(message)
notification.notify( # pyright:ignore
title=title, message=message, app_name=APP_NAME
title=title,
message=message,
app_name=APP_NAME,
app_icon=ICON_PATH,
)
except Exception as e:
logger.error(e)

View File

@@ -14,6 +14,11 @@ 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")
if PLATFORM == "Windows":
ICON_PATH = os.path.join(ASSETS_DIR, "logo.ico")
else:
ICON_PATH = os.path.join(ASSETS_DIR, "logo.png")
# ----- user configs and data -----
APP_DATA_DIR = dirs.user_config_dir
if not APP_DATA_DIR: