90 Commits
Author SHA1 Message Date
zarzet cff77a0dbf fix(desktop): keep the output open across a gapless song change
The load hook of the queued song set gapless-audio back to no before mpv
had decided whether that song keeps the open device, so the device was
closed and reopened at every song change. The libmpv build used on
Windows closes it without playing what is still queued, which drops the
end of the previous song.

The option now goes back to no once the queued song has started.
2026-11-18 00:35:44 +07:00
zarzet d2584e5be8 fix(desktop): give the audio device back when the app quits
Nothing stopped libmpv when the window closed, so the process ended with
the stream open. With exclusive output on Windows the device was reported
to stay silent after that until it was plugged in again. A quit request,
and the quit for an update, now stop every libmpv deck and wait until its
output is closed.

The audio output's own lines (device period, buffer, format, underruns)
now reach the log, for reports of crackling in exclusive mode.
2026-11-17 19:29:47 +07:00
zarzet e94a6aa4a2 fix(link): do not pause Play together when a song runs out
Between a song's end and the start of the next one a player reads as
neither playing nor paused. The phone took that for a pause, so at each
song end the follower was paused and rejoined about three seconds into
the next song (seen on a real run with the phone leading). A device that
reads as stopped within the last moments of its song is now given the
transition wait before a cue goes out.
2026-11-17 09:40:22 +07:00
zarzet cbf5b06765 test(link): simulate the measured rate change cost and start delay
The simulated players can now lose time on each rate change (the plain
and pinned AVPlayer changes measured on macOS, and an uneven one), sound
230 ms after a play while their report runs ahead until the next engine
read, and only count as heard once they sound. New tests run five
minutes on five seeds each and bound the error and the rate changes.
2026-11-17 04:37:14 +07:00
zarzet ad86633136 feat(link): host Link on a phone while it is open or playing
With sharing on, the phone runs the same host as the computer through
the Link channel and announces it with the platform's service
discovery. It runs while the app is in front or plays, stops after a
short grace in the background (at once on iOS), and leaves out
downloads, opening links and file changes. Sharing is off by default.
2026-11-17 03:09:29 +07:00
zarzet bbe5e6e187 feat(link): Play together timing core
Adds the together ops and reports, the deck over the shared player interface, the aligner that leaves small errors alone, nudges the follower's rate or rejoins, and learns the start lead, and the follower that starts at an agreed instant. A simulated deck with clock offset, drift, latency and jitter backs the tests.
2026-11-17 03:09:17 +07:00
zarzet 962e582acc chore(flutter): move to Flutter 3.50.0 and the material_ui packages
Flutter 3.50 deprecates its built-in Material and Cupertino libraries in
favour of the material_ui and cupertino_ui packages. The imports move
with the official fix (dart fix, migrate_design_widgets); the app's old
two-library theme bridge collapses into one Theme type.

- MaterialExpressiveScope keeps the complete host theme nearest its
  child. The reduced copy made for the expressive widgets now shares the
  app's Theme type and would hide component themes and extensions.
- LegacyThemeBrightness hands the brightness to the glass package, which
  still reads Flutter's built-in theme.
- appLocalizationsDelegates lists the material_ui localization delegates;
  the generated list still names the built-in ones.
- Tests: findByTooltip and pageBack replace the flutter_test helpers that
  only know the built-in widgets, and several tests that had gone stale
  against earlier app changes are repaired.
2026-11-15 23:33:29 +07:00
zarzet 227ea6be27 fix(network): edited and uploaded NAS songs no longer turn hidden
Uploads and metadata edits wrote to a temporary file named with a
leading dot and renamed it to the song. Samba-based servers give a dot
name the hidden attribute when the file is created and keep it through
the rename, so every song edited or uploaded over SMB showed as hidden
in file managers and had to be unhidden by hand.

The temporary upload, edit and recovery names now start without a dot.
Songs already marked hidden keep the attribute until it is cleared on
the server or the song is saved again.
2026-11-11 16:07:11 +07:00
zarzet 0a9eac574d Merge branch 'feat/batch-pq' into feat/batch-int 2026-11-08 19:08:14 +07:00
zarzet 0c5183a8c0 feat(playback): one headphone resume choice with three modes
Play when headphones connect and Resume when headphones reconnect become
one setting, `headphoneResume`, with three choices: Off, Reconnect
(resume a pause caused by headphones or Bluetooth going away, within 30
minutes) and Always (the old switch: every connection resumes, a user
pause included, and a disconnect pauses). The row keeps the old title,
describes the current choice under it and draws the choice with the
DESIGN.md component for 2 to 4 short options: `SettingsSegmentedChoice`
(connected M3 Expressive button group) in Material and
`MornyeSegmentedControl` in Mornye. "Reconnect" is short so the three
segments fit one row on a 360 wide phone in both styles and languages.

Migration: a saved `headphoneResume` wins; otherwise
`playOnHeadphonesConnected: true` reads as Always, then
`resumeOnOutputReconnect: true` as Reconnect, else Off. An unknown value
falls back the same way. `toJson` still writes
`playOnHeadphonesConnected` (true only for Always), so a downgrade or a
backup opened by an older build keeps the broad behaviour, and backups
carry the new key through the full settings map.

The choice is offered and applied on Android and iOS phones and tablets
only: desktop and Android TV hide it (search too) and the player treats
it as Off there. The old switch's strings stay for the title and the
Always description; the two strings only the separate switch used are
removed.
2026-11-08 19:05:03 +07:00
zarzet f14d51d880 fix(scrobbling): drop only the bad listens of a refused batch
When a service refused a batch of saved listens as malformed, the whole
batch left the queue. The shared pipeline now resends those listens one
per request, so only the ones refused on their own are dropped and the
rest reach the service. Each single request removes its listen or ends
the run, which leaves the remaining listens to the existing retry timer.
Last.fm, Libre.fm and ListenBrainz all get this.
2026-11-08 18:53:12 +07:00
zarzet 0078332984 feat(scrobbling): scrobble to Libre.fm and ListenBrainz
The Last.fm pipeline becomes a shared Scrobbler base: listening rules,
Now Playing, the durable per-account queue, retry and session expiry
live in lib/services/scrobbling, and each service only signs in and
talks to its API. Every enabled service counts the same listen and
keeps its own queue, store keys and retry timer, so one failing
service never blocks or duplicates another.

Libre.fm reuses the Last.fm 2.0 client and browser approval on its own
server, with its own account and queue. ListenBrainz signs in with the
user token from its settings page, checked with validate-token, and can
point at a compatible self-hosted server. Listens carry the album,
duration and, when tagged, the ISRC and track number.

Last.fm keeps its storage keys and saved format, so a connected account
and its queue carry over without signing in again. Playback settings
show Libre.fm and ListenBrainz next to Last.fm in both styles, and both
are searchable.
2026-11-08 16:27:34 +07:00
zarzet 1521620246 feat(autoplay): add a randomness setting and rotate suggestions
Autoplay now remembers which songs it played or suggested, across
restarts, as hashed fingerprints only (no paths, URLs or metadata),
so related songs rotate instead of repeating. A new Autoplay
randomness slider in Playback settings decides how strictly: at the
lowest value repeats return least recent first, higher values widen
the pool and reduce score bias. It works with or without
personalized autoplay, whose description now says that turning it
off stops only preference learning.
2026-11-07 20:12:16 +07:00
zarzet b379342d6f feat(lastfm): scrobble on Android and iOS
Last.fm was limited to desktop although its listening, queue and browser
approval do not depend on the platform. Playback settings, the settings
search and the player runtime now offer it on phones too, and the Android
and iOS release builds receive the Last.fm credentials.

Phones get a smoother connection. It finishes by itself when the app
comes back from the browser, and the waiting request is kept in secure
storage, so connecting still completes after the system ended the app
while the browser was open. Finish connecting remains the fallback.

The iOS session is readable after the first unlock, so playback that
starts the app in the background while the phone is locked still
scrobbles. Listening time is now counted with a timer only while a song
plays instead of every second while scrobbling is on.
2026-11-07 17:36:30 +07:00
zarzet f03c065b50 fix(webdav): verify upload content when listed sizes differ 2026-11-07 03:49:00 +07:00
zarzet b889dabbb4 feat(link): add computer library visibility toggle 2026-11-06 21:27:48 +07:00
zarzet 7ada9533d5 fix(lint): align Library test overrides and notifier APIs 2026-11-04 02:27:18 +07:00
zarzet ab7157aa0a perf(backend): migrate selected data jobs to Rust
Route file hashing, AI lyric reply parsing, cache statistics and Autoplay taste training through native workers. Preserve model persistence and isolated compatibility fallbacks, with native parity and full-route performance coverage.
2026-11-03 13:17:12 +07:00
zarzet cf82bcfbca fix(playback): support gapless exclusive output and guard metadata lifecycle 2026-11-02 20:26:56 +07:00
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 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 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 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 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 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 a5e8077419 fix(link): keep Android phones available in the background 2026-10-31 23:56:12 +07:00
zarzet 8366eb3b89 perf(network): end a search3 sync only on an empty song page
The Mornye search3 sync treated a page shorter than 500 songs as the
last one, so a desktop that ever capped pages lower would have synced
a truncated Library to the phone. The offset now advances by the
number of entries each page returned and only an empty page ends the
catalog, at the cost of one extra request per sync (5 instead of 4 for
the 1,200-song fixture, 1 album page and 4 song pages).

A non-empty page that brings no new id still fails the scan, so a
server that ignores songOffset cannot loop or publish a partial
Library. Video ids count as progress, so a last page holding only
videos ends normally.
2026-10-31 22:07:30 +07:00
zarzet 4d53d7f75c perf(network): revalidate stale Subsonic covers with their ETag
The daily cover check downloaded every stale Subsonic cover in full
and compared it with the cached file byte by byte, although the Link
desktop (and many servers) send an ETag and answer If-None-Match with
304. The first rescan of a day fetched all 500 album covers of a Link
library at original size.

The ETag of a downloaded cover is now kept beside it in
<cover>.etag together with the image length. A stale check sends
If-None-Match; a 304 keeps the path and touches the modification
time, like an unchanged download did, without reading a body. A 200
follows the existing rules (same bytes keep the path, changed bytes
get a new path behind .current) and stores the new ETag. A forced
refresh, a validator for other bytes, older caches and servers
without ETags behave as before.

The validator survives restarts. The Library cover prune (Dart and
Rust) keeps it with a referenced Subsonic cover, as it keeps the
.current pointer, and the song metadata cover cache still keeps 32
covers, each with its ETag, instead of counting ETags as covers.
Older builds ignore the files and their prune removes them.
2026-10-31 22:07:30 +07:00
zarzet 3c4639797b perf(network): sync a Mornye desktop through search3 song pages
A Link rescan walked the desktop album by album: getAlbumList2 pages
of 200, then one getAlbum per album, all serial, so 500 albums cost
503 round trips. Every response of a Mornye desktop says
type "mornye", and its search3 with an empty query pages every song
with the same song objects as getAlbum (contract section 4).

The first getAlbumList2 page now decides: a Mornye desktop is read
through search3 pages of 500 songs (the isVideo filter, id dedup,
500,000 cap and "pagination did not advance" guard are kept), any
other server keeps the album walk with the same requests as before.
search3 keeps no album's songs together, so the scanner remembers
the cover of every cover id of the scan (up to 20,000) instead of
the last 128, and still asks for each cover once.

Fixture library of 1,200 songs in 120 albums: 4 requests (one album
page and three song pages) instead of 121, the same Library rows,
and 160 cover requests for 160 cover ids in shuffled song order.
2026-10-31 22:07:30 +07:00
zarzet afaaa999ac perf(link): push the desktop catalog only when its songs changed
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.
2026-10-31 01:04:45 +07:00
zarzet d60e13dca3 fix(link): use a web cover copy only for songs without a picture
Every default download keeps an https cover address and also embeds its
cover, so round 1 copied the web cover of every download and the
catalog's coverPath then outranked the picture in the file. The owner
approved web covers only for songs with no other cover.

The exporter now reports each song without a local cover file but with a
public https cover (path, path+mtime+size stamp, address) and names a
copy only for a song whose file is known to embed no picture. The store
asks linkEmbeddedPictures about new file versions in batches of 64 on
the Rust worker pool, keeps the answers in pictures.json, keeps the
copies a song may still want, fetches only for songs known to embed
none, and announces a held copy a newly asked file can take.

Also from the review: the host stops the store only after the server
stopped, so an export finishing meanwhile fetches nothing; web cover
fetches take https only, refuse localhost and loopback, link-local and
private literals, check every redirect by hand and end after a minute;
once the store is full it fetches and retries nothing until a prune
frees space; a failed write removes its staged file. Phone covers keep
their fetch unchanged.
2026-10-30 19:41:42 +07:00
zarzet 48f8e85881 fix(link): serve desktop web-only covers from a lasting Link folder
A desktop download saved without embedded metadata has only an https
cover. The catalog left coverPath empty for it and the server answered
getCoverArt with 404, so the phone showed a placeholder while the
desktop showed the web cover.

LinkWebCovers keeps one copy per address in <app support>/link_web_covers
(<linkCoverUrlId(url)>.<ext>), fetched with the phone covers' fetch,
image check and staged write, now shared from link_web_covers.dart.
Each export lists the copies held and names them as coverPath; songs
with a local cover file and the desktop identity index are unchanged.
Once the server has loaded a catalog, the host removes the copies no
exported song wants and fetches the missing ones in the background,
4 at a time, with a byte cap and a timeout; failures wait 1 minute,
doubling up to 6 hours. New copies schedule an export, whose
catalog.changed makes phones rescan and fetch the cover.

A catalog only names files that exist, so Rust needs no change and an
album never prefers a copy that has not arrived. The listing an export
starts with waits for a queued removal, and removals run only after
setCatalog, so no file the server names is removed.
2026-10-30 19:41:42 +07:00
zarzet 08d524eba4 fix(covers): keep a Subsonic cover path while its image is unchanged
The daily check rewrote subsonic_<hash>.image in place when no .current
pointer existed, so decoded sizes and the home-screen widget key kept
showing the old image after the server changed it. A forced refresh went
the other way and moved even an unchanged image to a new path, which
dropped every decoded size and rewrote Library rows for nothing.

The fetched bytes are now compared with the published file: the same
image only updates the modification time and keeps its path, a changed
image always gets a new path behind the .current pointer.
2026-10-30 17:47:54 +07:00
zarzet 05a5d94834 fix(link): keep phone covers until the Library stops showing them
When a phone committed a new song list, the desktop deleted every stored
cover the new list did not name right away, before the rescan of the
phone's Library source had moved the rows off them. Songs whose cover
changed (a phone rescan changes every cover id) showed placeholders until
the rescan finished, and longer when the rescan waited behind another
scan.

