#!/bin/sh

# deprecated for Processing visualizations http://fabien.benetou.fr/Wiki/Visualization#timeline
if [[ ! ("$#" == 1) ]]; then
  echo 'Generate GNUPlot visualization for the PmWiki directory'
  echo "Usage : $0 path_to_PmWiki_directory"
  exit 1
fi
NOW_EPOCH=$(date +"%s")
for PAGE in $(ls $1/wiki.d/* | grep -v PmWiki. | grep -v Site | sed "s/.*wiki\.d\///")
do
 wiki_page_diffs $1/wiki.d/$PAGE > $1/pub/visualization/edits_per_page/$PAGE.data;
  echo -e "set terminal png\nset output '$PAGE.png'\nset notitle\nset nokey\nset xlabel ''\nset format x ''\nset format y ''\nset ylabel ''\nset timefmt '%s'\nset size 1,0.05\nplot [1214268628:$NOW_EPOCH] [0:] '$PAGE.data' using 1:0\n" > $1/pub/visualization/edits_per_page/$PAGE.plt;
done;
for PAGE in $(ls $1/wiki.d/* | grep -v PmWiki. | grep -v Site | sed "s/.*wiki\.d\///")
do
 (cd $1/pub/visualization/edits_per_page/; gnuplot $PAGE.plt;);
done