Skip to content

Add a USB drive photo source for the slideshow - #52

Open
lennartschoch wants to merge 4 commits into
nthnclrk:mainfrom
lennartschoch:usb-photo-slideshow
Open

lennartschoch wants to merge 4 commits into
nthnclrk:mainfrom
lennartschoch:usb-photo-slideshow

Conversation

@lennartschoch

Copy link
Copy Markdown

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.js enumerates mounted external storage with tizen.filesystem.listStorages and, in stable label order, reads each drive's CleanFrame/ folder with listDirectory until one holds pictures (240-picture limit), resolving each file with toURI.
  • The manifest declares filesystem.read plus externalstorage. On Tizen 5.5, addStorageStateChangeListener is refused with filesystem.read alone; declaring externalstorage keeps that avenue open.
  • slideOf(look) is the single place that turns a look into the gallery or USB picture on screen. usbAt wraps at use, so an "Each time Home opens" advance before the drive is read stays valid.
  • Preference migration: a saved look without src/usbAt keeps 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 reinsertion
  • npm run check:public
  • Public-font screenshots from that run (USB slides in Dock, the Settings row and the source picker, both at 1920x1080) are in the check report directory .local/qa/ per the testing docs; they show no private fonts.

Device results and limits

  • Tested on the reference Tizen 9.0 TV (details in docs/tv-status.md): a FAT32 stick mounted at /opt/media/USBDriveA1 by the stock stack, reported as removable_sda1 (EXTERNAL, MOUNTED), plain directory names from listDirectory; 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.read alone was enough for reads; externalstorage was not required for enumeration or folder reads.
  • Not working on this TV: addStorageStateChangeListener is refused to the locally signed app (SecurityError: Permission denied) with or without externalstorage, 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.
  • Untested device results: large-JPEG load time against the eight-second deadline and the softened surfaces under real household photos still deserve a closer look on other models.

lennartschoch and others added 4 commits November 17, 2026 19:51
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant