• Stars
    star
    189
  • Rank 204,649 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 12 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

record and replay interactive terminal sessions

Status: Unmaintained

No Maintenance Intended

I am no longer actively maintaining this project. I might still poke at it occasionally for my own use, please don't expect regular releases or responsiveness here on github.

playitagainsam: record and replay interactive terminal sessions

Playitagainsam is a tool and a corresponding file format for recording and replaying interactive terminal sessions. It takes inspiration from the unix commands "script" and "ttyrec" and the python tool "playerpiano".

Useful features include:

  • ability to replay with fake typing for enhanced "interactivity"
  • ability to replay synchronized output in multiple terminals

It's early days, still kinda buggy and easy to crash. But I hope this will be resolved in short order!

Basic Usage

Run the software using either the included "pias" script, or using the python module-running syntax of "python -m playitagainsam".

Record a session like this:

$ pias record <output-file>

This will drop you into a shell and record all the input and output that occurs during the session. Once you exit the shell, all activity will be written into the output file as a JSON document.

Replay a recorded session like this:

$ pias play <input-file>

This will start a simulated playback of the original shell. Press any keys to type, and hit "enter" when you reach the end of a line.

Extra Features

Playitagainsam has some extra features that distinguish it from similar solutions.

Multiple Terminals

It's possible to record activity in several terminals simultaneously as part of a single session, which can be useful for e.g. demonstrating a server process in one terminal and a client process in another. Join a new terminal to an existing recording session like this:

$ pias --join record <output-file>

Choice of Manual or Automated Typing

While the default playback mode assumes interactive typing, it is also possible to have pias type automatically for you. You can have it enter individual commands but wait for you to manually trigger each newline like this:

$ pias play <input-file> --auto-type

Or you can have it automatically type all input like this:

$ pias play <input-file> --auto-type --auto-waypoint

These options both accept an integer millisecond value which will control the speed of the automated typing.

Canned Replay or Live Replay?

The default playback mode outputs back the 'canned' output text from the original terminal session(s), without any side effects. However, the side effects might be desirable during the presentation.

For instance, when demoing a REST API, the presenter might want to show the effects of the API calls on a service using a browser. Or the demoed code could drive some other non-console output, like a visualisation or a game.

The --live-replay option connects the prerecorded input to a live shell for actual live output and side effects:

$ pias play <input-file> --live-replay

This option is composable with the previous ones:

$ pias play <input-file> --live-replay --auto-type --auto-waypoint

Live replay also works two or more joined terminal sessions.

JavaScript Player

There is a javascript-based player that can be used to embed a recorded session into a HTML document. This is useful for websites or HTML-based presentations. The code is here:

https://github.com/rfk/playitagainsam-js/

And an example presentation using this code is at:

https://github.com/rfk/talk-webapitesting/

Gotchas

Getting this all running just right can be tricky business! Here's some thing that you should be aware of:

  • All terminals should be using utf8 encoding, or you'll see strange output and probably some outright errors.
  • All terminals in a session should be the same size. This restriction may go away in the future.
  • The live-replay option has its own particularities:
    • Sessions created with the --append switch won't continue after the first recording session ends.
    • Sometimes keypresses "bounce", and double characters get inserted.
    • Some live-replay output sequences lasting longer than the corresponding output in the recording session can get buffered waiting for the next user action.

More Repositories

1

django-supervisor

easy integration between django and supervisord
Python
382
star
2

dexml

a dead-simple object-xml mapper for python
Python
78
star
3

withhacks

building blocks for with-statement-related hackery
Python
62
star
4

promise

optimise python code using staticness assertions
Python
61
star
5

tnetstring

data serialization using typed netstrings
C
57
star
6

m2wsgi

a mongrel2 => wsgi gateway
Python
56
star
7

threading2

like the standard threading module, but awesomer
Python
45
star
8

git-remote-hg

access hg repositories as git remotes
Python
41
star
9

django-paranoid-sessions

Make Django sessions work harder to prevent session-stealing attacks
Python
32
star
10

wasm-polyfill

A highly-experimental, likely-pretty-slow polyfill for WebAssembly
JavaScript
29
star
11

filelike

easy creation, manipulation and wrapping of filelike objects
Python
15
star
12

withrestart

A Pythonisation of the restart-based condition system from Common Lisp
Python
15
star
13

magicsuper

Backport magical zero-argument super() to python2
Python
14
star
14

jquery-xmlns

XML namespace selector support for jQuery
JavaScript
14
star
15

proxylet

lightweight HTTP reverse proxy built on eventlet
Python
13
star
16

playitagainsam-js

javascript player for playitagainsam terminal sessions
JavaScript
11
star
17

atinline

forcibly inline python functions to their call site
Python
9
star
18

regobj

pythonic object-based access to the windows registry
Python
7
star
19

mentat-sync-prototype

Python
5
star
20

talk-webapitesting

PyCon Au 2012 Talk: "The Lazy Dev's Guide to Testing Your Web API"
JavaScript
5
star
21

pgrad

my postgrad stuff (mostly archival now)
TeX
4
star
22

xrcwidgets

rapid GUI development module built on wxPython and XRC
Python
4
star
23

sitcalc_async_knowledge

Experimental engine for asynchronous multi-agent epistemic reasoning in the situation calculus
Prolog
3
star
24

autoself

automagically add "self" etc to method definitions
Python
3
star
25

mangler

bytecode mangler for frozen python apps
Python
3
star
26

jquery-loadinline

have links and forms load their content inline via ajax
JavaScript
3
star
27

talk-pypyjs-what-how-why

PyPy.js: What? How Why? (Presentated at PyCon Australia 2014)
Python
2
star
28

flattrpy

reward the python community
Python
1
star
29

talk-cross-compile-to-the-web

Python
1
star
30

rfk.github.com

rfk.github.com
1
star
31

www.rfk.id.au

sources for my personal website
JavaScript
1
star
32

rust-components-swift

Experimental multi-target swift package for consuming Rust Components on iOS
Swift
1
star
33

codemaker

An experiment in structured generation of source code using Rust
Rust
1
star
34

winereg

_winreg clone for systems running Wine
Python
1
star
35

pyextprot

compact, efficient, extensible binary serialization format
Python
1
star