diff --git a/src/palace_tools/models/internal/bookshelf.py b/src/palace_tools/models/internal/bookshelf.py index 16351c6..96e686d 100644 --- a/src/palace_tools/models/internal/bookshelf.py +++ b/src/palace_tools/models/internal/bookshelf.py @@ -1,4 +1,5 @@ from palace_tools.models.api.opds2 import OPDS2Feed +from palace_tools.utils.misc import ensure_list def print_bookshelf_summary(bookshelf: OPDS2Feed) -> None: @@ -18,14 +19,20 @@ def print_bookshelf_summary(bookshelf: OPDS2Feed) -> None: print("\n", " Loans:" if loans else " No loans.", sep="") for p in loans: - print(f"\n {p.metadata.title} ({p.metadata.author.name})") + authors = ", ".join([a.name for a in ensure_list(p.metadata.author)]) + print(f"\n {p.metadata.title} ({authors})") for link in p.acquisition_links: print(f" Fulfillment url: {link.href}") for indirect in ( lnk for lnk in link.indirect_acquisition_links if lnk.get("type") ): print(f" Indirect type: {indirect['type']}") - if hashed_pw := link.properties.get("lcp_hashed_passphrase"): + + if ( + hashed_pw := link.properties.get("lcp_hashed_passphrase") + if link.properties + else None + ): print(f" LCP hashed passphrase: {hashed_pw}") print("\n", " Holds:" if holds else " No holds.", sep="") for p in holds: