Skip to content

Commit

Permalink
Chore: Add ASCII casts
Browse files Browse the repository at this point in the history
Also added a script to generate the videos from the ASCII casts.
  • Loading branch information
hankertrix committed Dec 27, 2024
1 parent c28f5c2 commit fef4d36
Show file tree
Hide file tree
Showing 30 changed files with 7,618 additions and 0 deletions.
339 changes: 339 additions & 0 deletions asciicasts/create-and-open-directories.cast

Large diffs are not rendered by default.

334 changes: 334 additions & 0 deletions asciicasts/create-and-open-files-and-directories.cast

Large diffs are not rendered by default.

412 changes: 412 additions & 0 deletions asciicasts/create-and-open-files.cast

Large diffs are not rendered by default.

673 changes: 673 additions & 0 deletions asciicasts/create-behaviour.cast

Large diffs are not rendered by default.

387 changes: 387 additions & 0 deletions asciicasts/create-default-behaviour.cast

Large diffs are not rendered by default.

203 changes: 203 additions & 0 deletions asciicasts/editor-behaviour.cast

Large diffs are not rendered by default.

248 changes: 248 additions & 0 deletions asciicasts/editor-prompt.cast

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions asciicasts/enter-skip-single-subdirectory.cast

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions asciicasts/leave-skip-single-subdirectory.cast

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions asciicasts/open-auto-extract-archives.cast

Large diffs are not rendered by default.

320 changes: 320 additions & 0 deletions asciicasts/open-behaviour.cast

Large diffs are not rendered by default.

360 changes: 360 additions & 0 deletions asciicasts/open-prompt.cast

Large diffs are not rendered by default.

137 changes: 137 additions & 0 deletions asciicasts/open-recursively-extract-archives.cast

Large diffs are not rendered by default.

477 changes: 477 additions & 0 deletions asciicasts/pager-behaviour.cast

Large diffs are not rendered by default.

611 changes: 611 additions & 0 deletions asciicasts/pager-prompt.cast

Large diffs are not rendered by default.

162 changes: 162 additions & 0 deletions asciicasts/parent-arrow.cast

Large diffs are not rendered by default.

115 changes: 115 additions & 0 deletions asciicasts/remove-behaviour.cast

Large diffs are not rendered by default.

142 changes: 142 additions & 0 deletions asciicasts/remove-prompt.cast

Large diffs are not rendered by default.

177 changes: 177 additions & 0 deletions asciicasts/rename-behaviour.cast

Large diffs are not rendered by default.

184 changes: 184 additions & 0 deletions asciicasts/rename-prompt.cast

Large diffs are not rendered by default.

187 changes: 187 additions & 0 deletions asciicasts/shell-behaviour.cast

Large diffs are not rendered by default.

303 changes: 303 additions & 0 deletions asciicasts/shell-prompt.cast

Large diffs are not rendered by default.

202 changes: 202 additions & 0 deletions asciicasts/smart-enter.cast

Large diffs are not rendered by default.

351 changes: 351 additions & 0 deletions asciicasts/smart-paste.cast

Large diffs are not rendered by default.

251 changes: 251 additions & 0 deletions asciicasts/smart-tab-create.cast

Large diffs are not rendered by default.

176 changes: 176 additions & 0 deletions asciicasts/smart-tab-switch.cast

Large diffs are not rendered by default.

341 changes: 341 additions & 0 deletions asciicasts/wraparound-arrow.cast

Large diffs are not rendered by default.

240 changes: 240 additions & 0 deletions asciicasts/wraparound-parent-arrow.cast

Large diffs are not rendered by default.

85 changes: 85 additions & 0 deletions generate_videos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/usr/bin/env python3

import os
import shutil
import subprocess
from pathlib import Path

# The path to the ASCII casts directory
ASCII_CAST_DIRECTORY = "./asciicasts"

# The path to the videos directory
VIDEOS_DIRECTORY = "./videos"


def main():
"Main function to run to generate videos from ASCII casts."

# Remove the existing videos
if os.path.exists(VIDEOS_DIRECTORY):
shutil.rmtree(VIDEOS_DIRECTORY)

# Create the videos directory
os.mkdir(VIDEOS_DIRECTORY)

# Get the path to the videos directory
videos_directory = Path(VIDEOS_DIRECTORY)

# Iterate through all the files in the ASCII casts directory
for dir_path, dir_names, file_names in os.walk(ASCII_CAST_DIRECTORY):

# Iterate over all the files in the directory
for file_name in file_names:

# Skip the files that are not ASCII casts
if not file_name.endswith(".cast"):
continue

# Get the file path
file_path = Path(file_name)

# Get the parent directory path
parent_dir_path = Path(dir_path)

# Get the file name without the extension
base_name = file_path.stem

# Get the full file path
full_file_name = parent_dir_path / file_name

# Get the full file path without the extension
full_base_name = parent_dir_path / base_name

# Get the full file name for the GIF
full_gif_name = str(full_base_name) + ".gif"

# Get the full file name for the video
full_video_name = videos_directory / (base_name + ".mp4")

# Create the GIF file from the ASCII cast
subprocess.run(["agg", full_file_name, full_gif_name])

# Convert the GIF to MP4
subprocess.run(
[
"ffmpeg",
"-y",
"-i",
full_gif_name,
"-movflags",
"faststart",
"-pix_fmt",
"yuv420p",
"-vf",
"scale=trunc(iw/2)*2:trunc(ih/2)*2",
full_video_name,
],
)

# Remove the GIF file
os.remove(full_gif_name)


# Name safeguard
if __name__ == "__main__":
main()
File renamed without changes.

0 comments on commit fef4d36

Please sign in to comment.