From a4460ec17b5bb457887b59fe76c4b2a499f21555 Mon Sep 17 00:00:00 2001 From: WorldTeacher Date: Tue, 28 Oct 2025 10:46:45 +0100 Subject: [PATCH] chore: add log to file --- src/logic/zotero.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/logic/zotero.py b/src/logic/zotero.py index e5847d1..c508799 100644 --- a/src/logic/zotero.py +++ b/src/logic/zotero.py @@ -5,6 +5,7 @@ from pyzotero import zotero from src import settings from src.logic.webrequest import BibTextTransformer, WebRequest +from src.shared.logging import log @dataclass @@ -185,7 +186,7 @@ class ZoteroController: web = WebRequest() web.get_ppn(isbn) data = web.get_data_elsa() - bib = BibTextTransformer("ARRAY") + bib = BibTextTransformer() bib.get_data(data) book = bib.return_data() return book @@ -207,13 +208,14 @@ class ZoteroController: authors = [ Creator().from_string(author).__dict__ for author in book.author.split(";") ] + authors = [author for author in authors if author["lastName"] is not None] bookdata.creators = authors return bookdata def createItem(self, item) -> Optional[str]: resp = self.zot.create_items([item]) # type: ignore if "successful" in resp.keys(): - # #print(resp["successful"]["0"]["key"]) + log.debug(resp) return resp["successful"]["0"]["key"] else: return None @@ -227,6 +229,7 @@ class ZoteroController: break def createHGSection(self, book: Book, data: dict) -> Optional[str]: + log.debug(book) chapter = BookSection() chapter.assign(book) chapter.pages = data["pages"] @@ -244,7 +247,7 @@ class ZoteroController: ] chapter.creators += authors - # #print(chapter.to_dict()) + log.debug(chapter.to_dict()) return self.createItem(chapter.to_dict()) pass