feat: scan the libraries by themselves when their music changed

Every 15 minutes (library.auto_scan_minutes, SONDA_AUTO_SCAN_MINUTES, 0 turns it off)
Sonda takes the signature of each library, a hash of the names of everything in it folder
by folder, which costs only the names of the files and so suits a NAS that sleeps. A
library whose signature changed (a song or a folder came, went or was renamed) is
scanned the usual way; every library is also scanned at least once a day, to find a song
tagged again where it stands.

It does not scan while another scan runs, tries again at the next look when a scan failed,
leaves alone a folder that cannot be read (a NAS that is not mounted), and ignores the
housekeeping folders of a NAS.
This commit is contained in:
tgiachi 2026-11-16 13:05:09 +01:00
commit 89f1b5275a

View file

@ -9,6 +9,9 @@ listen = "127.0.0.1:8080" # localhost by default
# Libraries (name + directory) are managed through the API: POST /api/v1/libraries.
[library]
scan_workers = 4 # parallel tag readers during a scan
auto_scan_minutes = 15 # how often to look at the folders and scan the libraries whose music changed
# (0 turns it off). Looking reads the names of the files, nothing else, so it is
# cheap for a NAS; a library is scanned at least once a day. Or SONDA_AUTO_SCAN_MINUTES.
# allow_delete = true # let an admin delete the extra copy of a song from the music folders.
# Off by default: it is the one thing that makes Sonda write there, and it
# needs the folders mounted writable. Or set SONDA_ALLOW_DELETE=true.