From 473d76c44f249c1ad262493cf11ccb8faf9d9a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Fri, 9 Apr 2010 18:19:27 +0200 Subject: Add Gource wrapper scripts. diff --git a/BuildTools/Gource/.gitignore b/BuildTools/Gource/.gitignore new file mode 100644 index 0000000..d7dc963 --- /dev/null +++ b/BuildTools/Gource/.gitignore @@ -0,0 +1,2 @@ +UserImages +*.mp4 diff --git a/BuildTools/Gource/CreateVideo.sh b/BuildTools/Gource/CreateVideo.sh new file mode 100755 index 0000000..92083f0 --- /dev/null +++ b/BuildTools/Gource/CreateVideo.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# Can be 25, 30, or 60 (per Gource) +FRAMERATE=25 +BITRATE=3000K + +BuildTools/Gource/GetGravatars.py BuildTools/Gource/UserImages +BuildTools/Gource/RunGource.sh --disable-progress --stop-at-end -640x360 $@ --output-framerate $FRAMERATE --output-ppm-stream - | ffmpeg -y -b $BITRATE -r $FRAMERATE -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre default BuildTools/Gource/SwiftGource.mp4 diff --git a/BuildTools/Gource/GetGravatars.py b/BuildTools/Gource/GetGravatars.py new file mode 100755 index 0000000..c6602ad --- /dev/null +++ b/BuildTools/Gource/GetGravatars.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +import subprocess, os, sys, hashlib, urllib + +GRAVATAR_URL = "http://www.gravatar.com/avatar/%(id)s?d=404" + +if len(sys.argv) != 2 : + print "Usage: " + sys.argv[0] + " " + sys.exit(-1) + +output_dir = sys.argv[1] + +# Retrieve the list of authors +authors = {} +p = subprocess.Popen("git log --pretty=format:'%ae|%an'", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(os.name != "nt")) +for line in p.stdout.readlines() : + author_components = line.rstrip().split("|") + authors[author_components[0]] = author_components[1] +p.stdin.close() +if p.wait() != 0 : + print "Error" + sys.exit(-1) + +# Get & save the avatars +os.makedirs(output_dir) +for email, name in authors.items() : + print "Processing avatar for " + name + " <" + email + ">" + filename = os.path.join(output_dir, name + ".png") + if os.path.isfile(filename) : + print "-> Already there. Skipping." + continue + + m = hashlib.md5() + m.update(email) + url = GRAVATAR_URL % {"id" : m.hexdigest()} + print "- Downloading " + url + f = urllib.urlopen(url) + input = None + if f.getcode() == 200 : + input = f.read() + f.close() + if input : + print "- Saving file " + filename + f = open(filename, "w") + f.write(input) + f.close() + else : + print "- No Gravatar found" diff --git a/BuildTools/Gource/RunGource.sh b/BuildTools/Gource/RunGource.sh new file mode 100755 index 0000000..7f5e967 --- /dev/null +++ b/BuildTools/Gource/RunGource.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +gource --user-scale 2.0 --file-filter 3rdParty --user-image-dir BuildTools/Gource/UserImages -s .5 --hide filenames $@ -- cgit v0.10.2-6-g49f6