Table of Contents

Bad Apple!! but it's playing with curl

Run this command in a VT100-compatible terminal, with a good Unicode font and a window of at least 100×45:

curl -L xn--u80a.com/badapple

It should play a video. Yeah. It's impressive because curl isn't meant to play videos. There's even subtitles and a progress bar! Try it for yourself! Incredible.

how tf did you do that, you say???

step 1: convert mp4 to braille

# convert movie to a series of PNGs
ffmpeg -i badapple.mp4 badapple%04d.png
# then convert each PNG using img2braille
clear > badapple.txt
for i in *.png; do
  tput home
  img2braille -d $i
done > badapple.txt

step 2: uuuuh, do something

Now dump badapple.txt on a web server and it should work, right? Yeah it's going to be too fast so we probably should slow it down.

curl --limit-rate 343230 localhost/badapple.txt

Okay, no. Too many drop frames. Maybe we should do this server-side.

<?php
$file = "badapple.txt";
 
header('Content-Type: text/plain');
header('Content-Length: '.filesize($file));
 
$h = fopen($file, "r");
 
echo fread($h, 11);
 
$time = microtime(true);
while(!feof($h))
{
    echo fread($h, 11441);
    time_sleep_until($time+1/32.5);
    $time = microtime(true);
}

Yeah, it kinda works, now, now to put subtitles and why not a progress bar and also credits at the end and now it's 200 lines of code aaaaa

TODO