This commit is contained in:
2025-12-08 12:11:20 +00:00
parent 85b1562a75
commit ada27e496d
3 changed files with 40 additions and 4 deletions

View File

@@ -17,3 +17,7 @@ WIREGUARD_ADDRESSES=
# Traefik Basic Auth
# Format: username:hashedpassword (from htpasswd -nB username)
TRAEFIK_AUTH=
# Notification Configuration
# URL to send notifications to (e.g. http://localhost:8080/notify)
NOTIFICATION_URL=http://localhost:8080/notify

View File

@@ -5,6 +5,7 @@ import sys
import os
import shutil
import pathlib
import requests
from typing import Dict, List
from tidal_dl_ng.download import Download
from tidal_dl_ng.config import Settings, Tidal
@@ -348,10 +349,37 @@ class DownloadManager:
# Move the album
shutil.move(str(album_dir), str(dest_album_path))
moved_count += 1
# Notification
try:
name_parts = album_dir.name.split(" - ", 1)
if len(name_parts) == 2:
content = f"{name_parts[1]} by {name_parts[0]} has been added to Navidrome"
else:
content = f"{album_dir.name} has been added to Navidrome"
self._send_notification(content)
except Exception as e:
logger.error(f"Error preparing notification: {e}")
if moved_count > 0:
logger.info(f"Successfully moved {moved_count} album(s) to {dest_base}")
except Exception as e:
logger.error(f"Failed to move albums: {e}")
def _send_notification(self, content):
url = os.getenv("NOTIFICATION_URL")
if not url:
return
try:
payload = {
"service_name": "tidal-dl-ng",
"content": content,
"level": "info"
}
requests.post(url, json=payload, timeout=5)
except Exception as e:
logger.error(f"Failed to send notification: {e}")

View File

@@ -49,18 +49,22 @@
<div class="container">
<div class="card" style="margin-top: 20px; text-align: center; color: #888;">
<small>System IP: <span id="system-ip">Loading...</span></small>
<small>System IP: <span id="system-ip">Loading...</span>
<button onclick="checkIp()" style="background: #444; color: white; border: none; padding: 2px 8px; border-radius: 4px; font-size: 0.8em; margin-left: 10px; cursor: pointer;">Check Again</button>
</small>
</div>
</div>
<script>
async function checkIp() {
const el = document.getElementById('system-ip');
el.textContent = 'Loading...';
try {
const response = await fetch('/system/ip');
const data = await response.json();
document.getElementById('system-ip').textContent = data.ip;
el.textContent = data.ip;
} catch (e) {
document.getElementById('system-ip').textContent = 'Error';
el.textContent = 'Error';
}
}
checkIp();