Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 65 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,82 @@ Output from this tool is shown on [the ActivityWatch website](https://activitywa

- Generate tables from git history with number of active days, number of commits, and diff stats.
- Generate statistics from GitHub activity (issues, comments, PRs).
- Create a video visualization, such as the one made for [ActivityWatch]().
- Create a video visualization, such as the one made for [ActivityWatch](http://www.youtube.com/watch?v=zjIn43lZq3U).

## Gource visualization

This also includes scripts to produce a visualization of the commit history with [gource](https://gource.io/).

Usage:
### Usage

```
```bash
cd video
./gource-output.sh
```

NOTE: It assumes you have the repos cloned with a certain directory structure. You will probably need to modify the script to suit your folder structure.
### Directory Structure

The script assumes a specific directory layout relative to the video folder:

```txt
../../../ # rootdir
├── activitywatch/ # Main bundle repo (cloned as activitywatch or .)
│ ├── aw-core/
│ ├── aw-client/
│ ├── aw-server/
│ │ └── aw-webui/
│ ├── aw-server-rust/
│ ├── aw-qt/
│ ├── aw-watcher-afk/
│ ├── aw-watcher-window/
│ └── ...
├── other/ # Other official repos
│ ├── aw-client-js/
│ ├── aw-watcher-web/
│ ├── aw-watcher-window-wayland/
│ ├── aw-tauri/
│ ├── aw-sync/
│ ├── aw-notify/
│ ├── activitywatch.github.io/
│ ├── aw-research/
│ ├── aw-watcher-vscode/
│ └── aw-watcher-vim/
├── community/ # Community-contributed projects
│ ├── awatcher/ # https://github.com/2e3s/awatcher
│ ├── aw-watcher-media-player/
│ ├── aw-watcher-jetbrains/
│ └── activitywatch-plasmoid/
├── docs/
└── old/
└── activitywatch-old/
```

### Including Community Repos

To include community projects in the visualization:

1. Create a `community/` directory next to the main repos
2. Clone the community repos you want to include:

```bash
mkdir -p community
cd community
git clone https://github.com/2e3s/awatcher
git clone https://github.com/2e3s/aw-watcher-media-player
git clone https://github.com/OlivierMary/aw-watcher-jetbrains
git clone https://github.com/NicoWeio/activitywatch-plasmoid
```

The script will automatically skip repos that aren't found, so you can include as many or as few community repos as desired.

### Output

[![Example of visualization rendered with gource](http://img.youtube.com/vi/zjIn43lZq3U/0.jpg)](http://www.youtube.com/watch?v=zjIn43lZq3U "ActivityWatch Development Visualization 2014-2020, with Gource")

### Adding music

After generating `gource.mp4`, you can add music with:

```bash
./gource-output-add-music.sh
```
69 changes: 61 additions & 8 deletions video/gource-output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ echo "Building stuff"
# Bundle repo
gource --output-custom-log $tmpdir/activitywatch.txt $rootdir

# ===========================================
# Official ActivityWatch modules
# ===========================================
modules=(
aw-core
# clients
Expand All @@ -33,25 +36,72 @@ modules=(
docs
# misc
other/aw-research
# experimental
other/aw-tauri
# sync and notifications
other/aw-sync
other/aw-notify
# old
old/activitywatch-old
# hidden due it causing a mess
#other/aw-android
)

# ===========================================
# Community-contributed projects
# These are popular community projects from awesome-activitywatch
# Clone them to $rootdir/community/ before running
# ===========================================
community_modules=(
# Watchers
community/awatcher # Popular X11/Wayland watcher by @2e3s
community/aw-watcher-media-player # Media playback watcher by @2e3s
# Editor integrations
other/aw-watcher-vscode # VSCode extension
other/aw-watcher-vim # Vim extension
community/aw-watcher-jetbrains # JetBrains IDEs
# Desktop widgets
community/activitywatch-plasmoid # KDE Plasma widget by @NicoWeio
)

for path in "${modules[@]}"; do
name=$(basename $path)
loc=$(echo $name | sed -E "s#.+-watcher-.+#watchers/$name#g")
loc=$(echo $loc | sed -E "s#.+-client.*#clients/$name#g")
loc=$(echo $loc | sed -E "s#.+-server.*#servers/$name#g")
loc=$(echo $loc | sed -E "s#docs|activitywatch.github.io#website/$name#g")
echo $name $loc
gource --output-custom-log $tmpdir/$name.txt $rootdir/$path
sed -i -r "s#(.+)\\|#\\1|/$loc#" $tmpdir/$name.txt
if [ -d "$rootdir/$path" ]; then
gource --output-custom-log $tmpdir/$name.txt $rootdir/$path
sed -i -r "s#(.+)\\|#\\1|/$loc#" $tmpdir/$name.txt
else
echo " -> Skipping (not found): $rootdir/$path"
fi
done

# Process community modules
for path in "${community_modules[@]}"; do
name=$(basename $path)
# Categorize community modules
if [[ $name == *"watcher"* ]] || [[ $name == "awatcher" ]]; then
loc="watchers/community/$name"
elif [[ $name == *"plasmoid"* ]] || [[ $name == *"widget"* ]]; then
loc="widgets/$name"
else
loc="community/$name"
fi
echo "$name -> $loc (community)"
if [ -d "$rootdir/$path" ]; then
gource --output-custom-log $tmpdir/$name.txt $rootdir/$path
sed -i -r "s#(.+)\\|#\\1|/$loc#" $tmpdir/$name.txt
else
echo " -> Skipping (not found): $rootdir/$path"
fi
done

# Remove all files in activitywatch-old repo when rewrite began
# TODO: Remove in a logical order (deepest first)
sed -E 's/.+[|](.+)[|].+[|](.+)/1461708000|\1|D|\2/g' $tmpdir/activitywatch-old.txt | uniq > $tmpdir/fixes.txt
sed -E 's/.+[|](.+)[|].+[|](.+)/1461708000|\1|D|\2/g' $tmpdir/activitywatch-old.txt 2>/dev/null | uniq > $tmpdir/fixes.txt || true

gourcelog=$tmpdir/combined.gource

Expand Down Expand Up @@ -86,24 +136,27 @@ sed -i 's/johan-bjareholt/Johan Bjäreholt/g' $gourcelog
sed -i -E 's/Erik Bj.{1,4}reholt/Erik Bjäreholt/g' $gourcelog
sed -i 's/dependabot.+/dependabot/g' $gourcelog
sed -i 's/Bill-linux/Bill Ang Li/g' $gourcelog
# Community contributor name fixes
sed -i 's/2e3s/Denis Gavrilov/g' $gourcelog
sed -i 's/NicoWeio/Nico Weißenbacher/g' $gourcelog

# Remove names which have been spamming commits in CI (accidental bad CI config)
sed -i 's/.*ErikBjare.*//g' $gourcelog

# Prepare avatars
# TODO: Doesn't fetch avatars from all repos (only the ones with most contributors)
# run for contributor-stats repo, initialized .git/avatars folder
if [ -x .git/avatars ]; then
if [ -d .git/avatar ]; then
perl fetch-avatars.pl
# run for bundle repo, move avatars to local .git/avatars
fetchsrc=$(realpath fetch-avatars.pl)
pushd $rootdir; perl $fetchsrc; popd; mv $rootdir/.git/avatar/* .git/avatar
pushd $rootdir/aw-server/aw-webui; perl $fetchsrc; popd; mv $rootdir/aw-server/aw-webui/.git/avatar/* .git/avatar
pushd $rootdir/docs; perl $fetchsrc; popd; mv $rootdir/docs/.git/avatar/* .git/avatar
pushd $rootdir; perl $fetchsrc; popd; mv $rootdir/.git/avatar/* .git/avatar 2>/dev/null || true
pushd $rootdir/aw-server/aw-webui; perl $fetchsrc; popd; mv $rootdir/aw-server/aw-webui/.git/avatar/* .git/avatar 2>/dev/null || true
pushd $rootdir/docs; perl $fetchsrc; popd; mv $rootdir/docs/.git/avatar/* .git/avatar 2>/dev/null || true
fi

# Rename avatars to suit committer name
cp ../.git/avatar/johan-bjareholt.png '../.git/avatar/Johan Bjäreholt.png'
[ -f ../.git/avatar/johan-bjareholt.png ] && cp ../.git/avatar/johan-bjareholt.png '../.git/avatar/Johan Bjäreholt.png'

# Resolutions:
# - 2560x1440 (for upload)
Expand Down
Loading
Loading