View Single Post
Old 08-20-2012, 07:59 PM   #86
janek
Groupie
janek has memorized the entire works of Homer, Shakespeare, and Jane Austenjanek has memorized the entire works of Homer, Shakespeare, and Jane Austenjanek has memorized the entire works of Homer, Shakespeare, and Jane Austenjanek has memorized the entire works of Homer, Shakespeare, and Jane Austenjanek has memorized the entire works of Homer, Shakespeare, and Jane Austenjanek has memorized the entire works of Homer, Shakespeare, and Jane Austenjanek has memorized the entire works of Homer, Shakespeare, and Jane Austenjanek has memorized the entire works of Homer, Shakespeare, and Jane Austenjanek has memorized the entire works of Homer, Shakespeare, and Jane Austenjanek has memorized the entire works of Homer, Shakespeare, and Jane Austenjanek has memorized the entire works of Homer, Shakespeare, and Jane Austen
 
Posts: 175
Karma: 23456
Join Date: Feb 2012
Device: Boox m92
Okay, a first step to implement the above: a silly little bash script to generate rather crude weekly planner template in pdf to be used in m92 for storing daily agendas/notes/meetings information/whatever. Basically it is just an e-ink version of the old-fashioned paper planner.

To use:
Write the code to disk as filename.sh, change the permissions to executable. Invoke with two options - the starting date (format YYYY-MM-DD) and the number of weeks (eg. filename.sh 2012-08-21 10 produces a 10-week planner beginning with the first day of the current week).

Outcome:
A pdf file named calendar.pdf, containing a number of pages equal to the given number of weeks, each containg 7 dated boxes to write your scribbles. Example 52-week calendar file can be downloaded here (day names in Polish because this is my locale - the script should generate a calendar in your language depending on your locale setting)

Requirements/Limitations:
- Requires imagemagick and pdftk. Relies on 'date' command so linux-only.
- Have no idea what happens if your locale uses date format different from YYYY-MM-DD. Perhaps the first option needs to be changed accordingly?
- Currently the pdf only allows for storing handwritten notes (annotations won't be saved).

Ideas:
- Option to merge the calendar pdf with some nice backgrounds, perhaps different for every month/year/season
- Option to change fonts etc
- Option to include name day information (where to get it?)
- Play a little with file resolutions for better result
- Don't use imagemagick for pdf generation (ugly)
- ...

Code:
#!/bin/bash

datapocz=$1
tygodni=$(($2-1))

if [ -a calendar.pdf ] 
then
	echo "Calendar file exists"
	exit 1
fi

n=0
until [ `date --date="$datapocz $n days ago" +%u` == "1" ]; do
	let "n = $n+1"
done

datapocz=`date --date="$datapocz $n days ago" +%F`
for i in `seq 0 $tygodni`;
do
	convert -size 850x1200 xc:none -stroke black -pointsize 20 -gravity NorthEast \
	-draw "line 0,170 850,170" -draw "text 0,0 '`date --date="$datapocz $i weeks" +%A\ %F`'" \
	-draw "line 0,341 850,341" -draw "text 0,171 '`date --date="$datapocz $i weeks 1 day" +%A\ %F`'" \
	-draw "line 0,512 850,512" -draw "text 0,342 '`date --date="$datapocz $i weeks 2 days" +%A\ %F`'" \
	-draw "line 0,683 850,683" -draw "text 0,513 '`date --date="$datapocz $i weeks 3 days" +%A\ %F`'" \
	-draw "line 0,854 850,854" -draw "text 0,684 '`date --date="$datapocz $i weeks 4 days" +%A\ %F`'" \
	-draw "line 0,1025 850,1025" -draw "text 0,855 '`date --date="$datapocz $i weeks 5 days" +%A\ %F`'" \
	-draw "text 0,1026 '`date --date="$datapocz $i weeks 6 days" +%A\ %F`'" \
	/tmp/booxcal_`date +%s%N`.pdf
done
pdftk /tmp/booxcal_*.pdf cat output calendar.pdf
rm -rf /tmp/booxcal_*.pdf

Last edited by janek; 08-20-2012 at 08:11 PM.
janek is offline   Reply With Quote