Remix.run Logo
IshKebab 3 hours ago

This is cool. I bought an Inkplate for this and got as far as writing a custom image format suitable for e-ink sort of things (4-bit RLE; trivial to decode, but good compression for diagram/text type images).

Where I got stuck is calendars... Unfortunately Google Calendar doesn't seem to provide a nice API where you can just say "give me the events for these days", instead you can only download all of your events in iCal format. It's then extremely non-trivial to convert that information into "what is happening today".

xd1936 2 hours ago | parent [-]

There are several ways to get all events for the day! The easiest one in my experience has been to write a simple Apps Script project and expose that as a published Web App[1]. That moves all of the oAuth logic and Calendar API plumbing to Google's server-side code, and gives you a simple long URL that contains exactly what data you want.

Something like:

```

function doGet(req) {

  let start = new Date();

  start.setHours(12,0,0,0);

  let end = new Date(start);

  end.setDate(end.getDate() + 3);

  let events = CalendarApp.getEvents(start, end);

  return ContentService.createTextOutput(events.map(x => x.getTitle()));
}

```

1. https://developers.google.com/apps-script/guides/web

IshKebab an hour ago | parent [-]

Ooo sweet, thanks for the hint!