Repository navigation
Add a USB drive photo source for the slideshow - #52
Open
lennartschoch wants to merge 4 commits into
Open
lennartschoch wants to merge 4 commits into
lennartschoch wants to merge 4 commits into
Conversation
Background gains a Photo source choice: the bundled Gallery or a USB drive. When a drive is mounted, CleanFrame reads a CleanFrame folder of JPEG, PNG, WebP and BMP pictures (falling back to Photos, then the drive root), and the existing Rotation interval steps through them. Device details stay in the adapter: usbPhotos lists mounted external storage, filters and orders entries, and resolves file URIs; watchStorage subscribes to storage-state changes so an insertion or removal refreshes the slideshow without a restart. USB pictures have no pre-rendered surfaces, so the sheet and material layers reuse the photo with one CSS blur applied when the slide changes. Preferences save photoSrc and usbAt in a version 3 record; older records keep their wallpaper, rotation and app order and start on Gallery. A missing drive keeps the USB choice and shows the selected gallery wallpaper, and reports what it found.
A USB advance now reloads by comparing the next slide with the one on screen, so List + Type layouts and drive removal update the stage. usbAt wraps at use, so "Each time Home opens" advances the USB source before the drive is read and pulling a drive keeps the position. Scan results reconcile the stage while Settings is open, start-up waits briefly for the drive instead of flashing a gallery photo, the wallpaper picker previews gallery photos, and rotation steps over an unreadable picture instead of retrying it. USB surfaces are drawn once per slide into a small canvas and upscaled, replacing six live CSS blurs that re-ran on focus movement. The adapter drops filesystem.write and the non-standard listDirectory filter, tries further drives, and names a drive without pictures. The source choice uses the generic choice actions, and the stored record keeps src and usbAt in look without top-level aliases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The USB source now reads just CleanFrame/ at the top of each mounted drive, dropping the Photos and drive-root fallbacks, and the status text names that folder. Photo source describes each choice and notes how to prepare a drive; the Background row points Gallery users to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tizen 5.5 refuses addStorageStateChangeListener to a locally signed app with SecurityError: Permission denied, with or without externalstorage declared; listStorages, listDirectory and toURI all work with filesystem.read alone. Declare the documented privilege so a TV that grants it reacts to insertion and removal without a re-read, and state in the behaviour notes which re-reads remain on a set that does not. Verified on the reference UE50TU8505UXXC: FAT32 stick mounted at /opt/media/USBDriveA1, reported as removable_sda1, twelve 1.5-4.1 MB JPEGs painted as USB slides, web process 104 MB -> 227 MB resident while a full-resolution picture was on screen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does from the sofa
Settings → Background gains a Photo source row: Gallery (the bundled catalogue) or USB drive. With a USB stick inserted, the slideshow shows the JPEG, PNG, WebP and BMP pictures in a
CleanFrame/folder at the root of the drive, and the Settings page reports how many pictures were found and from which drive. Nothing else on the drive is read. Rotation, soft/frost/tint surfaces, tone and veil rules work on USB pictures exactly as they do on gallery wallpapers, and the soft surfaces are drawn once per slide into a small canvas so no CSS filter runs while you navigate.How it works
device.jsenumerates mounted external storage withtizen.filesystem.listStoragesand, in stable label order, reads each drive'sCleanFrame/folder withlistDirectoryuntil one holds pictures (240-picture limit), resolving each file withtoURI.filesystem.readplusexternalstorage. On Tizen 5.5,addStorageStateChangeListeneris refused withfilesystem.readalone; declaringexternalstoragekeeps that avenue open.slideOf(look)is the single place that turns a look into the gallery or USB picture on screen.usbAtwraps at use, so an "Each time Home opens" advance before the drive is read stays valid.src/usbAtkeeps its wallpaper, rotation and app order and starts on the Gallery source.Checks run
npm run check(ES5 lint, package checks, 16 synthetic device-adapter tests)npm run check:tools(15 tool tests)CLEANFRAME_PUBLIC_FONTS=1 npm run check:browser— 448 checks, 0 failures, including the new USB coverage against a synthetic Tizen filesystem: drive scan, CleanFrame-only reads with fallback to the next drive, extension filtering and ordering, rotation in Dock and List + Type, "Each time Home opens", skipping an unreadable picture, gallery picker preview, drive removal and reinsertionnpm run check:public.local/qa/per the testing docs; they show no private fonts.Device results and limits
docs/tv-status.md): a FAT32 stick mounted at/opt/media/USBDriveA1by the stock stack, reported asremovable_sda1(EXTERNAL, MOUNTED), plain directory names fromlistDirectory; twelve 1.5–4.1 MB JPEGs painted as USB slides with the owner watching. Web process grew ~104 MB → 227 MB resident while a full-resolution picture was on screen, released after the slide was dropped.filesystem.readalone was enough for reads;externalstoragewas not required for enumeration or folder reads.addStorageStateChangeListeneris refused to the locally signed app (SecurityError: Permission denied) with or withoutexternalstorage, so insertion/removal is noticed only at the documented re-reads (fresh start, returning to Home, opening Background). A drive pulled while Home stays open keeps its current picture until the next re-read — recorded as a platform limit, not a rendering choice.