Commit Graph
864 Commits
Author SHA1 Message Date
zarzet 652cd1736b feat(lastfm): add desktop account connection and scrobbling
Authorize Last.fm accounts in the system browser and store sessions in OS secure storage. Add desktop Playback settings for scrobbling and Now Playing, including localized status and recovery controls.

Observe the local full player, measure actual listening time across pause and seek, distinguish repeats and transitions, and persist qualified listens before submitting account-scoped batches. Keep previews and remote Link sessions outside submission.

Validation: 281 Flutter tests passed, analyzer and pinned formatter clean, workflow lint passed, macOS debug build succeeded, and the signed Last.fm API handshake was verified. Build credentials are supplied locally or through Actions secrets.
2026-11-01 20:50:03 +07:00
zarzet 3f84aeb5bc fix(audio): reconcile USB output status with native playback 2026-11-01 20:45:07 +07:00
zarzet 20b6400323 perf(autoplay): defer taste training and pack vectors on the worker
Coalesce automatic retraining for 20 seconds so reading the listening log and publishing a new model no longer starts in the track-change burst. Cancel pending work on reset, disposal or explicit training. Keep current models usable during the delay.

Prepare the existing little-endian vector rows in the training isolate without changing the SQLite schema. A 100-feedback burst schedules one run instead of starting at play 25. All 92 taste and playback-runtime tests pass, including worker persistence roundtrip and cancellation.
2026-11-01 20:40:43 +07:00
zarzet e28fa2aeaa perf(bridge): avoid redundant download and small job codecs
Keep download snapshots as JSON across the Android channel and decode large progress payloads off the UI isolate while retaining event order and permissive empty-result behavior. Encode bounded small native data requests inline, with the existing pre-dispatch cancellation yield and background fallback for larger graphs.

Host tests verify zero encoder isolates for small requests, background decoding of large snapshots, cursor resets, stream cancellation, exact JSON and separate binary arguments. Restoring the old codec paths fails the corresponding isolate and event-loop probes.
2026-11-01 20:39:57 +07:00
zarzet d125c50fac perf(storage): move preference blobs to atomic files
Keep Explore payloads and timestamps, autoplay learning, and release bodies with their validators in application-support snapshots. Serialize migration, replacement, metadata updates and clear across store instances. Flush and rename before removing legacy keys, retain data on failure, and use a tombstone to prevent clear from reviving old preferences.

Preserve full payload content and unrelated settings. Explore reads are asynchronous and report actual file length; delayed release revalidation updates current metadata without overwriting a newer body.

The 261281-byte host preference fixture drops to 21 bytes after migration. Sixty subsequent blob saves make zero preference writes, with only three initial removals. Migration, corruption, failure/retry, ordering and all three consumer paths pass scoped host tests.
2026-11-01 20:30:50 +07:00
zarzet 8dccb0582d fix(library): unify Windows extended path identities 2026-11-01 20:21:44 +07:00
zarzet 90109f7e5f perf(covers): memoize reference keys and offload index warmup
Bound reference hash memoization to 4096 entries and run the complete stored-cover index walk in a worker isolate. Retain regular-file validation, duplicate selection, retry and durable filename behavior.

A 1001-file warmup fixture now performs no stat callbacks on the caller isolate while still rejecting FIFOs. Median time for 100000 repeated indexed lookups across 1000 keys fell from 141.858 ms to 45.262 ms in the host benchmark.
2026-11-01 20:20:43 +07:00
zarzet 4a53a24366 feat(lyrics): automatically embed online search results 2026-11-01 20:16:59 +07:00
zarzet d789c08630 perf(link): suppress idle state heartbeats and redundant pings
Send periodic player states only while connected and playing, keeping debounced changes and reconnect state delivery. Skip remote playback publication for download-only updates. Keep transport ping/pong liveness while paused and avoid a server ping after recent client traffic.

Negative controls observed four eliminated paused phone states per minute, three redundant download-driven playback events reduced to zero, and server ping suppression with client pings. All 104 scoped Dart tests and 114 Rust tests pass, with strict analysis, clippy and format checks.
2026-11-01 20:11:40 +07:00
zarzet 22c4f92a82 perf(library): reduce schema writes and repeated path migration
Bump Library to v21 and History to v16, add album artist indexes, and remove six Library and three History indexes whose seeks are served by existing queue indexes. Keep the named file-path index for released readers and synchronize native schema checks.

Persist the iOS container migration marker in the database transaction, exclude current paths, and bound Library and CUE reads to 256 rows. Repeat opens read one marker row. Test rollback, path keys, bookmarked sources and downgrade/reupgrade compatibility.

