cacalabs / libcaca

💩 Colour ASCII Art Library
Do What The F*ck You Want To Public License
518 stars 70 forks source link

stdin redirection only takes one input #22

Open ZoomyCat opened 7 years ago

ZoomyCat commented 7 years ago

What I'm doing to trigger the activation:

Start the server in Terminal 1

touch ./in; cacaserver < ./in
initialised network, listening on port 51914
[4] connected from 127.0.0.1

Running nc in terminal 2

nc localhost 51914

Triggering the response in terminal 3

cat edge226.caca > ./in

Response in terminal 2 happens only once and only if the inital in file is empty. Also attempted with a fifo file and this broke it completely and cacaserver did not even initialize listening on the network port. I would have thought that cacaserver would have been able to refresh and take in more data after the first set.

samhocevar commented 7 years ago

This happens because cacaserver stops at end of file (this is standard behaviour for Unix tools). You can use a fifo and the tail utility to avoid this:

mkfifo ./in ; tail -f ./in | cacaserver

And then:

cat edge226.caca > ./in
ZoomyCat commented 7 years ago

@samhocevar Hey just wanted to let you know that your suggestion allowed me to do an ascii representation of my webcam however that was the best quality I was able to achieve because if I increased the resolution and the terminal size I would get 0 output. The highest terminal size I was able to achieve was a 132x40 in urxvt. Where as If I am processing different sized images this limitation seems to be different for some reason.

I'm probably going to sit down and make a video of the findings so its easier to explain what I am doing and what is going on.