terminhtml_recorder package

Create video and image files via TerminHTML rather than HTML/CSS/JS

Submodules

terminhtml_recorder.cli module

terminhtml_recorder.converter module

terminhtml_recorder.converter.convert_video_to_gif(clip, out_path, fps=10)[source]
Return type:

None

terminhtml_recorder.exc module

exception terminhtml_recorder.exc.NoHTMLFoundException[source]

Bases: TerminHTMLRecorderException

exception terminhtml_recorder.exc.TerminHTMLRecorderException[source]

Bases: Exception

terminhtml_recorder.formats module

class terminhtml_recorder.formats.OutputFormat(value)[source]

Bases: str, Enum

An enumeration.

GIF = 'gif'
WEBM = 'webm'

terminhtml_recorder.logger module

class terminhtml_recorder.logger.LogLevel(value)[source]

Bases: str, Enum

An enumeration.

DEBUG = 'DEBUG'
INFO = 'INFO'
class terminhtml_recorder.logger.LoggingConfig(_env_file='<object object>', _env_file_encoding=None, _env_nested_delimiter=None, _secrets_dir=None, **values)[source]

Bases: BaseSettings

class Config[source]

Bases: object

env_prefix = 'TERMINHTML_RECORDER_LOG_'
classmethod cast_log_level(v)[source]
level: LogLevel

terminhtml_recorder.recorder module

class terminhtml_recorder.recorder.PageLocators(speed_up, speed_down, restart)[source]

Bases: object

__init__(speed_up, speed_down, restart)
classmethod from_page(page)[source]
Return type:

PageLocators

restart: playwright.sync_api.Locator
speed_down: playwright.sync_api.Locator
speed_up: playwright.sync_api.Locator
class terminhtml_recorder.recorder.Recording(video, format)[source]

Bases: object

__init__(video, format)
convert_to(new_format, out_path, begin_after=1.1, resize=0.7, fps=10)[source]
Return type:

Recording

format: OutputFormat
classmethod from_path(path, format)[source]
Return type:

Recording

property path: Path
Return type:

Path

video: Video
class terminhtml_recorder.recorder.TerminHTMLRecorder(html, interactor=<function default_page_interactor>)[source]

Bases: object

__init__(html, interactor=<function default_page_interactor>)[source]
record(out_path, format=OutputFormat.GIF, begin_after=1.1, resize=0.7, fps=10)[source]
Return type:

Recording

terminhtml_recorder.recorder.default_page_interactor(page_locators)[source]
Return type:

None

terminhtml_recorder.temp_path module

terminhtml_recorder.temp_path.create_temp_path()[source]

Returns a temporary folder path

Use this instead of tempfile.TemporaryDirectory because: 1. That returns a string and not a path 2. On MacOS, the temp directory has a symlink. This resolves the symlink so that

there won’t be any mismatch in resolved paths.

  1. On Windows, the temp directory can fail to delete with a PermissionError. This function will try to delete the temp directory, but if it fails with an error it will just ignore it.

Return type:

Iterator[Path]

terminhtml_recorder.video module

class terminhtml_recorder.video.Video(path, clip)[source]

Bases: object

__init__(path, clip)
clip: moviepy.editor.VideoFileClip
classmethod from_path(path)[source]
Return type:

Video

path: Path
transform_clip(begin_after, scale)[source]
Return type:

VideoFileClip