Four alternating 15,000-row host write pairs reduced median batch time from 3364.773 ms to 2782.200 ms (17.3 percent). Native staging now takes the shared History schema version.
2026-11-01 19:41:07 +07:00
zarzet 9d11f9b883 perf(library): restrict filtered album aggregates
Aggregate only album keys that can survive the active filter while keeping full-album counts and sort dates. Preserve the established album page results across source, FTS, shadow, sort and cursor combinations.

With the supporting artist indexes, the 15,000-row host aggregate measured 6.190 ms before and 0.456 ms after. Pin the changed SQL shape and retain the old row-result digests.
2026-11-01 19:41:07 +07:00
zarzet b2626ac95e perf(library): reuse suggestion matching and playlist seeds
Keep normalized collection match keys and filtered suggestions across page rebuilds. Snapshot candidate identities and history membership so edits and in-place list changes invalidate derived results, and sort playlist seeds once per collection snapshot.

Host widget checks reduce match-field reads from 3000 to zero over five rebuilds of a 200-track collection. All 170 scoped tests pass, with clean lib/test analysis and formatting.
2026-11-01 19:34:32 +07:00
zarzet 0dd8750400 feat(lyrics): sync AI romanization to original word timing 2026-11-01 19:30:14 +07:00
zarzet dcae0064ed perf(home): share counts and reuse unchanged shelves
Share the unfiltered Library count across Home and badges. Read On Repeat candidates in bounded pages, cache unchanged Library matches, and traverse mix songs with keyset paging. Regression checks retain ordering and skip missing files beyond the first candidate page.
2026-11-01 19:22:31 +07:00
zarzet 32672e1c39 perf(network): keep one Subsonic metadata client per connection
Each Subsonic or Mornye Link metadata read (getSong, then the cover and
lyrics in parallel) built a new HttpClient and force closed it, so every
song start paid one or two fresh TLS handshakes while streaming already
used a pooled client.

NetworkMetadataService now keeps one SubsonicClient per connection id
and reuses its keep-alive connections across reads. The client is reused
only for the exact saved connection (its JSON, so address, credentials,
API key and certificate pin), so an edit opens a new client and retires
the old one once its last read ends. It also closes after 20 s without
reads, when the connection is removed, on cancelPending, and after a
transport failure (anything but a Subsonic error, an HTTP status or a
local cache file error). Requests, headers, timeouts, certificate
pinning and redirect rules are unchanged, since every request still goes
through NetworkStorageService._request.

Measured on a local HTTPS fixture with a pinned self-signed certificate,
six metadata reads in a row: 6 HttpClients and 7 TLS connections before,
1 HttpClient and 2 TLS connections after, same 13 requests.
2026-11-01 19:21:10 +07:00
zarzet 836f0645a3 perf(player): set the AutoMix start timer again only when the start moves
While a mix waited, every 200 ms position tick cancelled the start timer
and created a new one: about 275 timers for the 55 s a one-minute song
waits, and up to about 725 for the 145 s a longer song now waits after
its lead. Positions follow the clock, so a tick almost always computes
the same moment. The timer is now set again only when the moment
computed from a new position moves by more than 20 ms, or when the
timer is no longer pending. A position that jumps or stalls still moves
the timer on the next tick, and the start itself re-checks the position
as before.

Host test (virtual time, the position following the clock): the start
timer is created 275 times for one song on the old code and once now;
the mix starts at 55000 ms in both.
2026-11-01 19:15:49 +07:00
zarzet be3b178c20 perf(player): prepare AutoMix only in the last 150 s of a song
AutoMix opened a second deck on the next song and decoded two analysis
windows (plus the native beat job) on the first tick of every song, so
each skipped song cost a full preparation that was thrown away, and the
prepared deck held an open decoder for the rest of the song. The owner
approved preparing only once 150 s remain. A plan starts within the last
minute (the longest fade), so preparation still has at least 90 s, and
a song of 150 s or less still prepares in its first seconds.

The plan does not depend on where preparation starts, so every mix
starts at the same moment with the same cue and rate. A seek already
cancels a prepared mix: a seek into the last 150 s prepares on the next
tick as before, and a seek back out now leaves no deck open until the
song returns to its last 150 s. A queue edit before then costs nothing.
The position predicate asks for the tick that crosses the lead.

Song analysis kept off the first 20 s of each song because AutoMix
prepared there. AutoMix now reports while it prepares, and both the
Library sweep and the playing song's analysis wait for it. The sweep
still avoids the first 20 s, where covers, lyrics and haptics load and
the playing song's own analysis follows.

Host tests (fake decks, virtual time): a session of four 4 min songs
skipped at 10 s and 60 s made 6 window decodes and 3 mix decks before
the third song reached its end; now none until its last 150 s, then 2
decodes and 1 deck. Mix start positions match the old code within 1 ms
(195000 vs 195001, 195670 vs 195671, 235000 both). Engine reads for a
200 s song: 827 instead of 990.
2026-11-01 19:15:49 +07:00
zarzet b1fd43ff0e test(perf): measure private native application pipelines
Add isolated library, download, playback, lyric, and log fixtures with durable-state and idle-work assertions. Native macOS suites pass; measurements exclude occluded-window samples and do not claim Android or iOS runtime performance.
2026-11-01 19:11:45 +07:00
zarzet 3151cc12a3 fix(cache): finish decoding invalid analysis artwork
Await image codec creation and dispose the codec even when decoding fails, avoiding a callback that never completes for corrupt artwork. Targeted cache regressions pass.
2026-11-01 19:11:45 +07:00
zarzet b52196410b fix(network): preserve edits and close late requests
Check the backup still matches the original before replacing a network file. Abort upload requests that open after timeout and prevent disposed sessions from recreating their HTTP client. Focused conflict and lifecycle regressions pass.
2026-11-01 19:11:44 +07:00
zarzet 6fa3b127a1 fix(download): cancel old attempts before retrying
Wait for cancellation before retrying and interrupt rate-limit waits on cancellation. The previous 300-second backoff failed a 3-second cancellation regression; the private native fixture now releases it in under 1 ms. Keep completed conversion destinations intact.
2026-11-01 19:11:43 +07:00
zarzet 18c95e8239 fix(player): preserve transport intent across asynchronous work
Bound position polling to one in-flight request and discard stale seek completions. Serialize exclusive-output changes without losing newer pause, stop, or dispose intent. Targeted playback and USB regressions pass.
2026-11-01 19:11:43 +07:00
zarzet 1d7c852648 feat(lyrics): sync translated phrases to original word timing 2026-11-01 19:00:38 +07:00
zarzet e0f8ee6117 feat(network): edit metadata and lyrics on SMB and WebDAV
Enable the shared metadata, lyrics and cover editor for writable NAS songs on mobile and desktop. Stage complete files locally, preserve the original during publication, and reconcile failed or lost rename replies.

Refresh Library rows and player metadata after successful saves, retain artwork in the Library cache, and keep HTTP and generic Subsonic sources read-only.

Validation: 248 related tests passed, plus 31 UI regressions after the final mounted-state guard. Scoped analysis, formatting and git diff checks are clean.
2026-11-01 17:35:49 +07:00
zarzet d602f0f180 fix(link): refresh phone library on reconnect
Rescan persisted phone catalogs when a phone reconnects so stale Library entries can recover even when catalog hashes match.

Validate online and offline deletions, persisted catalog replacement, and reconnect recovery. All 121 related tests pass; scoped analysis and formatting checks are clean.
2026-11-01 16:53:32 +07:00
zarzet 1e26dc26ca fix(network): handle HTTP redirects and clarify connection errors
Accept HTTP 303 redirects to canonical directory paths for GET and HEAD requests. Distinguish unreadable directory listings from local connection-save failures and add diagnostics without URLs or credentials.

Validation: 46 host tests passed, 2 SMB environment tests skipped; 3 Android integration scenarios passed; focused analyzer clean.
2026-11-01 16:38:13 +07:00
zarzet 78d5e5b0af fix(metadata): preserve extension URL fetch errors
Keep native metadata failures distinct from unsupported links so a failed large playlist import reports a fetch error and can be retried.
2026-11-01 16:26:50 +07:00
zarzet b5f2565816 fix(link): read embedded phone lyrics without cached audio 2026-11-01 16:24:56 +07:00
zarzet afee4332a2 fix(setup): accept existing all-files access on Android
Setup only checked the audio permission from Android 13, so a phone that
already granted all-files access (or granted it in settings and came
back) stayed stuck on the storage step, and Grant Permission asked again.
Setup now treats all-files access as enough on Android 11 and later, and
rechecks it before requesting anything.

It also reads the Android API level from the app's own channel, falling
back to device_info, so the Android 17 steps still appear when full
device information is unavailable.
2026-11-01 15:16:27 +07:00
zarzet 6407abedbf fix(downloads): preserve artwork in playlist downloads
Recover missing track artwork from the matching source album. Keep temporary covers alive while embedding operations still use them, even after cache eviction or queue cleanup.

Add regressions for mixed-playlist eviction, concurrent writers and source-album artwork recovery.

Validation: 99 Flutter tests passed, scoped analyzer clean, formatter and git diff checks passed.
2026-11-01 14:24:35 +07:00
zarzet b12f0399bd feat(collections): reorder saved songs in place 2026-11-01 14:13:56 +07:00
zarzet b2eaf5ed45 fix(network): recognize WebDAV NAS addresses behind tunnels
Recognize an advertised LAN origin only when the WebDAV response identifies the requested collection unambiguously. Keep browsing and playback on the saved connection so tunnel access and HTTPS trust continue to apply.

Validation: 76 Flutter tests and 7 Rust parser tests passed. Dart analyzer, Clippy with warnings denied, formatter checks, and git diff --check passed. Includes HTTP and HTTPS transport fixtures and rejected ambiguous origins; the reporter's NAS still needs a retest.
2026-11-01 14:11:24 +07:00
zarzet d6daf4542e feat(onboarding): ask for Nearby devices on Android 17
Android 17 asks for Nearby devices before an app can reach the local
network, which Mornye Link and network storage need. New installs get a
setup step for it after notifications, with no Skip: Next opens once it
is allowed, or after a refusal so nobody is stuck. People updating get an
Allow button on the Mornye Link page of the What's New tour, and Skip
stops at that page first while the permission is missing. Both go through
Link, so discovery starts over once it is allowed. Earlier Android
releases, Android TV and other platforms do not show either.
2026-11-01 14:04:47 +07:00
zarzet e942117e9d fix(network): handle WebDAV HTTP listing variants
Read same-host WebDAV child paths advertised through another HTTP or HTTPS listener while retaining the configured transport origin. Accept successful property statuses without a reason phrase, and reject non-WebDAV documents instead of presenting empty folders.

Validation: 71 Flutter tests and 7 Rust parser tests passed. Dart analyzer, Clippy with warnings denied, formatter checks, and git diff --check passed. The reporter's NAS still needs a retest.
2026-11-01 00:57:02 +07:00
zarzet 33e88b58ca feat(linux): add optional unsecured extension storage
Offer an explicit keyring-free storage choice in setup and extension settings. Keep the same extension key locally with owner-only permissions and explain the credential exposure.

Preserve existing encrypted data and serialize storage changes with startup. Verify keyring persistence before removing the local key when returning to secure storage.

Validation: 57 Flutter tests passed, scoped analyzer clean, formatter and git diff checks passed.
2026-11-01 00:49:22 +07:00
zarzet 0640617e47 fix(link): exchange missing listening statistics covers 2026-11-01 00:41:37 +07:00
zarzet 74d5272842 fix(link): sync AI lyrics translations across devices 2026-11-01 00:36:04 +07:00
zarzet 8e24b08fec feat(download): add FLAC quality caps and Opus 160 kbps
Add FLAC auto-conversion with maximum bit depth and sample rate in foreground and Android background downloads. Preserve lower source rates, artwork, metadata and output quality.

Keep 48 kHz available for mixed-source batch conversion and add 160 kbps to manual, batch and automatic conversion.

Validation: 122 Flutter tests and 26 Android JVM tests passed. Analysis of lib and test passed.
2026-11-01 00:06:41 +07:00
zarzet faab457bfa feat(link): add desktop device picker and file activity 2026-11-01 00:05:57 +07:00
zarzet a5e8077419 fix(link): keep Android phones available in the background 2026-10-31 23:56:12 +07:00
zarzet 0624bc72b2 fix(link): refresh paired device addresses after network changes 2026-10-31 23:28:38 +07:00
zarzet 072cbc3f48 fix(downloads): recover moved files after changing folders 2026-10-31 23:28:11 +07:00
zarzet dc0d9106a6 fix(link): preserve playback position during device handoff 2026-10-31 23:26:38 +07:00
zarzet ad2820cca5 fix(player): keep Android PCM defaults apart from the Bluetooth format
On Android, the audio info sheet showed the default low-latency PCM rate,
bit depth and buffer as the output of a Bluetooth route, and computed
resampling from them. Android does not report the negotiated A2DP or LE
Audio codec format, so for Bluetooth, LE and hearing aid routes the sheet
now says so, labels the PCM values as system defaults, and shows no
resampling. The sheet also reads the route again when the app returns to
the foreground, so a route changed in Settings shows at once.
2026-10-31 22:38:11 +07:00
zarzet e954e847c7 fix(player): read saved sessions longer than 512 KB in pieces
Android's sqflite reads each result row through a cursor window of about
2 MB, so a saved queue whose media_json passes it (roughly 4,000 to 6,000
songs) could not be read back: cold start, Android Auto start and Resume
did not restore it, the Home mixes hint failed, and Library cover pruning
was skipped while such a session existed.

Readers now select the text only when it fits 512 KB, as one read as
before. Longer text is read in one transaction as 512 KB pieces of
substr(CAST(text AS BLOB)), joined, and decoded (UTF-8 or the database's
UTF-16) together with its JSON on another isolate. This covers the active
session, the Resume archive and the cover reference scan. The stored data
is unchanged, so every build still reads and writes it.
2026-10-31 22:36:57 +07:00
zarzet 08c4f6d7b0 perf(player): encode session songs here when no isolate starts
A queue write with 64 or more new songs encodes them on another isolate.
If that isolate could not start, every such write failed, and so did each
retry. The writer now encodes those songs on this isolate instead.

A dismissal reset the stored queue revision as soon as it was requested,
so a position save queued before it rewrote the whole row just before the
row was archived. The revision now resets when the dismissal runs, and that
position save stays a scalar update.

The Android background playback integration test's session store takes
the new savePlaybackSession signature, which it no longer matched.
2026-10-31 22:36:57 +07:00
zarzet 4de2cff450 perf(player): encode each queued song once for session writes
Every queue change built a map per song and ran jsonEncode over the whole
saved queue on the UI isolate, then sent the text through the sqflite
channel as a string. In a 5,000-song queue one added song encoded all
5,001 songs (1.6 MB); 20,000 songs took about 100 ms of JSON encoding per
edit on a desktop host.

The writer now keeps each song's encoded JSON (songs are immutable) and
joins the cached bytes into the same media_json text. A single-song change
encodes one song (298 bytes in the 5,000-song test), and a remove, move or
shuffle encodes none. A new or restored queue with 64 or more songs to
encode does it on another isolate. The list reaches SQLite as UTF-8 bytes
stored as the same TEXT through CAST, so earlier builds read it unchanged
and the channel carries one copy instead of a string conversion.

A queue write that has not started yet takes the newest snapshot, so rapid
edits store once. A position save now applies only to the row of its own
queue, so a failed queue write no longer leaves the older queue paired
with the newer index.
2026-10-31 22:36:57 +07:00
zarzet e3072c8f4f perf(player): send Windows SMTC status and timeline only when needed
The Windows media session sent setStatus and setTimeline through
flutter_rust_bridge into WinRT for every playback state, twice a
second while playing, although the status rarely changes and Microsoft
suggests the timeline about every 5 s plus on state changes.

SmtcAudioService now skips a status the controls already have, and
sends the timeline when the status or speed changes, on a seek or jump
(the position departs from the last timeline advanced at its speed by
more than 1 s, as in MPRIS), on any paused position change, with every
media item, and otherwise every 5 s while playing (owner-approved
DESKTOP D6 c). A failed status or timeline update is sent again with
the next state.

Twelve seconds of 500 ms states with one media item: setStatus calls
go from 25 to 1, setTimeline from 26 to 4. Between updates the flyout
shows the last timeline or advances it itself.
2026-10-31 22:17:26 +07:00
zarzet 37d9a6c2aa fix(covers): keep the index when it cannot be read in a worker
If the isolate that reads the cover index could not start, the read
counted as a corrupt file: the index started empty and the next save
replaced a valid file with only the new rows, orphaning the cached
covers. The read now runs inline when no worker can start. A file that
exists but cannot be read at all (an I/O error) is reported and left as
it is, with this session's changes kept in memory, so nothing is saved
before a successful read. A file that was read but is corrupt is still
reported and replaced, as flutter_cache_manager does.

The media session's art cache sent covers to the temporary default
cache until the app shell initialized the cover cache, while the rest of
the app already used the cover cache, so a cover shown by both in that
window was downloaded twice. It now always uses the cover cache on
Android, iOS and macOS (Windows and Linux keep audio_service's default),
and drops its own file check on memory hits, which the cover cache now
does itself.
2026-10-31 22:14:06 +07:00
zarzet 37c81d2c6f fix(covers): never hand out a cover the byte budget deleted
The 15 minute byte budget sweep deletes cover files behind the cache
manager. Lookups through the index already check that the file exists,
but getFileFromMemory does not, so audio_service could pass the system
media session a path to a deleted cover (no art on the notification or
lock screen), and the index kept rows for the deleted files until each
was looked up again.

A memory hit now counts only while its file exists, and after a sweep
that deleted files the cache re-checks each index entry whose file is
gone (the existence check runs in a worker), which drops it from the
index and the memory cache unless a download has replaced it since.
2026-10-31 22:14:06 +07:00