mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-10-04 22:05:45 +01:00
Re: Issue #122 Fetches content type from search results - displays it on thumbnails in results grid; Fetches content type from book id detail page (dfaults to "Other") and uses it to construct the `final_path`. --------- Co-authored-by: Patricia Ritter <pritter@events.com> Co-authored-by: CaliBrain <calibrain@l4n.xyz>
This commit is contained in:
co-authored by
Patricia Ritter
CaliBrain
parent
78c61e88b3
commit
2b831dcfa5
+8
-1
@@ -13,6 +13,7 @@ port = SERVER_ENV.FLASK_PORT
|
||||
server_url = f"http://localhost:{port}"
|
||||
book_title = "077484a10743e5dd5d151013e8c732f4" # "Moby Dick"
|
||||
# Directory where downloads should appear
|
||||
download_paths = SERVER_ENV.DOWNLOAD_PATHS
|
||||
download_dir = SERVER_ENV.INGEST_DIR
|
||||
# Timeout for waiting for download
|
||||
download_timeout_seconds = 60 * 5
|
||||
@@ -38,7 +39,7 @@ def check_download_status(book_id):
|
||||
continue
|
||||
|
||||
# Check success conditions based on download_path
|
||||
for status_key in ["available", "done"]:
|
||||
for status_key in ["available", "done", "complete"]:
|
||||
if status_key in status_data and book_id in status_data[status_key]:
|
||||
book_status_info = status_data[status_key].get(book_id)
|
||||
# Check if the status info is a dictionary and has a non-empty download_path
|
||||
@@ -117,6 +118,12 @@ if SERVER_ENV.USE_BOOK_TITLE:
|
||||
else:
|
||||
expected_filename = f"{book_id}.epub"
|
||||
|
||||
if book_details.get("content"):
|
||||
content = book_details.get("content")
|
||||
for key, path in SERVER_ENV.DOWNLOAD_PATHS.items():
|
||||
if key in content:
|
||||
download_dir = path
|
||||
break
|
||||
expected_filepath = os.path.join(download_dir, expected_filename)
|
||||
|
||||
assert os.path.exists(expected_filepath), f"Expected downloaded file not found at: {expected_filepath}"
|
||||
|
||||
Reference in New Issue
Block a user