forked from quantumgardener/dayone-to-obsidian
-
Notifications
You must be signed in to change notification settings - Fork 2
/
import.py
30 lines (24 loc) · 1.21 KB
/
import.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import click
from utils import process_journal
from pathlib import Path
@click.command()
@click.argument("folder", type=click.Path(exists=True, file_okay=False))
@click.option('-v', '--verbose', count=True)
@click.option('--icons/--no-icons', help="Use the obsidian icons plugin", default=False)
@click.option(
"--tags-prefix",
help="Prefix to add as part of the tag name for sub-tags",
default="#journal/",
)
def convert(verbose, icons, tags_prefix, folder):
"""Converts DayOne entries into markdown files suitable to use as an Obsidian vault.
Each journal will end up in a sub-folder named after the file (e.g.: Admin.json -> admin/). All JSON files
in the FOLDER will be processed, remove those you don't want processed. The FOLDER will also be the destination
for converted markdown files. After conversion you can open this folder as a vault in Obsidian. This is done
to prevent accidental modification of an existing vault.
FOLDER is the folder where your DayOne exports reside and where the converted markdown files will be written.
"""
for filename in Path(folder).glob("*.json"):
process_journal(filename, icons, tags_prefix, verbose)
if __name__ == "__main__":
convert()