diff --git a/papis-marvin b/papis-marvin index 58a3a00..b3f5019 100755 --- a/papis-marvin +++ b/papis-marvin @@ -6,7 +6,7 @@ # annotations as 'csv' format and then point the script to the # resulting file. import sys -from typing import List +from typing import Dict, List import papis.api import papis.commands.list import papis.database @@ -24,7 +24,7 @@ def main(fpath, db): write_to_files(notes) -def get_all_annotations(db, csv): +def get_all_annotations(db, csv) -> Dict: notes = {} note_file = "" for row in csv: @@ -54,6 +54,17 @@ def get_all_annotations(db, csv): return notes +def get_documents(db, author, title) -> List: + return db.query(f"author:({author}) title:({title})") + + +def get_notefile(document) -> str | None: + note_file = papis.commands.list.run(notes=True, documents=document) + if not note_file: + return + return str(note_file[0]) + + # TODO Implement manual note creation def manual_papis_entry(): if input(f"Create note file now? [y/N] ") == "y": @@ -68,17 +79,6 @@ def manual_papis_entry(): return -def get_documents(db, author, title) -> List: - return db.query(f"author:({author}) title:({title})") - - -def get_notefile(document) -> str | None: - note_file = papis.commands.list.run(notes=True, documents=document) - if not note_file: - return - return str(note_file[0]) - - # TODO implement custom formatting (akin to pubs-extract) def format_entry(row) -> str: text = f"> {row['HighlightText']}" @@ -104,7 +104,7 @@ def is_same_book(title): return False -def write_to_files(notes): +def write_to_files(notes: Dict): # write to notes for f, entries in notes.items(): if f: