Archived
9 lines
283 B
Python
9 lines
283 B
Python
from __future__ import annotations
|
|
|
|
from apps.books.models import EBook
|
|
|
|
|
|
def subjects_from_ebook(ebook: EBook) -> list[str]:
|
|
ol = (ebook.metadata_json or {}).get("openlibrary") or {}
|
|
return [s.strip() for s in (ol.get("subjects") or []) if isinstance(s, str) and s.strip()]
|