quintodrome/resources/i18n
Deluan Quintão 28d5299ffc
feat(scanner): implement selective folder scanning and file system watcher improvements (#4674)
* feat: Add selective folder scanning capability

Implement targeted scanning of specific library/folder pairs without
full recursion. This enables efficient rescanning of individual folders
when changes are detected, significantly reducing scan time for large
libraries.

Key changes:
- Add ScanTarget struct and ScanFolders API to Scanner interface
- Implement CLI flag --targets for specifying libraryID:folderPath pairs
- Add FolderRepository.GetByPaths() for batch folder info retrieval
- Create loadSpecificFolders() for non-recursive directory loading
- Scope GC operations to affected libraries only (with TODO for full impl)
- Add comprehensive tests for selective scanning behavior

The selective scan:
- Only processes specified folders (no subdirectory recursion)
- Maintains library isolation
- Runs full maintenance pipeline scoped to affected libraries
- Supports both full and quick scan modes

Examples:
  navidrome scan --targets "1:Music/Rock,1:Music/Jazz"
  navidrome scan --full --targets "2:Classical"

* feat(folder): replace GetByPaths with GetFolderUpdateInfo for improved folder updates retrieval

Signed-off-by: Deluan <deluan@navidrome.org>

* test: update parseTargets test to handle folder names with spaces

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(folder): remove unused LibraryPath struct and update GC logging message

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(folder): enhance external scanner to support target-specific scanning

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): simplify scanner methods

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(watcher): implement folder scanning notifications with deduplication

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(watcher): add resolveFolderPath function for testability

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(watcher): implement path ignoring based on .ndignore patterns

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): implement IgnoreChecker for managing .ndignore patterns

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(ignore_checker): rename scanner to lineScanner for clarity

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): enhance ScanTarget struct with String method for better target representation

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(scanner): validate library ID to prevent negative values

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): simplify GC method by removing library ID parameter

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(scanner): update folder scanning to include all descendants of specified folders

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): allow selective scan in the /startScan endpoint

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): update CallScan to handle specific library/folder pairs

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): streamline scanning logic by removing scanAll method

Signed-off-by: Deluan <deluan@navidrome.org>

* test: enhance mockScanner for thread safety and improve test reliability

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): move scanner.ScanTarget to model.ScanTarget

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: move scanner types to model,implement MockScanner

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): update scanner interface and implementations to use model.Scanner

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(folder_repository): normalize target path handling by using filepath.Clean

Signed-off-by: Deluan <deluan@navidrome.org>

* test(folder_repository): add comprehensive tests for folder retrieval and child exclusion

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): simplify selective scan logic using slice.Filter

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): streamline phase folder and album creation by removing unnecessary library parameter

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): move initialization logic from phase_1 to the scanner itself

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(tests): rename selective scan test file to scanner_selective_test.go

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(configuration): add DevSelectiveWatcher configuration option

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(watcher): enhance .ndignore handling for folder deletions and file changes

Signed-off-by: Deluan <deluan@navidrome.org>

* docs(scanner): comments

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(scanner): enhance walkDirTree to support target folder scanning

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(scanner, watcher): handle errors when pushing ignore patterns for folders

Signed-off-by: Deluan <deluan@navidrome.org>

* Update scanner/phase_1_folders.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor(scanner): replace parseTargets function with direct call to scanner.ParseTargets

Signed-off-by: Deluan <deluan@navidrome.org>

* test(scanner): add tests for ScanBegin and ScanEnd functionality

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(library): update PRAGMA optimize to check table sizes without ANALYZE

Signed-off-by: Deluan <deluan@navidrome.org>

* test(scanner): refactor tests

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(ui): add selective scan options and update translations

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(ui): add quick and full scan options for individual libraries

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(ui): add Scan buttonsto the LibraryList

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(scan): update scanning parameters from 'path' to 'target' for selective scans.

* refactor(scan): move ParseTargets function to model package

* test(scan): suppress unused return value from SetUserLibraries in tests

* feat(gc): enhance garbage collection to support selective library purging

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(scanner): prevent race condition when scanning deleted folders

When the watcher detects changes in a folder that gets deleted before
the scanner runs (due to the 10-second delay), the scanner was
prematurely removing these folders from the tracking map, preventing
them from being marked as missing.

The issue occurred because `newFolderEntry` was calling `popLastUpdate`
before verifying the folder actually exists on the filesystem.

Changes:
- Move fs.Stat check before newFolderEntry creation in loadDir to
  ensure deleted folders remain in lastUpdates for finalize() to handle
- Add early existence check in walkDirTree to skip non-existent target
  folders with a warning log
- Add unit test verifying non-existent folders aren't removed from
  lastUpdates prematurely
- Add integration test for deleted folder scenario with ScanFolders

Fixes the issue where deleting entire folders (e.g., /music/AC_DC)
wouldn't mark tracks as missing when using selective folder scanning.

* refactor(scan): streamline folder entry creation and update handling

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(scan): add '@Recycle' (QNAP) to ignored directories list

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(log): improve thread safety in logging level management

* test(scan): move unit tests for ParseTargets function

Signed-off-by: Deluan <deluan@navidrome.org>

* review

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: deluan <deluan.quintao@mechanical-orchard.com>
2025-11-14 22:15:43 -05:00
..
ar.json Update translations (#2329) 2023-06-19 12:27:56 -04:00
bg.json Update translations 2023-11-21 08:15:32 -05:00
bs.json feat(ui): add new Bosnian translation (#4399) 2025-07-29 12:06:09 -04:00
ca.json fix(ui): updated Catalan translations (#3973) 2025-04-16 21:05:59 -04:00
cs.json Update translations (#2409) 2023-11-14 19:21:26 -05:00
da.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
de.json fix(ui): update Deutsch, Galego, Italiano translations (#4394) 2025-07-29 12:06:29 -04:00
el.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
eo.json fix(ui): update German, Greek, Esperanto, Spanish, Finnish, French, Indonesian, Dutch, Portuguese (BR), Russian, Swedish, Turkish, Ukrainian translations from POEditor (#3981) 2025-05-28 17:46:34 -04:00
es.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
eu.json refactor(ui): replace translation key with direct character for remove action 2025-07-12 16:55:21 -04:00
fa.json fix: languageName for Persian (#3011) 2024-05-09 17:08:43 -04:00
fi.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
fr.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
gl.json fix(ui): update Galician, Dutch, Thai translations from POEditor (#4416) 2025-11-07 18:20:39 -05:00
hi.json feat(ui): add Hindi language translation (#4390) 2025-07-28 11:21:27 -04:00
hu.json fix(ui): update Hungarian translations (#4375) 2025-07-23 09:00:17 -04:00
id.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
it.json fix(ui): fix Playlist Italian translation(#4642) 2025-11-07 18:41:23 -05:00
ja.json fix(ui): update Deutsch, Español, Euskara, Galego, Bahasa Indonesia, 日本語, Português, Pусский, Türkçe translations from POEditor (#3681) 2025-02-26 22:20:48 -05:00
ko.json fix(ui): update ko.json (#4443) 2025-11-07 18:10:38 -05:00
nl.json fix(ui): update Galician, Dutch, Thai translations from POEditor (#4416) 2025-11-07 18:20:39 -05:00
no.json fix(ui): update Norwegian translation #3943 2025-04-16 21:04:10 -04:00
pl.json fix(ui): update Polish translations from POEditor (#4384) 2025-07-28 11:23:50 -04:00
pt-br.json feat(scanner): implement selective folder scanning and file system watcher improvements (#4674) 2025-11-14 22:15:43 -05:00
ru.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
sl.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
sr.json fix(ui): update Serbian translation (#3941) 2025-04-17 19:27:12 -04:00
sv.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
th.json fix(ui): update Galician, Dutch, Thai translations from POEditor (#4416) 2025-11-07 18:20:39 -05:00
tr.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
uk.json fix(ui): update Danish, German, Greek, Spanish, Finnish, French, Indonesian, Russian, Slovenian, Swedish, Turkish, Ukrainian translations from POEditor (#4326) 2025-07-25 18:58:57 -04:00
zh-Hans.json fix(ui): update Chinese simplified translation (#4403) 2025-07-31 12:18:06 -04:00
zh-Hant.json fix(ui): update zh-Hant.json (#4454) 2025-11-07 18:06:41 -05:00