Sample Importer: Handle data consistently whether from file or stdin

Importers: handle writing the journal to disk ourselves (rather than delegating to the plugin)
Plugins: First pass at testing custom importer
This commit is contained in:
MinchinWeb 2021-06-26 22:09:46 -06:00 committed by Jonathan Wren
parent 183795d3f5
commit 7f5fbca658
5 changed files with 33 additions and 10 deletions

View file

@ -27,13 +27,14 @@ class Importer(BaseImporter):
data = json.loads(f)
else:
try:
data = sys.stdin.read()
f = sys.stdin.read()
except KeyboardInterrupt:
print(
"[Entries NOT imported into journal.]",
file=sys.stderr,
)
sys.exit(0)
data = json.loads(f)
for json_entry in data:
raw = json_entry["title"] + "/n" + json_entry["body"]