refactor: unify test dispatch with real NotificationDispatcher
- Route scheduled/memory test sends through the same NotificationDispatcher the watcher uses — identical template rendering, media handling, caching - Add preview_url field to MediaAsset (transcoded mid-size), separate from thumbnail_url (small) and full_url (original). Dispatcher prefers preview_url - Fix sendMediaGroup cache: extract file_ids from Telegram response and store via async_set_many so repeat sends use cached file_ids - Parallelize asset downloads in _send_media_group with asyncio.gather - Filter unprocessed assets (archived/trashed/offline/no-thumbhash) at album parse time in ImmichAlbumData.from_api_response - Extract shared asset_to_media + collect_scheduled_assets into asset_utils.py (single source for test dispatch and future real scheduler) - Respect tracking config filters: limit, asset_type, favorite_only, min_rating - Random asset sampling for scheduled sends - Memory mode: "On This Day" date filter (same month+day, previous year) - Skip dispatch when no matching assets found - Remove ~250 lines of duplicated send logic from notifier.py - Fix restart-backend.sh: proper env var export, Python path resolution, error log
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
# Restart the backend dev server.
|
||||
# Usage: bash scripts/restart-backend.sh
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Kill existing backend
|
||||
@@ -12,12 +11,28 @@ if [ -n "$PID" ]; then
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
# Resolve python — py launcher needs absolute path for nohup on Windows
|
||||
if command -v python3 &>/dev/null; then
|
||||
PYTHON=python3
|
||||
elif command -v python &>/dev/null; then
|
||||
PYTHON=python
|
||||
else
|
||||
PYTHON=$(py -3.13 -c "import sys; print(sys.executable)" 2>/dev/null \
|
||||
|| py -3 -c "import sys; print(sys.executable)")
|
||||
fi
|
||||
|
||||
# Start backend
|
||||
NOTIFY_BRIDGE_DATA_DIR=./test-data \
|
||||
NOTIFY_BRIDGE_SECRET_KEY=test-secret-key-minimum-32chars \
|
||||
PYTHON=$(command -v python3 2>/dev/null || command -v python 2>/dev/null || echo "py -3.13")
|
||||
export NOTIFY_BRIDGE_DATA_DIR=./test-data
|
||||
export NOTIFY_BRIDGE_SECRET_KEY=test-secret-key-minimum-32chars
|
||||
nohup "$PYTHON" -m uvicorn notify_bridge_server.main:app \
|
||||
--host 0.0.0.0 --port 8420 > /dev/null 2>&1 &
|
||||
--host 0.0.0.0 --port 8420 > .backend.log 2>&1 &
|
||||
|
||||
sleep 3
|
||||
curl -s http://localhost:8420/api/health
|
||||
if curl -sf http://localhost:8420/api/health; then
|
||||
echo ""
|
||||
echo "Backend started (PID $!)"
|
||||
else
|
||||
echo "Backend failed to start. Log:"
|
||||
tail -20 .backend.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user