forked from tjburch/latex-progress-tracker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdateProgress.sh
executable file
·28 lines (19 loc) · 932 Bytes
/
updateProgress.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# If you want to run this as a cron job, on OSX you need to add the following to your PATH
# Not on OSX, you'll need to find the corresponding directories
# export PATH=/usr/local/bin:/Library/TeX/texbin/:$PATH
echo "Updating progress"
TEX_DOC='/home/runner/work/Thesis/Thesis/main.tex'
DOCUMENT='/home/runner/work/Thesis/main.pdf'
DIR='/home/runner/work/Thesis/Thesis/'
PROGRESSFILE='progress.csv'
# Setup CSV if it doesn't exist
if [ ! -f ${PROGRESSFILE} ]; then
echo "timestamp,wordcount,pagecount" >> ${PROGRESSFILE}
fi
WORDCOUNT=`texcount -sum -total -inc ${TEX_DOC} -dir ${DIR} | grep "Sum count:" | tr -d "Sum count::"`
PAGECOUNT=`pdfinfo ${DOCUMENT} | grep Pages | tr -d "Pages: "`
echo `date '+%Y-%m-%d %H:%M:%S'`,$WORDCOUNT,$PAGECOUNT >> $PROGRESSFILE
echo "Done! Page count ${PAGECOUNT}, word count ${WORDCOUNT}. Written to ${PROGRESSFILE}"
cat progress.csv
python plotProgress.py ${PROGRESSFILE}