feat: initial implementation of navidrome-music-sync with Yandex, Spotify, Apple, YouTube support and Web UI
This commit is contained in:
1 parent
44c67ab49d
commit
5b6c2c72f7
23 files changed
+1445
-2
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import httpx
|
||||
from app.config import settings
|
||||
|
||||
async def trigger_navidrome_scan() -> bool:
|
||||
"""Notify Navidrome server to start scanning library for new files."""
|
||||
if not settings.NAVIDROME_URL or not settings.NAVIDROME_USER:
|
||||
return False
|
||||
|
||||
base_url = settings.NAVIDROME_URL.rstrip("/")
|
||||
scan_url = f"{base_url}/rest/startScan.view"
|
||||
|
||||
params = {
|
||||
"u": settings.NAVIDROME_USER,
|
||||
"p": settings.NAVIDROME_PASSWORD,
|
||||
"v": "1.16.1",
|
||||
"c": "navidrome-music-sync",
|
||||
"f": "json"
|
||||
}
|
||||
|
||||
try:
|
||||
async with httpx.AsyncClient(verify=False, timeout=10.0) as client:
|
||||
resp = await client.get(scan_url, params=params)
|
||||
if resp.status_code == 200:
|
||||
print("Navidrome library scan initiated successfully.")
|
||||
return True
|
||||
else:
|
||||
print(f"Navidrome scan request returned status {resp.status_code}")
|
||||
except Exception as e:
|
||||
print(f"Failed to trigger Navidrome scan: {e}")
|
||||
return False
|
||||
Reference in new issue
Block a user