Adding your google calendar agenda to your daily journal

And one more round of improvements…

Templater User function, agenda:

/usr/local/bin/gcalcli  agenda --details all --tsv --nodeclined "$from" "$to"

And a Day Planner friendly template for output in the daily journal:


## Day Planner

<%*
function parseAgendaTsv(agenda) {
return agenda.split("\n").map(event => {
	let props = event.split("\t")
	// [gcalcli handlers](https://github.com/insanum/gcalcli/blob/master/gcalcli/details.py#L251-L259)
	return ({startDate: props[0],
				startTime: props[1],
				endDate: props[2],
				endTime: props[3],
				calendarUrl: props[4],
				notSure5: props[5],
				conferenceType: props[6],
				conferenceUrl: props[7],
				title: props[8],
				location: props[9],
				description: props[10],
				calendar: props[11],
				meetingUrlOrLocation: props[6] == "video" ? props[7] : props[9],
				raw: event,
	})
})
}

let tsvAgenda = await tp.user.agenda({from: tp.file.title + " 00:00", 
                                  to: tp.file.title + " 23:59"})
								  
agenda = parseAgendaTsv(tsvAgenda)

// filter the agenda as needed, e.g. for only the work calendar events:
agenda = agenda.filter((e,i) => e.calendar == "<work calendar>" )

tR += agenda.map(e => { return `- [ ] ${e.startTime} ${e.title} ${e.meetingUrlOrLocation}`}).join('\n')

%>
1 Like