code wiki / _hdl_build / nx_manga_shelf_lib.nx

nx_manga_shelf_lib.nx

buildroot/runtime/_hdl_build/nx_manga_shelf_lib.nx

24166 B638 linesdepth 2pulls 2 transitivereach 3 importersview sourcekind librarytopic manga
docsdependenciesstructsconstsfunctions

about

nx_manga_shelf_lib.nx -- LOCAL comics/manga SHELF catalog lib for the media server (/api/shelf). The operator's "browse before download" complaint, LOCAL half: browse what we ALREADY OWN -- series grid -> volume list -> the guided zoom reader. ZERO network: everything derives from disk truth. A book joins the shelf iff (a) it is a comic archive (cbz/cbr/cb7), or (b) its calibre author dir is listed in shelf_authors.txt (operator-editable data: manga/comics wearing epub/pdf clothes), or (c) its extracted reader slug already carries cbx.json (PROVEN comic -- it opened in the zoom reader before). Series grouping is data-driven: shelf_markers.txt volume markers (case-insensitive; the EARLIEST hit cuts the title into series name + volume number) plus a same-author first-token fallback for mashed one-shot dumps ("swordsofsorrow vampirella ..."). Multi-format calibre dirs dedupe to ONE volume (cbz > epub > kindle > pdf). Volumes open through the EXISTING /api/open extract-on-demand chain -> /library/zoom; covers ride the EXISTING /api/cover. Pure lib (no socket, no fork) so nx_manga_shelf_gate proves the grouping in isolation -- the nx_galx_manga/nx_media_cover_lib lib+gate split. license_tier: ORIGINAL

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_manga_shelf_lib.nx nx_manga_shelf_gate.nx nx_manga_shelf_scan.nx nx_media_server.nx

imports: nx_syscalls.nx

imported by: nx_manga_shelf_gate.nxnx_manga_shelf_scan.nxnx_media_server.nx

structs

none

consts

14const MSL_MAGIC_1469598103: i64 = 1469598103
15const MSL_MAGIC_72057594037927931: i64 = 72057594037927931
16const MSL_MAGIC_1024: i64 = 1024
17const MSL_MAGIC_2048: i64 = 2048
18const MSL_MAGIC_8192: i64 = 8192
20const MSL_IDX: *u8 = "knowledge/staging/media/idx_book.wsl"
21const MSL_AUTHORS: *u8 = "knowledge/staging/media/shelf_authors.txt"
22const MSL_MARKERS: *u8 = "knowledge/staging/media/shelf_markers.txt"
23const MSL_READER: *u8 = "knowledge/staging/media/reader/"
24const MSL_MAXVOL: i64 = 4096
25const MSL_MAXSER: i64 = 1024

functions

28func msl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 3: mainmsl_ci_findmain
29func msl_cats(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off + i] = s[i]; i = i + 1 } return off + i }
30func msl_catn(dst: *u8, off: i64, v: i64) -> i64
40func msl_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
41func msl_hexc(d: i64) -> i64 { if d < 10 { return 48 + d } return 87 + d }
called by 1: msl_pathslug
45func msl_pathslug(p: *u8, ls: i64, le: i64, out: *u8) -> i64
called by 3: mainmsl_probe_cbxmain calls 1: msl_hexc
60func msl_probe_cbx(p: *u8, ls: i64, le: i64, sc: *u8) -> i64
76func msl_ext_rank(p: *u8, ls: i64, le: i64) -> i64
called by 1: msl_add_line calls 1: msl_lc
95func msl_strip_id(p: *u8, ls: i64, le: i64) -> i64
called by 1: msl_add_line
116func msl_ci_eq(a: *u8, als: i64, ale: i64, b: *u8, bls: i64, ble: i64) -> i64
125func msl_ci_cmp(a: *u8, als: i64, ale: i64, b: *u8, bls: i64, ble: i64) -> i64
144func msl_ci_find(hay: *u8, ls: i64, le: i64, needle: *u8) -> i64
called by 1: msl_marker_cut calls 2: msl_slenmsl_lc
159func msl_author_listed(a: *u8, ls: i64, le: i64, ab: *u8, an: i64) -> i64
called by 1: msl_add_line
186func msl_marker_cut(t: *u8, ls: i64, le: i64, mk: *u8, mkn: i64, numout: *i64, nomark: *i64, one: *u8) -> i64
called by 1: msl_add_line calls 1: msl_ci_find
258func msl_jesc(dst: *u8, off0: i64, s: *u8, ls: i64, le: i64) -> i64
called by 1: msl_emit_series
277func msl_ctx_new() -> *i64
called by 1: msl_shelf_json calls 1: sys_mmap
290func msl_add_line(ctx: *i64, ls: i64, le: i64) -> i64
374func msl_scan(ctx: *i64) -> i64
called by 1: msl_shelf_json calls 1: msl_add_line
392func msl_tok_end(buf: *u8, ts: i64, te: i64) -> i64
called by 1: msl_firsttok
400func msl_firsttok(ctx: *i64) -> i64
called by 1: msl_shelf_json calls 2: msl_tok_endmsl_ci_eq
450func msl_group(ctx: *i64) -> i64
called by 1: msl_shelf_json calls 1: msl_ci_eq
488func msl_sort_series(ctx: *i64, sidx: *i64) -> i64
called by 1: msl_emit calls 1: msl_ci_cmp
515func msl_vol_before(ctx: *i64, a: i64, b: i64) -> i64
called by 1: msl_series_vols calls 1: msl_ci_cmp
527func msl_series_vols(ctx: *i64, sid: i64, vids: *i64) -> i64
called by 1: msl_emit_series calls 1: msl_vol_before
550func msl_emit_series(ctx: *i64, out: *u8, w0: i64, cap: i64, sid: i64, vids: *i64) -> i64
592func msl_emit(ctx: *i64, out: *u8, cap: i64) -> i64
617func msl_shelf_json(out: *u8, cap: i64) -> i64