code wiki / _hdl_build / nx_media_usable.nx
nx_media_usable.nx
buildroot/runtime/_hdl_build/nx_media_usable.nx
about
nx_media_usable.nx -- MEDIA USABILITY VERIFIER (operator 2026-07-04: "lots of our systems dont confirm if the
media is USABLE -- i have a bunch of broken books like comic books, table headers... keep going but flag this").
Serving != working: this organ opens a comic/image book the way the READER would and proves every page actually
DECODES (not just "the file exists"). Given a book dir (reader/<slug>), it reads cbx.json, then for each page:
missing on disk / 0-byte / undecodable-bytes (e.g. an HTML error page saved as .jpg) / tiny(junk) -> BROKEN.
decodes to real W*H via nx_img_dims (jpeg/png/gif/webp) -> OK.
Verdict: OK (all pages decode) | DEGRADED (some broken) | BROKEN (no manifest or 0 usable pages). Read-only; safe
on root-owned live book dirs (world-readable). Prints a machine-readable line so the library UI + a census can
consume it. This is the books/comics rung of the media-liveness plane; video/movie verifiers are separate rungs.
license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_img_dims.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 13 | const MU_MAGIC_2048: i64 = 2048 |
| 14 | const MU_MAGIC_4096: i64 = 4096 |
| 16 | const MU_MIN_EDGE: i64 = 120 // a real readable page's long edge; below = nav-icon/spacer/broken (matches the manga junk floor's ethos; TODO svc-config) |
functions
| 18 | func mw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 19 | func mn(v: i64) -> i64 { let b: *u8=sys_mmap(24); var m: i64=v; if m<0{mw("-" as *u8);m=0-m} let t: *u8=sys_mmap(24); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } |
| 20 | func mu_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 21 | func mu_apps(dst: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[o+i]=s[i];i=i+1} return o+i } called by 1: mu_check_book |
| 23 | func mu_find(buf: *u8, n: i64, needle: *u8, from: i64) -> i64 called by 1: mu_check_book |
| 31 | func mu_check_book(dir: *u8, out: *i64, verbose: i64) -> i64 |
| 74 | func mu_verdict_str(v: i64) -> *u8 { if v==2 {return "OK" as *u8} if v==1 {return "DEGRADED" as *u8} return "BROKEN" as *u8 } called by 1: main |
| 76 | func main(argc: i64, argv: *i64) -> i64 |