https://github.com/brunofpessoa/kindle-highlights
A Go program that converts Kindle "My Clippings.txt" file into an SQLite database and provides options to filter and display your highlights.
https://github.com/brunofpessoa/kindle-highlights
go kindle-clippings kindle-highlights
Last synced: 7 months ago
JSON representation
A Go program that converts Kindle "My Clippings.txt" file into an SQLite database and provides options to filter and display your highlights.
- Host: GitHub
- URL: https://github.com/brunofpessoa/kindle-highlights
- Owner: brunofpessoa
- Created: 2023-09-30T22:13:42.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-24T18:21:14.000Z (almost 2 years ago)
- Last Synced: 2025-02-10T02:16:01.162Z (8 months ago)
- Topics: go, kindle-clippings, kindle-highlights
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kindle Highlights to SQLite Converter
This is my "hello world" in Go.
This Go program is designed to convert Kindle highlights and notes from a text file (typically "My Clippings.txt" generated by a Kindle device) into a SQLite database. It also provides options to filter and display the highlights and notes based on certain criteria.
>Note: The program only accept english and brazilian portuguese files due to variations in the date format.
## Table of Contents
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Options](#options)
- [Examples](#examples)## Getting Started
Before using the program, make sure you have Go installed on your system. You can download and install Go from the official website: [https://golang.org/dl/](https://golang.org/dl/)
Once you have Go installed, follow these steps:
1. Clone the repository:
```bash
git clone https://github.com/brunofpessoa/kindle-highlights.git
```2. Change to the project directory:
```bash
cd kindle-highlights
```3. Build the program:
```bash
go build
```4. Run the program:
```bash
./kindle-highlights [options]
```## Usage
The program takes a text file containing Kindle highlights and notes as input and stores them in a SQLite database. You can then query and display the highlights and notes using various filtering options.
## Options
- `-db`: Specifies the name of the SQLite database file to be created or used. (Default: database.sqlite3)
- `-file`: Specifies the path to the text file containing Kindle highlights and notes. (Default: My Clippings.txt)
- `-max`: Specifies the maximum length (in characters) of a highlight or note. Highlights exceeding this length will be excluded. (Default: 500)
- `-min`: Specifies the minimum length (in characters) of a highlight or note. Highlights shorter than this length will be excluded. (Default: 10)
- `-book`: Allows you to filter highlights and notes by specifying the book's name. You can enter either the full name or a partial name of the book.
- `-all`: If this flag is set, all highlights and notes will be displayed. You can combine it with other flags
- `-no-duplicate`: Restricts insertion of highlights that looks like the same, keeping the last one created. (Default: true)
- `-list-books`: List all books. (Default: false)
## Examples
1. **Convert Kindle Highlights to SQLite Database**:
To convert the highlights from "My Clippings.txt" into an SQLite database named "my_highlights.db", use the following command:
```bash
./kindle-highlights -db="my_highlights.db" -file="My Clippings.txt"
```2. **Display All Highlights and Notes**:
To display all highlights and notes without any filtering, use the following command:
```bash
./kindle-highlights -db="my_highlights.db" -all
```3. **Display Highlights and Notes for a Specific Book**:
To display highlights and notes for a specific book (e.g., "Os irmãos Karamzov") with a minimum length of 20 and max of 200 characters, use the following command:
```bash
./kindle-highlights -db="my_highlights.db" -book="Os irmãos Karamázov" -min=20 -max=200
```4. **Display All Highlights and Notes from a Specific Book**:
To display all highlights and notes without any filtering, use the following command:
```bash
./kindle-highlights -db="my_highlights.db" -book="Os irmãos Karamázov" -all
```5. **Display All Books**:
To display all books, use the following command:
```bash
./kindle-highlights -db="my_highlights.db" -list-books
```Note: You can combine options as needed to filter and display highlights and notes based on your preferences.