Commit Graph
1060 Commits
Author SHA1 Message Date
zarzet 7b266ba2e4 feat(downloads): save the album cover as folder.jpg in the album folder
Portable players often do not read the cover inside a song and look for a
folder.jpg beside it. A new Files setting, Save Album Covers (off by
default), saves the cover a download carries into the album's own folder,
with a size choice from the sizes of Embedded Cover Size. The rule of the
animated cover applies: only folders that hold one album get the file, and
one already there stays. A PNG cover is saved as folder.png; other image
formats are not saved.

The folder writing of the animated cover moved to SongFolderFile, which
both covers use for local folders, Android documents and network storage.

While the setting is on, Remove Empty Folders counts folder.jpg and
folder.png as leftovers of a deleted album. While it is off they keep
their folder, as before.

Issue #913
2026-11-17 11:55:17 +07:00
zarzet 4856f1ee0a fix(covers): read a song's cover again after a failed read when it is played
A failed read of an embedded cover was remembered for the whole run for
plain files, so a song read once before the desktop backend had started
showed no cover until the app was restarted. Playing or opening the
song now asks again after 30 seconds; lists still skip a failed file, so
files without a cover are not read at every scroll.
2026-11-17 11:40:08 +07:00
zarzet d6f8ffbb9c fix(link): keep Play together through the follower's song end
The state of a song that ran out still carries the last position read
while it played, which can lie well before the listed length. A phone
that followed then took its own move to the next song for one picked by
hand and ended the session (seen on a real run with the computer
leading). The report now places a finished song at its end, and a phone
that ran out of its song is no longer logged as paused by itself.
2026-11-17 09:40:22 +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 edd8666fe3 feat(link): show Play together in the computer's Devices
The computer gave no sign that it played together with a phone, and its
Devices sheet still offered the usual choices, which would have moved
the queue under a running session.

While a session runs, the sheet shows a checked Play together row naming
the phone, no device is checked, and choosing this computer or that
phone ends the session there: the computer tells the phone, which stops
the device that was not chosen. This works whichever device owns the
queue. The player bar's Devices button names Play together and, in the
Material style, draws primary.

The row opens and closes with the reveal the phone's timing group uses,
now one widget. With reduced motion it no longer runs a size animation
of no length, which failed inside its own layout.
2026-11-17 09:40:22 +07:00
zarzet 846792c436 fix(link): keep the phone's volume its own while playing together
While the computer owns the queue in Play together, the phone's screens
and media session show the computer, so the volume keys and the player's
volume slider set the computer's volume although the phone sounds too.
Both now set the phone's own volume for as long as the two play together
and return to the computer afterwards.
2026-11-17 09:40:22 +07:00
zarzet cf68a7d943 fix(home): do not offer a scanned song to continue while Local Library is off
Continue listening showed the saved session whatever it held, so a song on
a NAS stayed on Home, and played from the NAS, after Local Library was
switched off. The saved session is now left out while it is on a song of
the scanned Library and that Library is off, as Recently Played and the
mixes already do. Downloads and songs the Library does not know stay.
2026-11-17 08:50:36 +07:00
zarzet e18efec8f5 fix(link): log a Play together check every few seconds, not each one
Three check lines a second filled the 500 entry log within three
minutes and pushed everything else out of it. A line is written once a
second while a nudge runs or the players settle, and every five seconds
otherwise.
2026-11-17 05:10:57 +07:00
zarzet 276f91bfb7 fix(link): plan Play together nudges with what rate changes cost
The computer lost about 24 ms on every AVPlayer rate change, so a nudge
for 49 ms ended near 48 ms again and the aligner nudged every 4 s for
the whole session. The aligner now measures what each nudge's two rate
changes cost and plans the next one with it, lets a nudge run its course
(replanned once from a settled check, at the same rate), ignores checks
for 1 s after a rate change, and leaves errors inside the band alone
where the cost is larger than the band. When planned nudges keep
missing, it holds: no nudge until the drift passes 80 ms.

After a cue the lead now takes the whole settled offset, from two checks
that agree, instead of 60 % of the first one.

Each check logs the follower's reported and expected position, drift,
rate and nudge state at debug level, and each nudge's end logs the drift
before, expected and measured at info level.
2026-11-17 04:37:14 +07:00
zarzet 35de9e7ca4 fix(link): say whether the computer leads or follows in the start log 2026-11-17 04:37:14 +07:00
zarzet 5162ddec78 fix(link): keep a Play together nudge running without a rate change
A nudge at the rate already in force only moves its end, and one nudge
rate goes straight to the other. Each rate change costs some engines
time, so going through 1 in between cost it twice.
2026-11-17 04:37:14 +07:00
zarzet 722566c109 fix(link): extrapolate a Play together report at the rate in force
A report now carries the player's rate, so a nudged follower's position
is advanced at 1.02 or 0.98 rather than at 1 between its reading and the
check. A device that does not send it is read at 1, as before.
2026-11-17 04:37:14 +07:00
zarzet 8c7373032f fix(player): start a song loaded paused where it was put
A paused load leaves audioplayers and media3 decks reporting stopped, so
the next play loaded the song again from the start. Play together's first
cue on the computer began near 0 instead of the cue position. Remember a
source held paused, report it ready, and resume it on play.
2026-11-17 04:37:14 +07:00
zarzet 7a3bc64391 fix(link): do not keep a song this phone already has from elsewhere
A kept playlist only knew the copies it had saved from the same device.
With a second device sharing the same songs, every one was copied again
beside the first copy. A download of the same song, or a copy saved
from another device, now counts as kept while its file exists.
2026-11-17 03:09:30 +07:00
zarzet bba6272445 fix(library): match a track to this device's file before a remote one
When a track had both a file on this device and the same song on
network storage or a Link device, the lookup that playlists and
playback use took whichever row came first in the table. The file on
this device answers first now, so it plays without the network.
2026-11-17 03:09:29 +07:00
zarzet da46092634 feat(link): share a phone's storage access songs with other phones
The catalog now takes a phone's Android storage access documents from
their Library rows without opening them, so browsing, streaming, covers
and copying reach every song of its own the app can play. A phone host
lends each one to its Link server through the playback descriptor lease
and returns it when the server closes it, also when the close arrives
during the open, and returns every lease once the server stops. Network
storage and Link devices' songs stay out.
2026-11-17 03:09:29 +07:00
zarzet f75f8d3e15 fix(link): do not report a dropped handshake as a changed certificate
A host that stops while a phone is connecting ends the TLS handshake
without presenting a certificate. Every TLS failure was reported as the
host showing another certificate, so the phone warned that the device
was not verified and offered to pair again. Only a refused certificate
is reported that way now; a handshake that broke off counts as a host
that cannot be reached.
2026-11-17 03:09:29 +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 9b17fd2c61 feat(link): offer only what the Link host announces
Hosts announce their platform and optional features (downloads, opening
links, file changes). The phone remembers them and hides the actions a
host lacks, and shows a phone icon for a phone host. Older hosts that
announce nothing keep every action.
2026-11-17 03:09:29 +07:00
zarzet ed5ae32067 feat(link): Play together in the Devices sheet
A Beta entry next to the two devices starts it; choosing one device ends it there. The controller shares the queue, starts the session, keeps the connection, ends quietly when it drops, and remembers a phone timing shift per paired computer, set with a slider shown while it runs.
2026-11-17 03:09:18 +07:00
zarzet 6acc001fe5 feat(link): Play together coordinator and computer host
The phone measures the clock offset, mirrors the leader's song, play state and position to the follower, and corrects drift. The computer answers the together ops, follows cues and reports its own pause, play, skip or a new queue. A simulated room with two players tests start, ten minutes of drift, transport, gapless song ends, a missing song, the timing shift and a lost connection.
2026-11-17 03:09:17 +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 c42c62c011 feat(link): start a queue paused and override settings for a session
setQueueAndPlay takes startPaused so a waiting queue loads without a sound, prepareQueueItem loads an entry without starting it, and the runtime can apply a settings override that is never saved. Play together needs all three.
2026-11-17 03:09:17 +07:00
zarzet c4b7b57457 feat(link): sync song lyric offsets with the sound settings
Song offsets travel as a new songLyricOffset item kind of the sound
settings exchange while Sync sound settings is on. The newest edit wins
per song, dated by when it was set rather than when a sync noticed it,
and a song put back in sync is a tombstone. Both devices keep every
song's offset whether or not they have the song.
2026-11-17 03:09:17 +07:00
zarzet d3adcb9739 feat(lyrics): add a lyric timing offset per song
The offset of a song's synced lyrics is now the app-wide offset plus the
song's own. The player's lyrics menu opens a Lyrics timing sheet with
This song above All songs; the settings page keeps only the app-wide one.

Songs are keyed by title and artist, as Library, History and Link match a
song across devices, and a song in sync stores nothing. Every timed reader
uses the sum: the player lyrics in both styles, the lyric line preview,
the desktop mini player, lock screen lyrics, sharing and the mirrored
player.
2026-11-17 03:09:17 +07:00
zarzet e64b36abf1 feat(link): sync saved sound settings between phone and computer
Equalizer presets the user made, the volume normalization level and
mode, and the shape of AutoMix transitions travel both ways over one
forwarded operation, POST /mornye/v1/preferences: the phone sends every
item it holds, the computer merges them and answers with every item it
holds. Last writer wins per item and deleted presets stay as tombstones,
so two devices editing different presets both keep their edits and a
deleted preset does not come back. The computer sends
preferences.changed when its side changed.

The phone syncs on connect, after a local edit and on that notice, only
while its sound sync choice is on. Live state (the curve playing now,
on/off switches, volume, speed) and device-specific values (the lyric
timing offset, outputs) stay on each device.
2026-11-17 03:09:17 +07:00
zarzet 4df0c40842 feat(link): save kept collections to the phone by themselves
A playlist or Loved marked as kept on this phone has its songs from the
paired computer saved here through the existing saver and Transfers when
the computer connects, when a kept collection gains or loses a song and
when a collection is newly kept. Runs are debounced and one runs at a
time; only songs the saver does not already have are queued, nothing is
deleted, and failed songs wait for the next connection or change. The
marks live in SharedPreferences on this phone only.

The receiver's save takes an onFinished callback with the last status,
and the saver exposes its already-there check as has().
2026-11-17 03:09:17 +07:00
zarzet 65147280eb feat(library): show all songs of an artist beside their albums
A Library artist now has an Albums | Songs switch. Songs lists every song
of the artist by title, with Play, Shuffle and Save as playlist: the songs
of the artist's albums and the songs whose artist tag names the artist
beside others. The view chosen last is the one the next artist opens on.

The Albums | Singles switch moves into a shared LibraryViewToggle, and the
genre song reader into library_song_reads so both lists use one query.
2026-11-17 02:35:33 +07:00
zarzet 7aa2f37496 chore: remove comments that restate the code
One-line doc comments and inline comments that only repeat the name, the
type or the next statement of what they describe, in the Dart, Kotlin and
desktop runner sources. Comments that state a reason, a constraint, a
unit, a value set or a platform quirk stay. No code changes.
2026-11-17 02:06:37 +07:00
zarzet 45d4c2d411 chore: remove redundant comments and unused import 2026-11-17 02:05:45 +07:00
zarzet da728c526a fix(covers): bring covers back after the app cache is cleared
Clearing the app cache deletes the previews of embedded covers, but the
pages still open under Storage & Cache kept the deleted files' paths.
Recently downloaded songs, Library tiles, the downloads list and a
downloaded album showed an empty cover until the app was restarted,
while the player, which reads covers another way, still had them.

The resolver now announces a clear once the last file is gone, and the
widgets that keep a resolved path resolve again, which reads the cover
from the song as on a first launch.
2026-11-16 23:42:25 +07:00
zarzet 10fba64155 fix(discord): bring presence back after the activity or the connection is lost
On Android the SDK binds to the Discord app through the activity it was
given. Android releases that connection when the activity is destroyed,
while the plugin lives on with the shared Flutter engine, so presence
stayed gone until the option was switched off and on again.

- A new activity gets a new client, and the current song is sent again.
- An update that stays unanswered for 20 seconds counts as failed, and a
  client whose update failed is replaced before the next attempt (at
  most every two minutes, only while the Discord app is installed).
- Presence that was switched on while no activity existed starts when
  one appears.
- iOS: a token refresh that could not reach Discord keeps the account
  linked and is repeated instead of asking for the link again.
2026-11-16 23:38:59 +07:00
zarzet 967a2d6f6f fix(media3): decode as float only what holds more than 16 bits
With float output on, media3 asks every decoder for float samples, the
phone vendor's MP3 and AAC decoders included. No other player on the
phone asks for that, so a decoder that handles the request badly shows
only in this engine; testers on Samsung phones report noise and trouble
playing with it on. Float keeps the low bits of 24 and 32-bit files and
adds nothing to the rest.

Lossy songs and files of 16 bits or fewer are now decoded as 16-bit PCM,
as every other player decodes them. A lossless file of more than 16 bits
or of unknown depth keeps float. A decoder is not reused between the two.

The engine also sends the decoder that ran, the output it opened and the
first times that output ran dry to the app log, so a log export from an
affected phone shows what its audio stack did. No path or title is
logged.
2026-11-16 23:06:50 +07:00
zarzet a01e964f46 feat(player): shuffle the Library when play arrives with nothing queued
A play request from a car, a headset button or the system did nothing
when no queue was saved, as for someone who has not played a song yet.
It now brings back the saved session first and otherwise plays the
Library shuffled, which a spoken request without words already did.
2026-11-16 22:49:53 +07:00
zarzet 95484386cc fix(android-auto): show the covers of scanned albums and artists
The car's album and artist lists read only cover_url, which the Library
query fills for downloaded songs. Scanned albums and artists answer
with cover_path, so they came without artwork. Both are read now, the
cover file first.

The test rows put every cover under cover_url, which hid it; they now
have the shape the query answers.
2026-11-16 21:31:23 +07:00
zarzet d7ac319fce fix(android-auto): find covers stored under the app folder's other path
Browse lists and queue items reached a car without artwork. Android
gives the app's files as /data/user/0/<package>, a link to
/data/data/<package>. The cover provider named its folders by the
first, scanned Library covers are stored under the second, and both
sides compared the two as text, so no cover file was ever found in a
served folder and no content URI was handed out. The provider itself
served the files.

Each folder now knows its path without symbolic links as well. Kotlin
uses both for queue items, and reports them to Dart as aliases for
browse items.
2026-11-16 21:27:18 +07:00
zarzet 7456bdf1d4 fix(cue): file split songs under the folder of the song they came from
Like a conversion, a CUE split started from a Library list had only the
default folder to file its songs under. Where that folder is no longer
present the split songs stayed hidden and the album kept showing its
CUE entries, as if nothing had been split.

The split now names the song it started from, and its outputs join the
folder that song is stored in.
2026-11-16 18:56:32 +07:00
zarzet a31f13eace fix(convert): file a converted song under its original's library folder
A song opened from a Library list does not carry the folder it belongs
to, so its converted file was stored under the default folder. Where
that folder is no longer present the converted song was hidden: with
Keep original file the new copy never appeared, and without it the song
left the Library until the next scan.

Take the folder from the stored row of the original instead.
2026-11-16 18:53:11 +07:00
zarzet d2669d13c4 feat(convert): choose the resampler quality with a slider
A lossless conversion that changes the sample rate could only pick SWR
or SoXR, each at one fixed setting. Add a quality slider under the
resampler choice, moved by dragging or by a tap anywhere on its track,
with the level named beside it and what it uses below.