A commit's removal now also keeps covers the phone source's Library rows
name (LinkPhoneLibrary.coverPaths, read from the library table) and skips
deleting anything when those rows cannot be read. It is queued right
behind the last page, so it runs after the commit reply and before
anything the phone sends next. A cover kept only for rows goes at a later
commit, or at the next GET phone/catalog (the start of a sync) when it is
older than the committed list; covers sent since that commit wait for the
commit they were sent for, so a sync that stopped halfway does not upload
them again. GET phone/covers waits for the removals queued before it, so
the phone never skips a cover that is deleted right after it was listed.
The other cover readers look up covers of committed songs, which no
removal takes away, so they answer at once and never wait behind a web
cover download. Web cover fetches stay a separate queued step. The 1 GiB
store limit and the cover ids are unchanged.
2026-10-30 07:42:07 +07:00
zarzet a73f63772d chore(deps): update Flutter, native and Rust dependencies 2026-10-30 01:29:33 +07:00
zarzet a940b07911 fix(link): recover discovery after network changes
Refresh discovery when interfaces change or the app returns to the foreground. Retry failed and unexpectedly stopped browsers with bounded backoff, and report Bonjour policy denial as a local network permission failure.

Validation: 82 related tests pass; targeted analyzer and formatting checks pass. Two Devices handoff tests also fail on the unchanged baseline.
2026-10-28 23:55:15 +07:00
zarzet c2db8ab4b6 feat(player): gapless playback
The next song used to load only after the current one ended, which
left a short silence between songs. With Gapless playback on (the
default), the player loads the next song on a second deck 30 seconds
before the end and starts it the moment the current one completes.

The decks gain setNextDeck. The Android fork links its players with
MediaPlayer.setNextMediaPlayer, so the platform starts the next song
itself; the Darwin fork resumes the linked player first thing in its
end-of-item handler, prerolled when linked. libmpv decks cannot hand
over their output, so on Windows and Linux the loaded deck starts on
the completion event.

AutoMix replaces gapless playback while on, and repeat one, USB
bit-perfect and exclusive output keep the ordinary transition. A queue,
shuffle, repeat or settings change, a pause, a stop or Previous drops
the prepared song; a seek keeps it. Playback settings gain the switch,
which the settings search finds as well.
2026-10-27 00:08:16 +07:00
zarzet 72d9b4c26d feat(link): run song transfers on the desktop
The desktop accepts transfers/offer from a phone and saves the offered
songs one transfer at a time into the download folder as Mornye Link
downloads, skipping songs it already has. It offers its own songs to a
phone, follows the phone's status, and fails a phone's transfers when it
disconnects.
2026-10-26 01:14:03 +07:00
zarzet b6f94ccef3 fix(link): sync playback modes and restore queue covers
Carry autoplay, AutoMix, repeat and shuffle across handoffs, synchronize active desktop preferences with the phone, and retain the queue order when adopting shuffle.

Recover visible queue artwork through the shared embedded-cover cache and protect phone uploads with background work leases.

Validation: 443 related tests passed; analyzer, formatting and diff checks passed.
2026-10-25 23:36:03 +07:00
zarzet 2b33e607b2 feat(link): show a paired phone's songs in the desktop's Library
The desktop keeps each paired phone's song list and covers from the
phone/catalog and phone/covers ops under link_phones/<sourceId>, adds
the phone's network:// Library source once after a commit and rescans
it, and removes both when the phone is unpaired. Scans leave out songs
the desktop already has. A phone song plays from its received file, or
asks the connected phone with files.request and streams the upload once
files.sending arrives; tag reads wait for it, else answer the stored
fields.
2026-10-25 16:58:21 +07:00
zarzet ac31cd1d64 fix(link): keep a phone's song list until its Library changes
The phone keeps the last list it built with the Library revision it came
from (downloads and Library index versions, the Local Library switch). A
new connection reuses it and only compares versions with the desktop; the
list is built again only after the revision changes. A file request for a
name the list lacks still builds again once per change.

Scanned songs are dated by the file's modification time, since a full
rescan stamps every row with a new scan time, so a rescan of unchanged
files keeps the list's version. Covers are read and encoded in an isolate,
one request at a time, within the 1 MiB and 4 MiB limits.
2026-10-25 16:58:21 +07:00
zarzet bb7762952d feat(link): build the list of a phone's songs for the desktop
Pages the Library Songs rows the phone shows and keeps local files and
content URIs in a format the desktop takes, with the file ids Play on
desktop gives the same files. Builds the list's version, the file behind
each song for later uploads, and the covers of at most 1 MiB. Rows are
mapped off the UI isolate a page at a time.
2026-10-25 16:58:21 +07:00
zarzet 8e7d792c29 feat(playback): exclusive output on Windows, macOS and Linux
Add a desktop "exclusive output" option that takes the output device for
the music player alone, bypassing the system mixer. It always plays
through libmpv:

- Windows: WASAPI exclusive mode, with ao-reload when the option changes
  mid-track.
- macOS: AVPlayer cannot play while the app holds Core Audio hog mode, so
  macOS bundles libmpv (media_kit_libs_macos_audio, through CocoaPods)
  and ExclusiveOutputDeck moves the player from AVPlayer to a libmpv deck
  with audio-exclusive while the option is on, reopening a playing track
  where it was. Turning it off disposes that deck, releasing the device.
- Linux: an ALSA hw: device opened directly, chosen from /proc/asound or
  the first card.

A refused or busy device reopens the track in shared mode at the same
position and the settings page reports it. AutoMix and previews stay off
while the option is on.
2026-10-25 15:45:49 +07:00
zarzet d41731fb69 fix(link): keep the notification on the desktop's song in the background
The phone closed its session with the desktop in the background, so
Next and Previous from the notification reached the desktop but the
song it moved to never came back, and the notification kept the old
one (Pause looked right only because it is shown before the desktop
answers). The session now stays connected in the background while the
desktop plays in the phone's place.
2026-10-25 14:13:37 +07:00
zarzet 12f04d239e feat(network): show lyrics for songs on a Subsonic server
Songs from a Subsonic server, which includes a paired desktop, read
their tags from getSong, which carries no lyrics, so the player offered
an online search even when the file had lyrics. The tag read now also
asks getLyricsBySongId and keeps the stored text a Mornye desktop sends,
else rebuilds LRC from the synced lines. Servers without the extension
keep working as before.
2026-10-25 14:05:49 +07:00
zarzet 74188a5c98 fix(player): play the song again when Android's media server dies
Android restarts its media server shortly after it dies, which failed
the playing song with MEDIA_ERROR_SERVER_DIED until Play was pressed
once or twice. The player now reloads the song where it was, up to two
times half a second apart, before reporting the failure.
2026-10-25 13:46:57 +07:00
zarzet 931386dfe6 fix(link): keep playback usable while the desktop is out of reach
A failed connection attempt now moves playback back to the phone, so
songs picked meanwhile no longer wait for a desktop that cannot answer.

A new song abandons a source still preparing on the phone's player
instead of queueing behind the plugin's 30 second prepare timeout, so a
local song plays at once after a network song that hangs.

While the session cannot reach the desktop its Library songs check the
server with a short connect before playing and fail within seconds
instead of waiting the 20 second network timeout.
2026-10-25 13:02:11 +07:00
zarzet b4b66fcca3 feat(link): start a phone-only song on the desktop while it uploads
Play on desktop no longer waits for the whole file. The phone posts
handoff/play once the bytes up to the resume point and a 512 KiB margin
are sent (all of them for an MP4 whose index follows the audio), naming
the upload in `arriving`; the rest uploads in the background, and later
songs wait for it.

The desktop serves an arriving file over loopback HTTP with Range
support, reading the part file as it grows, and the player opens that
URL through MusicPlayerRuntime.streamWhileArriving until the file is
whole. The queue entry keeps the final path, and the embedded cover is
read once the file lands. On Windows the Rust rename into place is
retried briefly, since an open reader blocks it.
2026-10-25 06:20:59 +07:00