Skip to content

Commit

Permalink
Mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Mar 6, 2024
1 parent 61411c9 commit d95a41f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/palace_tools/models/internal/bookshelf.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit d95a41f

Please sign in to comment.