Skip to content

Instantly share code, notes, and snippets.

@cgoldberg
Last active December 28, 2015 14:39
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cgoldberg/7516510 to your computer and use it in GitHub Desktop.
Generate gource video out of bzr repositories for Ubuntu Touch Core Apps.
#!/usr/bin/env bash
# Generate gource video out of bzr repositories for Ubuntu Touch Core Apps.
#
# Corey Goldberg 2013
#
# Usage:
# gource-ubuntu-core-apps.sh /path/to/repo1 /path/to/repo2
#
# Example - generate video for all Ubuntu Touch Core Apps:
# $ ./gource-ubuntu-core-apps.sh \
# account-plugin-evernote \
# dropping-letters \
# music-app \
# reminders-app \
# stock-ticker-mobile-app \
# sudoku-app ubuntu-calculator-app \
# ubuntu-calendar-app \
# ubuntu-clock-app \
# ubuntu-docviewer-app \
# ubuntu-emailclient-app \
# ubuntu-facebook-app \
# ubuntu-filemanager-app \
# ubuntu-phone-commons \
# ubuntu-rssreader-app \
# ubuntu-terminal-app \
# ubuntu-weather-app
outfile="gource.mp4"
resolution="1920x1080"
# get a bzr branch of each project
for repo in $*; do
branch_command="bzr branch lp:"$repo
echo $branch_command
$branch_command
done
i=0
for repo in $*; do
# generate a gource custom log file for each repo
logfile="$(mktemp /tmp/gource.XXXXXX)"
gource --output-custom-log "${logfile}" $repo
# make each repo appear on a separate branch by adding
# an extra parent directory to the path of the files in each project.
sed -i -E "s#(.+)\|#\1|/${repo}#" ${logfile}
logs[$i]=$logfile
let i=$i+1
done
# generate the combined log
combined_log="$(mktemp /tmp/gource.XXXXXX)"
cat ${logs[@]} | sort -n > $combined_log
rm ${logs[@]}
# remove the branch directories after creating log
for repo in $*; do
rm -rf $repo
done
# print the committers found
echo "Committers:"
cat $combined_log | awk -F\| {'print $2'} | sort | uniq
echo "======================"
# run gource, piping output to avconv for video rendering
time gource $combined_log \
-s 0.2 \
-$resolution \
--logo ubuntu_logo.png \
--title "Ubuntu Touch Core Apps" \
--auto-skip-seconds 1 \
--multi-sampling \
--highlight-users \
--file-extensions \
--highlight-dirs \
--file-idle-time 0 \
--max-files 0 \
--hide mouse,progress \
--key \
--stop-at-end \
--output-ppm-stream - \
--output-framerate 30 \
--background-colour 000000 \
--default-user-image user_icon.png \
--colour-images \
--font-size 28 \
| avconv -y -r 30 -f image2pipe -vcodec ppm -i - -b 8192K $outfile
# remove the log when done
rm $combined_log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment