A library keeps none of the options the dialog posted, including its watch #167
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A library made through the wizard or the dashboard keeps its name and its
paths. Every other option the dialog posted is dropped, and there is no route
that can put one back.
crates/ephyra-http/src/routes/library/structure/editing.rs::addreadsPathInfosoff the postedLibraryOptionsand hardcodes the seven flags thatfollow it —
fetch_metadata,measure_loudness,extract_chapter_images,extract_trickplay_images,save_trickplay_with_media,extract_images,monitor.::options, which isPOST /Library/VirtualFolders/LibraryOptionsand the only way a client edits an existing library, keeps the paths and
returns
204for the rest. All seven are read by the server, so all seven arereachable by hand-editing
config.tomland by nothing else.The comment there is right about the defaults and wrong about what arrives.
LibraryOptions.EnableRealtimeMonitoris an auto-property with no initialiser,so an options object built in code has it off — but the pinned bundle's library
dialog spells the checkbox
checked="checked", so every library created throughthe UI posts
EnableRealtimeMonitor: true. Upstream stores what arrived:LibraryManager.AddVirtualFolderends inCollectionFolder.SaveLibraryOptions(virtualFolderPath, options).What it costs, on a library that changes underneath the server. A film was
replaced on the share between the scan and the playback — same directory, a
different release, so a different file name. The row still names the old file:
ffmpeg exits, the segment request answers
500, and nothing notices, becausethe library the wizard made is watched by nobody — so the row stays wrong until
the twelve-hourly scan comes round. The watch itself is written and working
(
LibraryConfig::monitor,watch_librariesincrates/ephyra-server/src/serve.rs);it is only ever off because the route that creates a library says so.
Where to start
addis the one that matters: take the flags off the posted options instead ofspelling them, and keep upstream's defaults for a request that posts none.
optionsis the same change on the editing side, and without it a librarycannot be corrected from the dashboard.
Where an option's behaviour is not ported, storing what was asked for and doing
nothing is still better than reporting a checkbox nobody kept — but the five
that are read should be honoured.
How to know it is done
A library created through the wizard with realtime monitoring ticked has
monitor = trueinconfig.toml, and a file replaced under it is noticedwithout a scheduled scan. Unticking it in the dashboard turns it off. A test
that posts options and reads the configuration back, failing today.
House rules
CLAUDE.mdis the short version and these are the parts that bite: tests rununder
cargo nextest; upstream's source is the checkout inupstream/at thepin; generated files are regenerated rather than edited; a comment says what
the code does, not how it got there.
A test that cannot fail is worse than none.
Landed in
7cd13b3, with a review fix in9f43537.addtakes all seven flags off the posted options instead of spelling them, andkeeps upstream's defaults for a request that posts none — every flag off, the
image extractors on.
optionsis the same change on the editing side, so alibrary can be corrected from the dashboard;
coveringbecame one case ofamendinga library rather than the only way to touch one.Two of the seven have no boolean in
LibraryOptionsand are read off the postedtype options instead:
extract_images— the three in-box extractors are image fetchers like anyother, and unticking them all is how a library says it wants no picture taken
out of a file. One setting for every type here, so a library that keeps an
extractor for one type keeps it for all of them; the narrower choice the
dialog can express is not one this server can honour, and the comment says so.
fetch_metadata— this was mapped fromEnableInternetProvidersand thereview caught it. Upstream marks that field
[Obsolete("Disable remote providers in TypeOptions instead")]and reads it nowhere, and the pinnedbundle posts it as a literal
true(
EnableInternetProviders:!0in the bundle). So unticking every downloader inthe dashboard would have left the library still asking TMDb, with no request
that could turn it off. It comes off the posted
MetadataFetchersnow.The realtime watch works out of this: a library created through the wizard has
monitor = trueinconfig.toml, and unticking it in the dashboard turns itoff. Tests over both, each checked against the mutation it exists to catch.
Reported again: a library still could not be set to monitored from the dashboard.
The write half landed here and works —
addandoptionsboth keep all sevenflags. What was missing is the half a dialog reads.
GET /Library/VirtualFoldersanswered:
— the paths filled and every other field left at the DTO's default, whatever the
library was configured with. The bundle sets each checkbox from that object
(
.chkEnableRealtimeMonitor.checked = t.EnableRealtimeMonitor), so the dialogopened with the watch unticked however it had been saved, and
getLibraryOptionsposted that blank straight back over the configuration on the next save.
Fixed in
46931ff: the seven flags are read back out ofLibraryConfig, and thesettings this server does not keep answer upstream's own constructor rather than
false. The round trip — save, reopen, save again untouched — is a test.