From 3f71065ad62cbb34095e5b5c98cc4d04d332d3b8 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Thu, 4 Jun 2026 10:50:32 -0400 Subject: [PATCH] [notifications] Send ntfy on more imports --- PROJECT.org | 4 ++-- vrobbler/apps/birds/importer.py | 3 +++ vrobbler/apps/scrobbles/importers/scale.py | 3 +++ vrobbler/apps/scrobbles/importers/trail_gpx.py | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/PROJECT.org b/PROJECT.org index 30d4da7..db172b5 100644 --- a/PROJECT.org +++ b/PROJECT.org @@ -93,7 +93,7 @@ fetching and simple saving. :LOGBOOK: CLOCK: [2025-07-09 Wed 09:55]--[2025-07-09 Wed 10:15] => 0:20 :END: -* Backlog [3/19] :vrobbler:project:personal: +* Backlog [4/19] :vrobbler:project:personal: ** TODO [#C] Add sentiment parsing for Scrobbles with notes :vrobbler:project:scrobbles:sentiment: :PROPERTIES: :ID: 37781d6a-f3b0-48b2-bf98-33c2c791cf85 @@ -518,7 +518,7 @@ We should update note rendering to be a simple newest to oldest display in a single column with the timestamp has a small header, and the content rendered as markdown with a small bar or horizontal divider marking them from the next note. -** TODO [#A] Imports should send notifications :feature:notifications:imports: +** DONE [#A] Imports should send notifications :feature:notifications:imports: :PROPERTIES: :ID: 6f78f8d5-ecaa-4d8a-a666-ae4e27653191 :END: diff --git a/vrobbler/apps/birds/importer.py b/vrobbler/apps/birds/importer.py index 587fe23..5f18912 100644 --- a/vrobbler/apps/birds/importer.py +++ b/vrobbler/apps/birds/importer.py @@ -8,6 +8,7 @@ from django.contrib.auth import get_user_model from birds.models import Bird, BirdSightingEntry, BirdSightingLogData, BirdingLocation from scrobbles.models import Scrobble +from scrobbles.notifications import ScrobbleNtfyNotification logger = logging.getLogger(__name__) User = get_user_model() @@ -183,4 +184,6 @@ def import_birding_csv(file_path, user_id): created = Scrobble.objects.bulk_create(new_scrobbles) logger.info(f"Created {len(created)} birding scrobbles") + for scrobble in created: + ScrobbleNtfyNotification(scrobble).send() return created diff --git a/vrobbler/apps/scrobbles/importers/scale.py b/vrobbler/apps/scrobbles/importers/scale.py index 7f9ccc5..c8d3aa5 100644 --- a/vrobbler/apps/scrobbles/importers/scale.py +++ b/vrobbler/apps/scrobbles/importers/scale.py @@ -5,6 +5,7 @@ from datetime import datetime, timedelta from django.contrib.auth import get_user_model from scrobbles.models import Scrobble +from scrobbles.notifications import ScrobbleNtfyNotification from tasks.models import Task logger = logging.getLogger(__name__) @@ -115,4 +116,6 @@ def import_scale_csv(file_path, user_id): created = Scrobble.objects.bulk_create(new_scrobbles) logger.info(f"Created {len(created)} weigh-in scrobbles") + for scrobble in created: + ScrobbleNtfyNotification(scrobble).send() return created diff --git a/vrobbler/apps/scrobbles/importers/trail_gpx.py b/vrobbler/apps/scrobbles/importers/trail_gpx.py index 7b47a33..56c7197 100644 --- a/vrobbler/apps/scrobbles/importers/trail_gpx.py +++ b/vrobbler/apps/scrobbles/importers/trail_gpx.py @@ -12,6 +12,7 @@ from django.core.files import File from locations.models import GeoLocation from scrobbles.models import Scrobble +from scrobbles.notifications import ScrobbleNtfyNotification from trails.models import Trail, TrailLogData logger = logging.getLogger(__name__) @@ -328,4 +329,6 @@ def import_trail_gpx(file_path, user_id, original_filename=None): created = Scrobble.objects.bulk_create(new_scrobbles) logger.info(f"Created {len(created)} trail scrobbles") + for scrobble in created: + ScrobbleNtfyNotification(scrobble).send() return created