#!/bin/rc # treason wrapper for use with the following plumbing rules: # dst is video # plumb to video # plumb client window tube # wdir is /mnt/⏵ # data matches [0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f] # plumb to video # data matches .+\.(mp4|mkv|webm) # arg isfile $data # data set $file # plumb to video # plumb client window tube ramfs -um/mnt/⏵ cd /mnt/⏵ echo -n /mnt/⏵ >/dev/wdir echo -n ⏵ >/dev/label echo -n scroll >/dev/wctl /dev/null{ read # src read # dst read # wdir read # type attr = `{read} ndata = `{read} }){ if(~ $attr *'action=showdata'*){ read -c $ndata >tmp data = `{sum tmp | read -c 8} mv tmp $data } if not data = `''{read -c $ndata} echo -n unhide >/dev/wctl >[2]/dev/null echo -n current >/dev/wctl if(! ~ $data /* && ~ $data *[~0-9a-f]* || ! test -f $data){ echo -n 'bad plumb: ' cat /env/data echo } if not{ echo playing $data … treason $data if(! ~ $data /*){ done = 0 echo -n `{{walk -es $data; echo 1048576/1+p}|dc} 'MB: ' while(~ $done 0){ echo 𝐫ewatch, 𝐰rite to disk, 𝐝elete from ram, or 𝐤eep in ram for now? echo -n  >/dev/kbdin >[3]/dev/consctl{ echo rawon >[1=3] k = `''{read -c 1 /dev/cons} } switch($k){ case r plumb $data done = 1 case w echo -n 'write: ' k = `{read /dev/cons} mv $data $k && done = 1 case d rm $data && echo $data removed from ramfs && done = 1 case i echo ignoring for now: replumb later to watch again, write, or delete done = 1 } } } echo -n hide >/dev/wctl } }