mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-04 07:26:14 +02:00
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:
parent
183795d3f5
commit
7f5fbca658
5 changed files with 33 additions and 10 deletions
|
@ -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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue