pub fn sync_library(
db: &Database,
client: &SubsonicClient,
full: bool,
server_url: &str,
username: &str,
) -> Result<SyncResult, SyncError>Expand description
Pull the Navidrome/Subsonic library into the local DB.
If full is false and a last_sync timestamp exists for this server,
performs an incremental sync using getAlbumList2(type=newest), stopping
when all albums on a page predate the last sync. Otherwise does a full sync
using alphabeticalByName.
Pipeline: paginate album list -> fetch album details in parallel (rayon) -> batch-write each page in a single transaction.
Deduplication happens in upsert_track — if a local track already exists
with the same artist + album + title + track#, the remote_id and remote_url
are merged onto the existing row instead of creating a duplicate.