Skip to content

A Go program that converts Kindle "My Clippings.txt" file into an SQLite database and provides options to filter and display your highlights.

Notifications You must be signed in to change notification settings

brunofpessoa/kindle-highlights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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/

Once you have Go installed, follow these steps:

  1. Clone the repository:

    git clone https://github.com/brunofpessoa/kindle-highlights.git
  2. Change to the project directory:

    cd kindle-highlights
  3. Build the program:

    go build
  4. Run the program:

    ./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:

    ./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:

    ./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:

    ./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:

    ./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:

    ./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.

About

A Go program that converts Kindle "My Clippings.txt" file into an SQLite database and provides options to filter and display your highlights.

Topics

Resources

Stars

Watchers

Forks

Languages