mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-20 07:54:19 +02:00
modify notification module config
This commit is contained in:
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user