SWR offers Fast, Medium, High, Very high and Best (16, 32, 64, 128 and
256 filter taps; the two highest also raise the Kaiser window's
rejection). SoXR offers Medium, High, Very high and Best (16, 20, 28 and
33 bits of precision; 20 and 28 are SoX's HQ and VHQ recipes).

The defaults are what a conversion used before: the library's own SWR
filter (Medium) and the most SoXR offers (Best). A conversion sent to a
paired computer carries the level; one from an older phone gets the
default.
2026-11-16 18:38:13 +07:00
zarzet af2198504b Merge branch 'feat/authenticity-report'
# Conflicts:
#	lib/widgets/material_player_backdrop.dart
2026-11-16 18:09:51 +07:00
zarzet ede25f8409 feat(authenticity): find MP3 sources at any bitrate with the exact filterbank
The scan for an MP3 source approximated the layer 3 filterbank with one
plain lapped transform, which shows the frame grid at 128 kbps and little
above it: on the test set it found 44 of 51 files at 128 kbps, 16 at
192 kbps and none at 320 kbps or V0.

The audio is now analysed with the filterbank the format defines (the
512-tap window into 32 subbands, the 36-point transform per subband and the
alias butterflies) at all 576 granule alignments. At the encoder's own
alignment the coefficients are the stored spectrum again, which shows in
two ways: their sizes sit on the lattice the format quantizes to, and lines
that are loud everywhere else are zero. Both must peak at the same
alignment for a source to count as found. Excerpts with clipped samples
are avoided, since one clipped sample spoils the granules around it.

On 255 decodes of MP3 at 128, 192 and 320 kbps, V2 and V0 all are found,
and none of 317 originals and AAC or Opus decodes is taken for MP3. Other
decoders, mono, a gain, dither, a trimmed start and 24-bit output keep it
found; audio resampled after decoding does not, and the report says so.

The report now carries the score a pattern of the measured kind counts as
found from, so the page shows the right limit for each codec.
2026-11-16 18:01:39 +07:00
zarzet b5e1117f2c feat(library): list a multi-value genre tag under each of its genres
A tag such as "Rock; Pop" was one genre of its own. Split a tag on
semicolons, commas, the NUL between ID3v2.4 values and the user's own
genre separator, the list rule the tag writer already follows. Slashes
and ampersands stay inside a genre, so "Hip-Hop/Rap" and "R&B" remain
one each.

A genre now counts and lists the songs of every tag that names it. The
song query takes those tags instead of a single one.
2026-11-16 18:00:11 +07:00
zarzet c163b8858e fix(cast): serve the TV from an address on its own network
The media server asked the OS which local address routes to the TV.
Android routes each app through an active VPN, and through mobile data
when Wi-Fi is not the default network, so the TV was handed an address
it could not reach: it connected, showed the Cast screen and never
played, ending in Google Cast timeout 15 or the app's own 25 second
limit.

Pick the interface address whose network holds the TV and fall back to
the route only when there is none. Rebind when this device's address
changed, say what to check when the TV cannot reach the device, and let
the platform's answer arrive before the app's own limit on a load.
2026-11-16 17:41:55 +07:00
zarzet 85c3159e60 feat(library): read the Library's genres in one grouped query
Browsing by genre needs each genre's song count and a cover without
loading the whole Library on the UI isolate. One query groups both
sources by sort_genre (the trimmed, case-folded tag) and the stored
spelling; Dart then merges spellings under the most common one.

The Songs query gains a genre filter, so a genre's songs come from
the same paged, shadow-aware read as the Songs list and use the
existing sort_genre indexes.
2026-11-16 17:09:18 +07:00
zarzet 92984839d9 perf(player): open an Android song before looking for a moved download
Every Android song start first asked the document provider whether a
content:// song still existed, to look for a moved download, and then
opened it for playback, which proves the same. Both calls were serial on
the start path.

A content:// song now opens its playback lease first. Only when the lease
cannot be opened does the moved download lookup run, with its own
existence check as before, and a relocated song opens its lease at the
new place. File paths, cast playback and network songs keep the old order.
2026-11-16 16:17:06 +07:00
zarzet 064f02b5de perf(player): list an Android song's folder once for its sidecars and cover
Starting a song from a granted Android folder looked for the .mlrc file,
the .lrc file and cover.mp4 with three separate native calls, each
resolving the song's parent again and listing the whole folder to find one
name. Big flat folders paid that three times on every song start.

One native call now resolves the parent once, reads the song's name once
and finds every wanted name in a single listing, returning uri, size and
modification time for each file that exists. A small Dart lookup shares
that answer between the lyrics sidecar reads and the motion cover lookup
for a few seconds, so one song start lists the folder once while a later
start of the same song asks again. Writing a sidecar or a tag change of
the song forgets the shared answer. Sidecar contents are read by document
uri only for files that exist, with the same 8 MB cap. Name rules are
unchanged and now live in a pure helper with JVM tests.
2026-11-16 16:17:06 +07:00
zarzet 05ac2ee2ad fix(library): let Refresh read songs flagged without lyrics again
Refresh clears the lyrics cache so the user can recover from wrong data.
With the no-lyrics skip, a song whose scan flag says "no lyrics" but whose
file has them stayed unsearchable after Refresh. The pass that follows a
clear now reads every song, skipping nothing on the flag, until a pass
completes; a cancelled pass keeps the full read pending. The state is in
memory only, so no schema change.
2026-11-16 16:09:44 +07:00
zarzet 79bb3d0cda perf(library): page the lyrics index per source and skip known lyric-less songs
Each 32-song batch sorted the union of History and Library by (source, id)
behind an OR keyset. EXPLAIN QUERY PLAN on the real schema showed a full
SCAN of history plus a scan of the Library view with a temp B-tree sort, so
every batch probed every remaining song again. Paging each source by its
own primary key turns both arms into SEARCH ... (id>?) without a sort.

Songs whose tags a scan read without embedded lyrics (Library has_lyrics 0
with a lyrics-aware scan version, History has_lyrics 0 with a lyrics probe)
are stored as empty without a native read; the reader returns only embedded
lyrics, the same thing the flag describes. Rows with an unknown scan version
are still read. Edits now leave the cache row as an edit mark (empty version
and text) instead of deleting it, so an edited song is read again even when
its flag is stale until the next scan. Older builds treat the mark as a stale
row and re-read it.

Progress now carries a revision that changes at most once per second while
indexing and at the end of a pass that saved lyrics, for the search refresh.
The store test fixture also gains the History columns the shadow check and
the skip read; it failed on main because origin_file_path was missing.
2026-11-16 16:09:44 +07:00
zarzet 6431236615 refactor(services): remove unused folder and taste helpers
libraryFolderTracks and trainAutoplayTasteDartInBackground had no
caller in lib or test. The doc comment of audioCompareMeasureWindows
said the engine used it on excerpts, but the engine measures windows
with FFmpeg; only tests call it, as the reference for that pass.
2026-11-16 16:03:33 +07:00
zarzet 06352409c9 perf(scrobbling): wake only when a listen counts or a retry is due
Each connected scrobbler ran a 1 s ticker during playback only to add
elapsed time, and a 30 s retry timer for as long as it was enabled, even
with nothing queued. With three services that is three wake-ups a
second while playing and three every 30 s for the app's lifetime.

The listening time is still measured from the same clock marks, so the
rule is unchanged (half the song, at most four minutes, scaled by
playback speed). Instead of ticking, the scrobbler now arms one timer for
the moment the playing song reaches that threshold, re-armed on every
playback or item update. The 30 s periodic retry exists only while
listens of the signed-in account wait in the queue, and stops when the
queue empties.
2026-11-16 15:57:17 +07:00