Metadata-Version: 2.1
Name: ics-to-datasette
Version: 0.3.0
Summary: Convert an ICS file to a SQLite database
Home-page: https://github.com/iloveitaly/ics-to-datasette
License: MIT
Keywords: ics,calendar,datasette,sqlite,sqlite-database,datasette-tool
Author: Michael Bianco
Author-email: mike@mikebian.co
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: click (>=8.1.7,<9.0.0)
Requires-Dist: ics (>=0.7.2,<0.8.0)
Requires-Dist: sqlite-utils (>=3.36,<4.0)
Description-Content-Type: text/markdown

# ICS to SQLite

This repository contains a script that converts ICS calendar files to SQLite databases. It's useful for analyzing and manipulating calendar data, especially when combined with [Datasette](https://datasette.io).

## Usage

```shell
pip install ics-to-datasette

ics-to-datasette calendar.ics
```

Here's the full help options:

```shell
Usage: ics-to-datasette [OPTIONS] ICS_FILES...

Options:
  --output [json|sqlite]
  --dbname TEXT           Name of the SQLite database file
  --help                  Show this message and exit.
```

## Development

Run the script with the following command:

```shell
poetry run python run.py <ics_file_paths> --output=json
```

### Getting Calendar Data From Google Calendar

You can download your calendar data from Google Calendar by going to [Google Takeout](https://takeout.google.com/settings/takeout) and selecting the "Calendar" option. You can then extract the downloaded zip file and run the script on the extracted ICS files.

Select `tgz` to avoid multiple archives from being created due to file size limits.

### Datasette

You can use the `datasette` command to run a Datasette server with the generated SQLite database:

```shell
pip install datasette
datasette serve <database_path>
```

## Views

* `events_with_guests`. Only events that have at least one guest are included in this view. Guests entries like `%group.calendar.google.com` are excluded.
* `event_emails_with_count`. This view contains a list of all emails along with the number of events that each email appears in. Helpful for determining your most popular contacts.

### Library Options

Some of the python ical parsing library options I explored:

* <https://allenporter.github.io/ical/ical.html#recurring-events>
* <https://github.com/ics-py/ics-py>


## TODO

- [ ] add option for additional exclusions
