feat: incremental SSE scan, recursive NC traversal, custom folder support
- nc_scan.py: recursive collect_audio_files (fixes depth-1 bug); scan_band_folder yields ndjson events (progress/song/session/skipped/done) for streaming - songs.py: replace old flat scan with scan_band_folder; add GET nc-scan/stream endpoint using _member_from_request so ?token= auth works for fetch-based SSE - BandPage.tsx: scan button now consumes ndjson stream via fetch+ReadableStream; sessions/unattributed invalidated as each song/session event arrives - session.py: add extract_session_folder() for YYMMDD path extraction - rehearsal_session.py: get_or_create uses begin_nested() savepoint to handle races - band.py: add get_by_nc_folder_prefix() for custom nc_folder_path band lookup - internal.py: nc-upload falls back to prefix match when slug lookup fails - event_loop.py: remove hardcoded bands/ guard; let internal API handle filtering Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -66,11 +66,6 @@ def normalize_nc_path(raw_path: str, username: str) -> str:
|
||||
return path
|
||||
|
||||
|
||||
def is_band_audio_path(path: str) -> bool:
|
||||
"""True if the user-relative path is inside a band folder."""
|
||||
parts = path.strip("/").split("/")
|
||||
return len(parts) >= 2 and parts[0] == "bands"
|
||||
|
||||
|
||||
def extract_nc_file_path(activity: dict[str, Any]) -> str | None:
|
||||
"""Extract the server-relative file path from an activity event."""
|
||||
@@ -140,10 +135,6 @@ async def poll_once(nc_client: NextcloudWatcherClient, settings: WatcherSettings
|
||||
)
|
||||
continue
|
||||
|
||||
if not is_band_audio_path(nc_path):
|
||||
log.info(" → skip: path not inside a bands/ folder")
|
||||
continue
|
||||
|
||||
if activity_type not in _UPLOAD_TYPES and subject not in _UPLOAD_SUBJECTS:
|
||||
log.info(
|
||||
" → skip: type=%r subject=%r is not a file upload event",
|
||||
|
||||
Reference in New Issue
Block a user