Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 9 additions & 31 deletions src/palace/manager/api/admin/controller/work_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
INVALID_RATING,
INVALID_SERIES_POSITION,
METADATA_REFRESH_FAILURE,
METADATA_REFRESH_PENDING,
MISSING_CUSTOM_LIST,
UNKNOWN_LANGUAGE,
UNKNOWN_MEDIUM,
Expand All @@ -31,7 +30,6 @@
)
from palace.manager.api.problem_details import (
LIBRARY_NOT_FOUND,
REMOTE_INTEGRATION_FAILED,
)
from palace.manager.api.util.flask import get_request_library
from palace.manager.core.classifier import NO_NUMBER, NO_VALUE, genres
Expand Down Expand Up @@ -448,39 +446,19 @@ def unsuppress(
)

def refresh_metadata(
self, identifier_type: str, identifier: str, provider: Any | None = None
self, identifier_type: str, identifier: str
) -> Response | ProblemDetail:
"""Refresh the metadata for a book from the content server"""
"""Refresh the metadata for a book from the content server.

Metadata refresh used to run through the per-source CoverageProvider
machinery, which has been retired. No provider is wired up, so this
endpoint is retained for API compatibility but no longer performs a
refresh; it always reports failure.
Comment on lines +453 to +456

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this does nothing can we deprecate it, or just remove it entirely? What calls this endpoint? I think we need a plan to deal with this endpoint since its no longer functional.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There a 👍🏻 on this, but do we have a ticket or plan for it?

"""
library = get_request_library()
self.require_librarian(library)

work = self.load_work(library, identifier_type, identifier)
if isinstance(work, ProblemDetail):
return work

if provider is None:
return METADATA_REFRESH_FAILURE

assert work.presentation_edition is not None
primary_identifier = work.presentation_edition.primary_identifier
try:
record = provider.ensure_coverage(primary_identifier, force=True)
except Exception:
# The coverage provider may raise an HTTPIntegrationException.
return REMOTE_INTEGRATION_FAILED

if record.exception:
# There was a coverage failure.
if str(record.exception).startswith("201") or str(
record.exception
).startswith("202"):
# A 201/202 error means it's never looked up this work before
# so it's started the resolution process or looking for sources.
return METADATA_REFRESH_PENDING
# Otherwise, it just doesn't know anything.
return METADATA_REFRESH_FAILURE

return Response("", 200)
return METADATA_REFRESH_FAILURE

def classifications(
self, identifier_type: str, identifier: str
Expand Down
4 changes: 1 addition & 3 deletions src/palace/manager/celery/tasks/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ def bibliographic_apply(
load_from_id(session, Collection, collection_id) if collection_id else None
)

bibliographic.apply(
session, edition, collection, replace, create_coverage_record=False
)
bibliographic.apply(session, edition, collection, replace)


class ApplyBibliographicCallable(Protocol):
Expand Down
Loading
Loading