nx_torrent_extract.nx
buildroot/runtime/nx_torrent_extract.nx
about
nx_torrent_extract.nx -- split a completed/partial download.part into the REAL files the torrent
contains, per the metadata "files" list (multi-file) or "name" (single-file). This is what turns the
opaque "download.part" the operator sees into a playable REBDB-1026...mkv. Reuses nx_bencode. STREAMING
copy (1 MiB chunks -- never mmaps the multi-GB payload). For a PARTIAL download the missing pieces are
zero-gaps in download.part, so the extracted media still plays ("most of a film" = the exceed axis).
argv[1] = the torrent folder (must contain download.meta + download.part). license_tier: ORIGINAL
module: nishi-core.torrent.extract
depends: nishi-core.torrent.bencode
capability: TORRENT_FILE_EXTRACT
dependencies 1 imports · 0 importers
imports: nx_bencode.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
| 12 | const EX_MAGIC_1048576: i64 = 1048576 |
| 13 | const EX_MAGIC_65536: i64 = 65536 |
| 14 | const EX_MAGIC_2048: i64 = 2048 |
| 47 | const EX_NAME_BONUS: i64 = 1099511627776 |
functions
| 16 | func ex_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 17 | func ex_wn(v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(1,"-" as *u8,1)} 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} let b: *u8=sys_mmap(28); var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } called by 1: main |
| 18 | func ex_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 19 | func ex_cat(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+ex_slen(s) } |
| 23 | func ex_mkdirs(path: *u8) -> i64 |
| 33 | func ex_copy_range(srcfd: i64, start: i64, len: i64, dstpath: *u8) -> i64 |
| 48 | func ex_lcname_has(name: *u8, sub: *u8) -> i64 |
| 59 | func ex_ends(name: *u8, suf: *u8) -> i64 |
| 66 | func ex_is_vid(name: *u8) -> i64 { if ex_ends(name,".mp4" as *u8)==1 {return 1} if ex_ends(name,".mkv" as *u8)==1 {return 1} if ex_ends(name,".ts" as *u8)==1 {return 1} if ex_ends(name,".flv" as *u8)==1 {return 1} return 0 } |
| 67 | func ex_is_img(name: *u8) -> i64 { if ex_ends(name,".jpg" as *u8)==1 {return 1} if ex_ends(name,".jpeg" as *u8)==1 {return 1} if ex_ends(name,".png" as *u8)==1 {return 1} return 0 } |
| 68 | func ex_fsize(path: *u8) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0 {return 0-1} let s: i64=sys_lseek(fd,0,2); sys_close(fd); return s } called by 1: ex_poster_walk |
| 69 | func ex_copy_file(src: *u8, dst: *u8) -> i64 |
| 77 | func ex_poster_walk(dir: *u8, depth: i64, mode: i64, best: *u8, bestscore: *i64, madep: *i64) -> i64 called by 2: ex_poster_walkmain calls 13: ex_slensys_getdents64dirent_reclendirent_typedirent_nameex_poster_walk+7 |
| 136 | func main(argc: i64, argv: *i64) -> i64 |