Capture stdin and stdout together

44 views
Skip to first unread message

Eric Waters

unread,
May 21, 2012, 9:57:39 AM5/21/12
to sh...@googlegroups.com
Hey there,

I've just joined the group and am interested in collaborating on shelr.tv.  Over the weekend I embarked to find a way to capture and display keys the user types while they're doing a shelr recording.  Additionally, I don't like the methodology of shelr, encouraging users to embed a link back to http://shelr.tv/ rather than providing users a simple .js, .css and .json file they could use to play back the recording in any fashion they choose.  I took some inspiration from your code (specifically app/assets/javascripts/player/player.js) and created a somewhat related piece of code, Shellcast.  https://github.com/ewaters/shellcast/blob/master/public/shellcast.js is the relevant distributable .js file.  It plays a .json file which combines input and output events with timing.

I couldn't find a tool that captures input and output together, so I also undertook trying to write that.  I'm calling it ttyrec++ (https://github.com/ewaters/ttyrec-plusplus).  It captures stdin and stdout with timing and writes it directly to a .json file.  I haven't quite gotten all the stty settings correct (most notably, if you call it without args it'll open up your shell but with broken 'echo' settings; you have to call 'stty echo' or 'reset' to get echo working), but it works for my short term purpose, which was to make a screen cast of my code http://github.com/altsql-shell.

Also, by pre-chunking the captured output, you offer the user the ability to edit the JSON file manually to edit their "video".  Here's an example JSON output: https://github.com/ewaters/altsql-shell/blob/gh-pages/javascripts/ttyrec.38200.json

Check out the result of this mini-hackathon at http://ewaters.github.com/altsql-shell.  You'll see a simple shell recording, similar to shelr.tv but with the typed keys displayed across the bottom.  If you all think it's a desirable feature to have shelr.tv capture the input as well and have a way to render it for the user, or if you think it's a good idea to give users an easy alternative to embedding links to shelr.tv, I can work on these things.

Eric Waters

Anton Vasiljev

unread,
May 26, 2012, 7:17:18 AM5/26/12
to sh...@googlegroups.com
Hello, Eric.


On Monday, May 21, 2012 4:57:39 PM UTC+3, Eric Waters wrote:
Hey there,

I've just joined the group and am interested in collaborating on shelr.tv.  Over the weekend I embarked to find a way to capture and display keys the user types while they're doing a shelr recording.  Additionally, I don't like the methodology of shelr, encouraging users to embed a link back to http://shelr.tv/ rather than providing users a simple .js, .css and .json file they could use to play back the recording in any fashion they choose.

This approach (iframe) have its own benefits :) Like embed once stay updated forever. When we change ui or json format it will just work for users who previously embedded records.

But yes, definitely your suggestion is good for some cases like very custom displaying or offline use...
 
I took some inspiration from your code (specifically app/assets/javascripts/player/player.js) and created a somewhat related piece of code, Shellcast.  https://github.com/ewaters/shellcast/blob/master/public/shellcast.js is the relevant distributable .js file.  It plays a .json file which combines input and output events with timing.

I couldn't find a tool that captures input and output together, so I also undertook trying to write that.  I'm calling it ttyrec++ (https://github.com/ewaters/ttyrec-plusplus).  It captures stdin and stdout with timing and writes it directly to a .json file.  I haven't quite gotten all the stty settings correct (most notably, if you call it without args it'll open up your shell but with broken 'echo' settings; you have to call 'stty echo' or 'reset' to get echo working), but it works for my short term purpose, which was to make a screen cast of my code http://github.com/altsql-shell.

Also, by pre-chunking the captured output, you offer the user the ability to edit the JSON file manually to edit their "video".  Here's an example JSON output: https://github.com/ewaters/altsql-shell/blob/gh-pages/javascripts/ttyrec.38200.json

Check out the result of this mini-hackathon at http://ewaters.github.com/altsql-shell.  You'll see a simple shell recording, similar to shelr.tv but with the typed keys displayed across the bottom.  If you all think it's a desirable feature to have shelr.tv capture the input as well and have a way to render it for the user, or if you think it's a good idea to give users an easy alternative to embedding links to shelr.tv, I can work on these things.

Sure, both features are interesting changes. Go ahead! :)
Also you can join #shelr on freenode :) 

Reply all
Reply to author
Forward
0 new messages