dayone2md

package module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 22 Imported by: 0

README ¶

DayOne To Markdown

Export Dayone to Markdown.

tag Go Version GoDoc Go report Contributors License

dayone2md is a CLI application that can create a directory a markdown files from entries in Dayone. Use either a Dayone JSON archive or read directly from the Dayone database. Currently only MacOS is supported.

Features

  • Input sources:
    • JSON export archive
    • read directly from the Dayone database
  • Photos: download embedded photos and rewrite photo links
  • Wikilinks: rewrite links to other entries as wikilinks
  • Templates: supports external templates
  • Title: separate out first line of posts as a title to format as desired
  • In-place updates to output folder
  • Conditional updates: only write files to output folder that differ from source
  • Option to keep files in the output folder that do not exist at the source
  • Flag to group posts by day in a single file
  • Flag to alter sort order within day when grouped by day
  • Installation: static binary without dependencies on external libraries

🚀 Install

brew install kwo/tools/dayone2md

💡 Usage

Usage:
  dayone2md [OPTIONS]

Application Options:
  -j, --journal=      journal name to export
  -i, --input=        input file, either the DayOne.sqlite database file or the JSON export zip file
  -o, --output=       output directory
  -t, --template=     name of the template to use, either the path of an external template file or the name of a built-in template: main or
                      full (default: main)
  -g, --group         group entries by day, one file per day, multiple entries per file
  -r, --reverse       reverse chronological sort order for entries within a file, useful only if entries are grouped by day
      --keep-orphans  do not remove files in the output directory that lack a matching entry in the input file
      --version       print version and exit
  -v, --verbose       show verbose output, list multiple times for even more verbose output

Help Options:
  -h, --help          Show this help message
Example Usage
dayone2md -i "$HOME/Library/Group Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite" -o $HOME/Documents/Journal -j Journal -g -vv
dayone2md -i "$HOME/Desktop/09-07-2023_8-30-PM.zip" -o $HOME/Documents/Journal -j Journal -g -vv

Input Sources

TODO

Explain that Dayone must be started to sync (Premium users) first.

Location of database on Mac

development

make lint-fix
make lint
make install

similar projects

TODO

  • abstract destination behind an interface, add memory impl for testing
  • fill out database entity fields

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

func Convert ¶

func Convert(ctx context.Context, opts Options) error

Convert export DayOne entries to markdown.

Types ¶

type Entry ¶

type Entry struct {
	CreationDate        time.Time `json:"creationDate"`
	ModifiedDate        time.Time `json:"modifiedDate"`
	Date                time.Time `json:"-"` // CreationDate with timezone applied
	TimeZone            string    `json:"timeZone"`
	Duration            int       `json:"duration"`
	Pinned              bool      `json:"isPinned"`
	Starred             bool      `json:"starred"`
	AllDay              bool      `json:"isAllDay"`
	UUID                string    `json:"uuid"`
	Title               string    `json:"-"` // calculated
	Text                string    `json:"text"`
	Tags                []string  `json:"tags,omitempty"`
	Photos              []Photo   `json:"photos,omitempty"`
	Location            *Location `json:"location,omitempty"`
	Weather             *Weather  `json:"weather,omitempty"`
	EditingTime         float64   `json:"editingTime,omitempty"`
	CreationDevice      string    `json:"creationDevice,omitempty"`
	CreationDeviceType  string    `json:"creationDeviceType,omitempty"`
	CreationDeviceModel string    `json:"creationDeviceModel,omitempty"`
	CreationOSName      string    `json:"creationOSName,omitempty"`
	CreationOSVersion   string    `json:"creationOSVersion,omitempty"`
}

type Journal ¶

type Journal struct {
	Metadata *Metadata `json:"metadata"`
	Entries  []Entry   `json:"entries"`
}

type Location ¶

type Location struct {
	Label     string  `json:"userLabel"`
	Address   string  `json:"placeName"`
	City      string  `json:"localityName"`
	State     string  `json:"administrativeArea"`
	Country   string  `json:"country"`
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Altitude  float64 `json:"altitude"`
}

type Metadata ¶

type Metadata struct {
	Version string `json:"version"`
}

type Options ¶

type Options interface {
	GetJournalName() string
	GetInputLocation() string
	GetOutputDirectory() string
	GetTemplate() string
	IsGroupByDay() bool
	IsSortReverse() bool
	IsRemoveOrphans() bool
}

type Photo ¶

type Photo struct {
	Date                 string    `json:"date"`
	Filename             string    `json:"filename"`
	FileSize             int       `json:"fileSize"`
	Height               int       `json:"height"`
	Identifier           string    `json:"identifier"`
	IsSketch             bool      `json:"isSketch"`
	MD5                  string    `json:"md5"`
	Type                 string    `json:"type"`
	Width                int       `json:"width"`
	AppleCloudIdentifier string    `json:"appleCloudIdentifier,omitempty"`
	CameraMake           string    `json:"cameraMake,omitempty"`
	CameraModel          string    `json:"cameraModel,omitempty"`
	CreationDevice       string    `json:"creationDevice,omitempty"`
	Duration             int       `json:"duration,omitempty"`
	ExposureBiasValue    int       `json:"exposureBiasValue,omitempty"`
	Favorite             bool      `json:"favorite,omitempty"`
	FocalLength          string    `json:"focalLength,omitempty"`
	FStop                string    `json:"fnumber,omitempty"`
	LensMake             string    `json:"lensMake,omitempty"`
	LensModel            string    `json:"lensModel,omitempty"`
	Location             *Location `json:"location,omitempty"`
	OrderInEntry         int       `json:"orderInEntry,omitempty"`
}

type Weather ¶

type Weather struct {
	Conditions         string    `json:"conditionsDescription"`
	MoonPhase          float64   `json:"moonPhase"`
	MoonPhaseCode      string    `json:"moonPhaseCode"`
	PressureMB         float64   `json:"pressureMB"`
	RelativeHumidity   int       `json:"relativeHumidity"`
	SunriseDate        time.Time `json:"sunriseDate"`
	SunsetDate         time.Time `json:"sunsetDate"`
	TemperatureCelsius float64   `json:"temperatureCelsius"`
	VisibilityKM       float64   `json:"visibilityKM"`
	WeatherCode        string    `json:"weatherCode"`
	WeatherServiceName string    `json:"weatherServiceName"`
	WindBearing        int       `json:"windBearing"`
	WindSpeedKPH       float64   `json:"windSpeedKPH"`
}

Directories ¶

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL