mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-21 20:00:49 +01:00
Every export handed its catalog to the server, which bumps the version and sends catalog.changed to every phone, and each phone then rescans the whole desktop Library (NET-1). Most exports change nothing: each return of window focus reloads history and bumps the Library revision, and each phone song commit rescans that phone's source on the desktop, whose network rows the exporter leaves out anyway. The exporter now returns a SHA-256 of the song lines without the header (generatedMs is new every time). The mapping isolate hashes each line and the export hashes those 32-byte digests, so rows left out moving page starts do not change it, and the UI isolate hashes about 0.6 MB instead of the 14 MB catalog for 20,000 songs (about 4 ms instead of 95 ms on an M-series Mac). The digest covers every field the server reads, coverPath and webCoverPath included, so a web cover copy that arrives still reaches phones. The host skips setCatalog when the digest equals the one the current server read; the index, web cover prune and fetch, and phone source rescans still run, and player.state is not re-sent for unchanged song ids. Every started or adopted server counts as a new run, so a restart, a rename or a server started while the last one took a catalog always gets it. Measured with the host tests: a Library revision bump that exports an equal catalog calls setCatalog 0 times instead of 1, which saves each connected phone a full rescan.