diff --git a/fastanime/cli/service/download/service.py b/fastanime/cli/service/download/service.py index cce526b..3d7e7d1 100644 --- a/fastanime/cli/service/download/service.py +++ b/fastanime/cli/service/download/service.py @@ -301,7 +301,8 @@ class DownloadService: message=message, app_name="FastAnime", app_icon=app_icon, - timeout=20, + timeout=self.app_config.general.desktop_notification_duration + * 60, ) except: pass @@ -322,7 +323,7 @@ class DownloadService: message=message, app_name="FastAnime", app_icon=app_icon, - timeout=20, + timeout=self.app_config.general.desktop_notification_duration * 60, ) except: pass diff --git a/fastanime/cli/service/notification/service.py b/fastanime/cli/service/notification/service.py index 5bf2f12..a6a1127 100644 --- a/fastanime/cli/service/notification/service.py +++ b/fastanime/cli/service/notification/service.py @@ -101,7 +101,7 @@ class NotificationService: message=message, app_name="FastAnime", app_icon=app_icon, # plyer supports file paths or URLs depending on platform - timeout=20, + timeout=self.app_config.general.desktop_notification_duration * 60, ) logger.info(f"Displayed notification: {message}") self._mark_seen( diff --git a/fastanime/core/config/defaults.py b/fastanime/core/config/defaults.py index 89937d3..7a3b917 100644 --- a/fastanime/core/config/defaults.py +++ b/fastanime/core/config/defaults.py @@ -6,6 +6,7 @@ GENERAL_PYGMENT_STYLE = "github-dark" GENERAL_PREFERRED_SPINNER = "smiley" GENERAL_API_CLIENT = "anilist" GENERAL_PREFERRED_TRACKER = "local" +GENERAL_DESKTOP_NOTIFICATION_DURATION = 5 GENERAL_PROVIDER = "allanime" diff --git a/fastanime/core/config/descriptions.py b/fastanime/core/config/descriptions.py index 8ef348b..35a7aca 100644 --- a/fastanime/core/config/descriptions.py +++ b/fastanime/core/config/descriptions.py @@ -6,6 +6,7 @@ GENERAL_API_CLIENT = "The media database API to use (e.g., 'anilist', 'jikan')." GENERAL_PREFERRED_TRACKER = ( "The preferred watch history tracker (local,remote) in cases of conflicts" ) +GENERAL_DESKTOP_NOTIFICATION_DURATION = "The duration desktop notifications should be displayed before they disappear in minutes" GENERAL_PROVIDER = "The default anime provider to use for scraping." GENERAL_SELECTOR = "The interactive selector tool to use for menus." GENERAL_AUTO_SELECT_ANIME_RESULT = ( diff --git a/fastanime/core/config/model.py b/fastanime/core/config/model.py index 5343537..8cf7348 100644 --- a/fastanime/core/config/model.py +++ b/fastanime/core/config/model.py @@ -13,6 +13,10 @@ from . import descriptions as desc class GeneralConfig(BaseModel): """Configuration for general application behavior and integrations.""" + desktop_notification_duration: int = Field( + default=defaults.GENERAL_DESKTOP_NOTIFICATION_DURATION, + description=desc.GENERAL_DESKTOP_NOTIFICATION_DURATION, + ) preferred_tracker: Literal["local", "remote"] = Field( default=defaults.GENERAL_PREFERRED_TRACKER, description=desc.GENERAL_PREFERRED_TRACKER,