Build this: Visual TiVo for my computer

I spend hours everyday on my main desktop computer, and I come across bugs in my own code and others' code often. Today as I was trying to help a friend move a blog off wordpress.com, I swear I saw a status screen change an important value when an unrelated setting was changed. It was a showstopper bug but I could not reproduce it. I couldn't switch Firefox into offline mode to see it, since it already reloaded the page to show the new value on the status screen.

At that point I wished for something similar to Time Machine, but for not only what URLs I had previously loaded (already in browser history), but what the pages I'd viewed actually looked like. Even if I was crazy and the values didn't change, it would have been nice to look back and make sure some other action changed the setting. I realized it's not just websites that this might come handy for, but for any application running on my desktop.

So here is my idea: Build an app that takes a screenshot of my entire desktop every 5 seconds silently in the background. At any point I want to look back and figure out how I caused a bug in my application, I'd launch this automatic screenshotting background app and it would assemble a quicktime movie of every desktop screenshot taken in the last hour. That's exactly 720 total images, so playback at 24 frames per second would give you a 30 second movie of your last hour of using a computer in a tidy little movie.

As a programmer and designer myself, I know finding bugs is hard enough in my own stuff, but reproducing them for other programmers is much harder. Something like this kind of application could really come in handy — if you couldn't figure out how exactly to reproduce the bug, at least you'd have a nice little video of the bug in action to show a developer and visual proof of the results.

Published by mathowie

I build internet stuff.

11 replies on “Build this: Visual TiVo for my computer”

  1. Why limit the recording to what is on your computer? I’d love to have a camera mounted on my glasses that records the last N hours of everything I see and hear. Add the ability to say “keep the last 15 minutes” and give it a name for later viewing and there will be a lot of cool stuff in the video repository before long.

    Like

  2. Apparently quicktime Pro can make a mov out of a bunch of pngs. And OSX has a built in screencapture tool. So something like:
    while 1; do screencapture /path/to/a/folder/$(date +%s).png; sleep 5; done
    and then you have a folder full of timestamped screencapture .pngs

    Like

  3. I don’t have a mac near me, but it looks like File -> Open Image Sequence does it.
    since you can call shell scripts from applescript, or call applescript from shell (osascript) you could probably even automate the quicktime part.
    I’ll do it in exchange for a lower user number on mefi 🙂

    Like

  4. I’ve made a ton of changes – mostly to reflect more accurately the way you want to use the thing.

    Like

  5. #!/bin/bash
    folderpath=”/Users/user_name/Desktop/shots/”
    filename=”pic_”
    extention=”.png”
    interval=3
    if (!([ -d $folderpath ]));
    then mkdir $folderpath
    fi
    while [ 1 ]; do
    {
    time=`date “+%Y-%m-%d_%H-%M-%S”`
    screencapture -x -C $folderpath$filename$time$extention
    sleep $interval
    }
    done
    /*That will run in the background and its very lightweight unlike most of the downloadable apps… you may change the interval as you desire, however, it will take up shit tons of space.. so.. if i were you i would get myself a command line compressor for png files, there are many out there, and modify that script to either pipe or stream the output of screencap to the input of the compressor.
    without compression you have the following benefit,
    You will not need a graphical client to make things easy to see, since OS X Leopard has the itunes like view, you can simply browse the folder of screen caps in cover flow, and its like your very own time machine–Sometimes less really is more.
    With compression, you could theoretically just decompress the folder and assume it will take a while. Or code with cocoa a realtime decompression algorithm and viewer.
    I think however, your best bet would to simply add a few more lines to make your script look more like this. */
    #!/bin/bash
    folderpath=”/Users/user_name_here/Desktop/shots/”
    filename=”pic_”
    extention=”.png”
    log=”/Users/user_name_here/Desktop/shots/.history.log”
    interval_in_seconds=3
    hours_of_backup=5
    seconds_in_hour=360
    max_files=$(( ($hours_of_backup * $seconds_in_hour) / $interval_in_seconds ))
    if (!([ -d $folderpath ]));
    then mkdir $folderpath
    fi
    max_reached=0
    while [ 1 ]; do
    {
    time=`date “+%Y-%m-%d_%H-%M-%S”`
    files=(`ls -1 $folderpath`)
    if [[ $max_reached -eq 0 ]]; then
    number_of_files=${#files[*]}
    if [[ $number_of_files -ge $max_files ]]; then
    max_reached=1
    fi
    else
    oldest_file=${files[0]}
    rm -f $oldest_file
    echo “$time removed file: $oldest_file” >> $log
    fi
    screencapture -x -C $folderpath$filename$time$extention
    echo “$time file created: $folderpath$filename$time$extention” >> $log
    sleep $interval_in_seconds
    }
    done
    Which will remove the oldest file every time it makes a new one, starting when you have reached your hours of backup…
    This is a fairly simple memory management technique, and should preserve your archive at a limit of at most a quarter gig or so… again, you can try compression, or meddle with the interval… but this isn’t too bad a solution as it is…
    I’ll be posting the code at
    http://www.loneblacksamurai.com/forum/Operating-Systems/Macintosh/Leopard/Scripts/Screen-History
    as well as a downloadable copy… you are welcome to post your suggestions or detailed desires there as well and I will do my best to provide you with enhancements.

    Like

Comments are closed.

%d bloggers like this: