Initial import. - vtv-tools - virtual terminal video tools DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit a4a3d674601be3dc0a84e2bf111999eefa4d57b0 HTML Author: Troels Henriksen <athas@sigkill.dk> Date: Sat, 12 Aug 2023 21:56:34 +0200 Initial import. Diffstat: A Makefile | 11 +++++++++++ A README.md | 17 +++++++++++++++++ A bin/vtvplayer | 31 +++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 0 deletions(-) --- DIR diff --git a/Makefile b/Makefile @@ -0,0 +1,11 @@ +# paths +PREFIX ?= /usr/local + +all: + +install: all + @echo \# Installing executable files to ${PREFIX}/bin + @mkdir -p ${PREFIX}/bin/ + install bin/* ${PREFIX}/bin/ + +.PHONY: all install DIR diff --git a/README.md b/README.md @@ -0,0 +1,17 @@ +# Virtual Terminal Video tools + +Tools for working with the VTV format. + +## Currently available + +* [`vtvplayer`](vtvplayer) + +## Format specification + +A frame consists of 25 lines, each terminated by a newline character. +A file consists of frames in sequence. This means the number of lines +in a file must be divisible by 25. A line can contain arbitrary +terminal control codes (or just plain text). Playing a .vtv file +consists of copying the frames to the screen, one after another. The +delay between each frame (i.e. the frame rate) is not part of the file +contents, but must be somehow known from elsewhere. DIR diff --git a/bin/vtvplayer b/bin/vtvplayer @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Play a single vtv file in an infinite loop. + +trap 'clear; tput cvvis; exit 0' SIGINT + + +if [ $# -lt 1 ]; +then + echo "Usage: $0 ADDIR" >&2 + exit 1 + year="$(date +%Y)" +fi + +adfile="$1" +frametime=0.05 +framelines=25 + +tput civis +clear +i=0 +nframes=$(echo "$(wc -l < "${adfile}")" / "$framelines" | bc) +while true; do + tput cup 0 0 + tail -n +$(echo "(1+${i} % ${nframes} * ${framelines})" | bc) "$adfile" | head -n $framelines + i=$(($i + 1)) + + userinput="" + sleep $frametime +done +