-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the fetch-lcp command to have two subcommands #15
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Some defaults | ||
DEFAULT_ASYNC_TIMEOUT = 30.0 | ||
DEFAULT_AUTH_DOC_PATH_SUFFIX = "/authentication-document" | ||
DEFAULT_AUTH_DOC_PATH_SUFFIX = "authentication_document" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needed to be updated to be able to use the |
||
DEFAULT_REGISTRY_URL = "https://registry.thepalaceproject.org" | ||
DEFAULT_USER_AGENT = "Palace" | ||
|
||
|
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: | ||
|
@@ -18,13 +19,21 @@ 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}") | ||
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 link.properties | ||
else None | ||
): | ||
print(f" LCP hashed passphrase: {hashed_pw}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is useful to have included in the output for the bookshelf. |
||
print("\n", " Holds:" if holds else " No holds.", sep="") | ||
for p in holds: | ||
print(f" {p.metadata.title}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated these to match the
fetch_lcp
command, since one took args and one took options. Was a bit confusing when using the two commands back to back.