@@ -241,19 +241,6 @@ fn nextId {} {
241241
242242 set id
243243}
244- proc remotePrintRequest {remoteNode clause} {
245- ::websocket::open "ws://$remoteNode.local:4273/ws" [list apply {{clause sock type msg} {
246- if {$type eq "connect"} {
247- ::websocket::send $sock text [list apply {{clause} {
248- Assert {*}$clause
249- after 5000 [list Retract {*}$clause]
250- Step
251- }} $clause]
252- after 10000 [list ::websocket::close $sock]
253- }
254- }} $clause]
255- }
256-
257244When $::thisNode claims printer /name/ is a cups printer with /...options/ {
258245 set command [list /usr/sbin/lpadmin -p $name -E]
259246 if {[dict exists $options url]} {
@@ -272,15 +259,17 @@ When $::thisNode claims printer /name/ is a cups printer with /...options/ {
272259}
273260
274261if {![info exists ::printjobs]} {set ::printjobs [dict create]}
275- Subscribe: print code /code/ {
262+ Subscribe: print code /code/ with /...options/ {
276263 if {$::thisNode eq "folk-beads" || $::thisNode eq "folk-convivial"} {
277- # HACK: Forward the print request to folk0.
278- remotePrintRequest "folk0" [list $::thisNode wishes to print $code with {*}$options]
264+ # HACK: Forward the print request to folk-hex.
265+ exec curl -X POST "http://folk-hex.local:4273/" \
266+ -H "Content-Type: text/plain" \
267+ -d [list Notify: print code $code with printer Canon_LBP121_122]; # HACK Brian's printer for folk2 launch party
279268 return
280269 }
281270
282271 set id [nextId]
283- Notify: print program $id with code $code
272+ Notify: print program $id with code $code {*}$options
284273}
285274Subscribe: print program /id/ with /...options/ {
286275 set code [dict get $options code]
@@ -320,6 +309,11 @@ Subscribe: print program /id/ with /...options/ {
320309 set format letter
321310 }
322311
312+ # HACK: added for folk2 launch party printing
313+ if {[dict exists $options printer]} {
314+ set args [list -P [dict get $options printer]]
315+ }
316+
323317 set ps [programToPs $id $code $format]
324318
325319 # save code and ps to disk
@@ -335,6 +329,8 @@ Subscribe: print program /id/ with /...options/ {
335329 close $fp
336330
337331 exec ps2pdf $saveDir/$id.ps $saveDir/$id.pdf
332+
333+ puts "Printing program $id on $::thisNode"
338334 exec lpr {*}$args $saveDir/$id.pdf
339335}
340336
0 commit comments