Skip to content

Instantly share code, notes, and snippets.

@jcf
Last active December 14, 2015 14:09

Revisions

  1. James Conroy-Finn revised this gist Mar 6, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gource.bash
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    # ffmpeg -i gource.x264.mp4 -i music.mp3 -shortest dotfiles.mp4

    if [[ ! -d ".git/avatar" ]]; then
    echo "Avatar directory .git/avatar missing. Have you run gource-gravatars?"
    echo "Avatar directory .git/avatar missing. Have you run gource.bash?"
    exit -1
    fi

  2. James Conroy-Finn created this gist Mar 6, 2013.
    54 changes: 54 additions & 0 deletions avatars.pl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    #!/usr/bin/perl
    #fetch Gravatars

    # From http://code.google.com/p/gource/wiki/GravatarExample

    use strict;
    use warnings;

    use LWP::Simple;
    use Digest::MD5 qw(md5_hex);
    use Thread::Pool::Simple;

    my $size = 90;
    my $output_dir = '.git/avatar';

    system("no .git/ directory found in current path\n") unless -d '.git';

    mkdir($output_dir) unless -d $output_dir;

    open(GITLOG, q/git log --pretty=format:"%ae|%an" |/) or die("failed to read git-log: $!\n");

    my %processed_authors;

    sub fetch
    {
    #try and fetch image
    my ($name, $email, $author_image_file) = @_;
    my $grav_url = "http://www.gravatar.com/avatar/".md5_hex(lc $email)."?d=404&s=".$size;

    warn "fetching image for '$name' $email ($grav_url)...\n";

    my $rc = getstore($grav_url, $author_image_file);
    if($rc != 200) {
    unlink($author_image_file);
    }
    }

    my $pool = Thread::Pool::Simple->new(min => 10, max => 20, do => [\&fetch]);

    while(<GITLOG>) {
    chomp;
    my($email, $author) = split(/\|/, $_);

    next if $processed_authors{$author}++;

    my $author_image_file = $output_dir . '/' . $author . '.png';
    #skip images we have
    next if -e $author_image_file;

    $pool->add(($author, $email, $author_image_file));
    }
    $pool->join();

    close GITLOG;
    27 changes: 27 additions & 0 deletions gource.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    #!/usr/bin/env bash

    # To overlay an audio track on the resulting video use the following ffmpeg
    # command.
    #
    # ffmpeg -i gource.x264.mp4 -i music.mp3 -shortest dotfiles.mp4

    if [[ ! -d ".git/avatar" ]]; then
    echo "Avatar directory .git/avatar missing. Have you run gource-gravatars?"
    exit -1
    fi

    gource -1280x720 \
    --user-image-dir .git/avatar \
    --stop-position 1.0 \
    --bloom-intensity 0.18 \
    --user-image-dir .git/avatar \
    --highlight-all-users \
    --output-framerate 60 \
    --multi-sampling \
    -1280x720 \
    -a 0.3 \
    --date-format %Y-%m-%d \
    --disable-progress \
    --seconds-per-day 0.05 \
    --output-ppm-stream - \
    | ffmpeg -y -b 10000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -threads 0 -bf 0 gource.x264.mp4