diff --git a/jrnl/dayone2.py b/jrnl/dayone2.py deleted file mode 100644 index ec8e6c9a..00000000 --- a/jrnl/dayone2.py +++ /dev/null @@ -1,29 +0,0 @@ -import json - -from datetime import datetime - -from .Entry import Entry -from . import Journal - - -class DayOne2(Journal.PlainJournal): - def __init__(self, **kwargs): - super().__init__(**kwargs) - - def _parse(self, json_data): - - entries = [] - - json_string = json.loads(json_data) - - for entry in json_string["entries"]: - entries.append( - Entry( - self, - date=datetime.strptime(entry["creationDate"], "%Y-%m-%dT%H:%M:%SZ"), - text=entry["text"], - starred=entry["starred"], - ) - ) - - return entries diff --git a/jrnl/plugins/json_importer.py b/jrnl/plugins/json_importer.py index bff811fa..6ccb3b63 100644 --- a/jrnl/plugins/json_importer.py +++ b/jrnl/plugins/json_importer.py @@ -30,7 +30,7 @@ class JSONImporter(PlainJournal, TextExporter): def import_file(self): """Reads a JSON file and returns a dict.""" - if os.path.exists(self.path): + if os.path.exists(self.path) and Path(self.path).suffix == '.json': try: with open(self.path) as f: return json.load(f)