modify notification module config

This commit is contained in:
maxDorninger
2025-07-10 23:48:29 +02:00
parent 8a89a24f25
commit d986f91e5e
6 changed files with 52 additions and 22 deletions

View File

@@ -1,21 +1,27 @@
import requests
from pydantic_settings import BaseSettings
from media_manager.config import AllEncompassingConfig
from media_manager.notification.schemas import MessageNotification
from media_manager.notification.service_providers.abstractNotificationServiceProvider import (
AbstractNotificationServiceProvider,
)
class PushoverConfig(BaseSettings):
enabled: bool = False
api_key: str | None = None
user: str | None = None
class PushoverNotificationServiceProvider(AbstractNotificationServiceProvider):
def __init__(self):
self.config = AllEncompassingConfig().notifications
self.config = AllEncompassingConfig().notifications.pushover
def send_notification(self, message: MessageNotification) -> bool:
response = requests.post(
url="https://api.pushover.net/1/messages.json",
params={
"token": self.config.pushover_api_key,
"user": self.config.pushover_user,
"token": self.config.api_key,
"user": self.config.user,
"message": message.message,
"title": "MediaManager - " + message.title,
},