code wiki / _hdl_build / nx_skill_video.nx
nx_skill_video.nx
buildroot/runtime/_hdl_build/nx_skill_video.nx
about
nx_skill_video.nx -- LIB: WHO you learn a technique from is the learner's choice, not ours.
For any skill the coach teaches, there may be several ways to watch it done: a PROFESSIONAL source, an
AMATEUR one (often better -- a home cook's kitchen looks like yours), or a specific CHEF the learner already
follows. This registry holds those sources per skill, keeps the chefs a person follows, and answers the
question that actually gets asked: "has the cook I like already covered this?"
THAT QUESTION IS A TRI-STATE, ON PURPOSE. sv_chef_covers returns -1 for a chef we have never heard of, 0 for
a chef we know who has not covered this skill, and 1 for covered. Collapsing the first two into "no" would
tell someone their favourite chef has not made the video when the truth is we never indexed them -- and that
wrong answer is exactly what would send a pointless request to a chef who already has one.
LINK ROT IS THE SAME PROBLEM AS THE RECIPE. A technique video is a citation like any other, so this reuses
ms_is_archived from nx_meal_source rather than growing a second archive predicate: a source renders as
preserved ONLY when its bytes actually come back out of the WARC.
Schema (prefix passed in, e.g. knowledge/store/skillvid-):
svid:ids -> TAB list of video ids
svid:<vid> -> skill <t> title <t> creator <t> kind <t> url <t> licence <t> seconds <t> chef-id
svid:skill:<sid> -> TAB list of video ids teaching that skill
chef:ids -> TAB list of chef ids
chef:<cid> -> display name <t> handle <t> home url
follow:<unit> -> TAB list of chef ids this unit follows
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 5 imports · 3 importers
imports: nx_meal_plan.nxnx_meal_source.nxnx_food_science.nxnx_seg_store.nxnx_syscalls.nx
imported by: nx_meal_skills_page.nxnx_skill_request.nxnx_skills_emit.nx
structs
| none |
consts
| 31 | const SV_TAB: i64 = 9 |
| 32 | const SV_KEYCAP: i64 = 200 |
| 33 | const SV_VALCAP: i64 = 2048 |
| 34 | const SV_MAXV: i64 = 256 |
| 37 | const SV_F_SKILL: i64 = 0 |
| 38 | const SV_F_TITLE: i64 = 1 |
| 39 | const SV_F_CREATOR: i64 = 2 |
| 40 | const SV_F_KIND: i64 = 3 |
| 41 | const SV_F_URL: i64 = 4 |
| 42 | const SV_F_LICENSE: i64 = 5 |
| 43 | const SV_F_SECONDS: i64 = 6 |
| 44 | const SV_F_CHEF: i64 = 7 |
| 47 | const SV_C_NAME: i64 = 0 |
| 48 | const SV_C_HANDLE: i64 = 1 |
| 49 | const SV_C_HOME: i64 = 2 |
| 52 | const SV_CHEF_UNKNOWN: i64 = 0 - 1 |
| 53 | const SV_CHEF_NO: i64 = 0 |
| 54 | const SV_CHEF_YES: i64 = 1 |
functions
| 59 | func sv_keybuf() -> *u8 { if SV_KB == 0 { SV_KB = sys_mmap(SV_KEYCAP) as i64 } return SV_KB as *u8 } |
| 60 | func sv_pq() -> *i64 { if SV_PQ == 0 { SV_PQ = sys_mmap(16) as i64 } return SV_PQ as *i64 } |
| 61 | func sv_lq() -> *i64 { if SV_LQ == 0 { SV_LQ = sys_mmap(16) as i64 } return SV_LQ as *i64 } |
| 62 | func sv_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: sv_seconds |
| 65 | func sv_empty() -> *u8 |
| 72 | func sv_field_at(prefix: *u8, key: *u8, f: i64, out: *u8) -> i64 |
| 81 | func sv_vid_key(vid: *u8, out: *u8) -> i64 |
| 87 | func sv_skill_key(sid: *u8, out: *u8) -> i64 |
| 95 | func sv_add_video(prefix: *u8, vid: *u8, sid: *u8, title: *u8, creator: *u8, kind: *u8, url: *u8, license: *u8, seconds: i64, chef: *u8) -> i64 |
| 117 | func sv_field(prefix: *u8, vid: *u8, f: i64, out: *u8) -> i64 |
| 123 | func sv_seconds(prefix: *u8, vid: *u8) -> i64 |
| 130 | func sv_by_skill(prefix: *u8, sid: *u8, outtoks: *i64) -> i64 called by 4: msp_sourcesmainsv_by_skill_kindsv_chef_covers calls 6: sv_keybufsv_skill_keysv_pqsv_lqss_getmp_split |
| 140 | func sv_by_skill_kind(prefix: *u8, sid: *u8, kind: *u8, outtoks: *i64) -> i64 |
| 158 | func sv_chef_key(cid: *u8, out: *u8) -> i64 |
| 164 | func sv_follow_key(unit: *u8, out: *u8) -> i64 |
| 171 | func sv_add_chef(prefix: *u8, cid: *u8, name: *u8, handle: *u8, home: *u8) -> i64 |
| 185 | func sv_chef_field(prefix: *u8, cid: *u8, f: i64, out: *u8) -> i64 |
| 191 | func sv_chef_known(prefix: *u8, cid: *u8) -> i64 |
| 197 | func sv_follow(prefix: *u8, unit: *u8, cid: *u8) -> i64 |
| 203 | func sv_follows(prefix: *u8, unit: *u8, outtoks: *i64) -> i64 |
| 216 | func sv_chef_covers(prefix: *u8, cid: *u8, sid: *u8, out_vid: *i64) -> i64 |
| 237 | func sv_is_preserved(prefix: *u8, vid: *u8, warc: *u8, warclen: i64) -> i64 |
| 244 | func sv_preserved_bytes(prefix: *u8, vid: *u8, warc: *u8, warclen: i64) -> i64 |