[notifications] Add a class for notifications

This commit is contained in:
2025-03-25 09:50:14 -04:00
parent 0a50bca622
commit 676c40176c
10 changed files with 116 additions and 56 deletions

View File

@ -9,8 +9,8 @@ import requests
from books.constants import BOOKS_TITLES_TO_IGNORE
from django.apps import apps
from django.contrib.auth import get_user_model
from scrobbles.utils import send_start_notifications_for_scrobble
from stream_sqlite import stream_sqlite
from scrobbles.notifications import NtfyNotification
from webdav.client import get_webdav_client
logger = logging.getLogger(__name__)
@ -443,7 +443,7 @@ def process_koreader_sqlite_file(file_path, user_id) -> list:
if new_scrobbles:
created = Scrobble.objects.bulk_create(new_scrobbles)
if created:
send_start_notifications_for_scrobble(created[-1].id)
NtfyNotification(created[-1]).send()
fix_long_play_stats_for_scrobbles(created)
logger.info(
f"Created {len(created)} scrobbles",