Skip to content

Instantly share code, notes, and snippets.

@seamustuohy
Created April 23, 2014 19:05
Show Gist options
  • Save seamustuohy/11228418 to your computer and use it in GitHub Desktop.
Save seamustuohy/11228418 to your computer and use it in GitHub Desktop.
Bash script to create a cross-repo gource vizualization
# Creates a Gource visualization from multiple repositories.
# This script requires gource and ffmpeg
# sudo apt-get install gource
# sudo apt-get install ffmpeg
# Usage: ./script <user> [repository name]...
# e.g ./multigource.sh elationfoundation commotion-client luci-commotion
function get_repos()
{
local arg=("$@")
USER="${arg[1]}"
echo "$arg"
echo "$1"
echo "${arg[2]}"
for ((i=2;i<$1+1;i++)) ;do
echo "${arg[i]}"
git clone https://github.com/$USER/"${arg[i]}".git
done
}
#Get all repositories from the specified user.
get_repos $# "$@"
#Create a custom log file from each repository
for file in *
do
gource --output-custom-log $file.txt $file
done
#Create an archive file to hold the combined repositories
touch archive
#Add in an extra "level" (fake folder) to each repository that uses their repo name
#This places the repo name in a node that sits between the center node and the repo's core directory
for file in *.txt
do
name=$(echo "$file" |cut -d \. -f 1)
echo $name
sed -i -r "s#(.+)\|#\1|/$name#" $file
cat $file >> archive
done
#Sort all archive files into chronilogical order so the viz shows development correctly in time.
cat archive | sort -n > all.txt
#Create a custom Gource viz
#This is a very simple viz. Go to https://code.google.com/p/gource/wiki/Controls to customize.
gource --auto-skip-seconds .01 --seconds-per-day .004 --file-idle-time 0 --date-format "%B %Y" --font-size 24 --key --title $USER -1280x720 -o gource.ppm all.txt
#Here is an example we use for the Commotion project
#gource --auto-skip-seconds .01 --seconds-per-day .004 --file-idle-time 0 --date-format "%B %Y" --font-size 24 --hide bloom,filenames,dirnames --key --title "The Commotion Project" --logo CommotionLogoSmall-black.png -1280x720 -o gource.ppm all.txt
#actually create mp4
ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i gource.ppm -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 gource.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment