Skip to content

Commit

Permalink
feat: Refactor Zotero2Readwise.run() to pass a custom number of Zot…
Browse files Browse the repository at this point in the history
…ero annotations and notes instead of running all.

Rename `run_all()` -> `run()`
  • Loading branch information
e-alizadeh committed Jan 1, 2022
1 parent 759fd8b commit 7c8a337
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -59,7 +59,7 @@ zt_rw = Zotero2Readwise(
include_annotations=True, # Include Zotero annotations -> Default: True
include_notes=False, # Include Zotero notes -> Default: False
)
zt_rw.run_all()
zt_rw.run()
```

## Approach 2:
Expand Down
5 changes: 3 additions & 2 deletions zotero2readwise/zt2rw.py
Expand Up @@ -40,8 +40,9 @@ def get_all_zotero_items(self) -> List[Dict]:
print(f"{len(all_zotero_items)} Zotero items are retrieved.")
return all_zotero_items

def run_all(self) -> None:
zot_annots_notes = self.get_all_zotero_items()
def run(self, zot_annots_notes: List[Dict] = None) -> None:
if zot_annots_notes is None:
zot_annots_notes = self.get_all_zotero_items()
formatted_items = self.zotero.format_items(zot_annots_notes)
if self.zotero.failed_items:
self.zotero.save_failed_items_to_json("failed_zotero_items.json")
Expand Down

0 comments on commit 7c8a337

Please sign in to comment.