Here is information about the module itself.
You can use this in a Python script by using import dayone_export.
The Entry class¶
- class dayone_export.Entry(filename)¶
Parse a single journal entry.
Raises: IOError, KeyError
Acts like a read-only dictionary. The keys are as defined in the plist file by the Day One App, with minor exceptions:
- What Day One calls “Entry Text”, we call “Text”.
- The “Location”, “Weather”, “Creator”, and “Music” dictionaries are flattened, so that their subkeys are accessible as keys of the main dictionary.
- The “Photo” key is added and contains the path to attached photo.
- The “Date” key is added and contains the localized date.
Note that the “Creation Date” contains a naive date (that is, with no attached time zone) corresponding to the UTC time.
- place([levels, ignore=None])¶
Format entry’s location as string, with places separated by commas.
- levels (list of int) – levels of specificity to include
- ignore (string or list of strings) – locations to ignore
The levels parameter should be a list of integers corresponding to the following levels of specificity defined by Day One.
- 0: Place Name
- 1: Locality (e.g. city)
- 2: Administrative Area (e.g. state)
- 3: Country
Alternately, levels can be an integer n to specify the n smallest levels.
The keyword argument ignore directs the method to ignore one or more place names. For example, you may want to ignore your home country so that only foreign countries are shown.
List all keys.
Journal parsing and exporting¶
- dayone_export.parse_journal(foldername[, reverse=False])¶
Return a list of Entry objects, sorted by date
- dayone_export.dayone_export(dayone_folder[, **kwargs])¶
Render a template using entries from a Day One journal.
- dayone_folder (string) – Name of Day One folder; generally ends in .dayone.
- reverse (bool) – If true, the entries are formatted in reverse chronological order.
- tags (list of strings) – Only include entries with the given tags. This paramater can also be the literal string any, in which case only entries with tags are included. Tags are interpreted as words at the end of an entry beginning with #.
- exclude (list of strings) – Exclude all entries with given tags.
- before (naive datetime) – Only include entries on before the given date.
- after (naive datetime) – Only include entries on or after the given date.
- format (string) – The file extension of the default template to use.
- template (string) – Template file name. The program looks for the template first in the current directory, then the template directory.
- template_dir (string) – Directory containing templates. If not given, the program looks in ~/.dayone_export followed by the dayone_export package.
- autobold (bool) – Specifies that the first line of each post should be a heading
- nl2br (bool) – Specifies that new lines should be translated in to <br>s
- filename_template (string) – An eventual filename, which can include strftime formatting codes. Each time the result of formatting an entry’s timestamp with this changes, a new result will be returned.
Iterator yielding (filename, filled_in_template) as strings on each iteration.