Skip to content

Instantly share code, notes, and snippets.

@pgampe
Created August 9, 2013 19:52
Show Gist options
  • Save pgampe/6196643 to your computer and use it in GitHub Desktop.
Save pgampe/6196643 to your computer and use it in GitHub Desktop.
Render videos of a git repository. This is my config for TYPO3 CMS 4.6. The perl script for fetching the avatar images might be broken. It is not really needed. And it does store all images as PNG files, but some of them are JPEGs...
[display]
#fullscreen=true
#viewport=1680x1050
viewport=1280x720
[gource]
camera-mode=overview
colour-images=true
file-idle-time=5
hide=filenames,dirnames,mouse,progress,date
highlight-users=false
highlight-colour=69A550
key=false
log-format=git
max-files=0
max-user-speed=200
user-friction=300
user-image-dir=.git/avatar/
multi-sampling=true
no-vsync=true
output-framerate=60
seconds-per-day=0.1
stop-at-end=true
logo=typo3/sysext/t3skin/images/login/typo3logo-white.png
#!/usr/bin/perl
#fetch Gravatars
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);
}
sleep 5;
}
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;
#!/bin/bash
Titel="TYPO3 4.6 Development"
Begin=TYPO3_4-5-0
End=TYPO3_4-6-0
GourceConfig=.gource
VideoName="TYPO3_4-6_development.webm"
Threads=3
echo "Recreating avators in .git/avatar/"
./avatar.pl
echo "Starting rendering"
git log --pretty=format:user:%aN%n%ct --reverse --raw --encoding=UTF-8 --no-renames $Begin..$End |gource --load-config "$GourceConfig" --title "$Titel" -o - - |ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libvpx -b 10000K -threads $Threads $VideoName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment