Asciinema Agg Python Bindings
This is a Python binding for agg which is a command line tool for converting asciinema recordings into GIF video files.
It requires a modified version of agg (by making some modules public), which is included in this repository at local_cargo_registry/agg.
Installation
From PyPI:
pip install agg-python-bindings
From GitHub:
pip install git+https://github.com/james4ever0/agg-python-bindings.git
Source install:
git clone https://github.com/james4ever0/agg-python-bindings.git
cd agg-python-bindings
pip install .
Usage
import agg_python_bindings
asciicast_filepath = "asciinema.cast"
# Load asciicast file from path, save terminal screenshots separated by frame_time_min_spacing (seconds) to png_write_dir
# Output png filename format: "{png_filename_prefix}_{screenshot_timestamp}.png"
agg_python_bindings.load_asciicast_and_save_png_screenshots(
asciicast_filepath, # required, path to asciicast file (input)
png_write_dir=".", # optional
png_filename_prefix="screenshot", # optional
frame_time_min_spacing=1.0 # optional
)
# Create a virtual terminal, feed string into it, then get states and take a screenshot
test_input = 'Hello from \x1B[1;3;31mxterm.js\x1B[0m $ '
screenshot_path = "terminal_screenshot.png"
terminal = agg_python_bindings.TerminalEmulator(80, 25)
changed = terminal.feed_str(test_input)
terminal_dump = terminal.text_raw()
cursor_states = terminal.get_cursor()
width, height, success = terminal.screenshot(screenshot_path)
# print a cybergod style terminal text dump with cursor
for index, it in enumerate(terminal_dump):
if index == cursor_states[1]:
it = it[:cursor_states[0]] +"<|cursor|>"+it[cursor_states[0]:]
print(">", it)
Release files for agg-python-bindings 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agg_python_bindings-0.1.4.tar.gz | 85.1 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| agg_python_bindings-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.34+ x86-64 | Details |
| agg_python_bindings-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.34+ x86-64 | Details |
| agg_python_bindings-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.34+ x86-64 | Details |
| agg_python_bindings-0.1.4-cp39-cp39-manylinux_2_34_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.34+ x86-64 | Details |
| agg_python_bindings-0.1.4-cp38-cp38-manylinux_2_34_x86_64.whl | CPython 3.8 | CPython 3.8 | Linux glibc 2.34+ x86-64 | Details |
Total release size: 7.8 MB
Release files / agg_python_bindings-0.1.4.tar.gz
| Download URL | agg_python_bindings-0.1.4.tar.gz |
|---|---|
| Size | 85.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f09927eab546f69aa1b602c11481189a09a6f91f7179738a725cee66709cdd42
|
|
BLAKE2b-256 checksum How to use checksums |
957a41e3d2a0e250257d7c03d8e5b508e43db0a2b326b7f5d307ee718e44a1d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.19
|
Release files / agg_python_bindings-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | agg_python_bindings-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
3f9a2ab279101267243f499603e1e57afcaae9778cf66e03b6e7670741a81a87
|
|
BLAKE2b-256 checksum How to use checksums |
1b6e93896393a67550c38efe1dfb47af8fd7e9fe1f9738a882bc0eda54e1e69d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.19
|
Release files / agg_python_bindings-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | agg_python_bindings-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
e684a8c8ec74ac16f45666763ee4e73e3c17dd5defbd0f2ee63e8fec3f9b49c2
|
|
BLAKE2b-256 checksum How to use checksums |
d86e91be2682de6f7001035404cd3753da1a1ffdd0c513e3325c6cd07a68e9d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.19
|
Release files / agg_python_bindings-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl
| Download URL | agg_python_bindings-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.10 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
002238b0e61bcd8900d2ac60cf9269e5a52a66cb0e1a7f18fe2b35ca04931cc8
|
|
BLAKE2b-256 checksum How to use checksums |
86c76b48b65bab98cb98ee7321bee294204592abbb0abb84128480981e937a27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.19
|
Release files / agg_python_bindings-0.1.4-cp39-cp39-manylinux_2_34_x86_64.whl
| Download URL | agg_python_bindings-0.1.4-cp39-cp39-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.9 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
ec1dd9d30e30c1e820389fdbd16b8e10754d419c1e555ef7c8527b274eb17305
|
|
BLAKE2b-256 checksum How to use checksums |
a31f63dee8efbdceda1f10f754d8ff5a75aee5e8f3ab1726c379bd1f1c5b45a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.19
|
Release files / agg_python_bindings-0.1.4-cp38-cp38-manylinux_2_34_x86_64.whl
| Download URL | agg_python_bindings-0.1.4-cp38-cp38-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.8 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
0507a5ccba48b7884b0399dc72025e392fe4fae8d652260d8f69ab4dcac695b4
|
|
BLAKE2b-256 checksum How to use checksums |
0095618704b2e3d9be502e8c8b238d2c5f7618fc25e90c8716d11d15f2eaa78d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.19
|