diff --git a/alembic/versions/20250114_c800cc42184a_set_none_subtitles_to_null.py b/alembic/versions/20250114_c800cc42184a_set_none_subtitles_to_null.py new file mode 100644 index 000000000..f047a7074 --- /dev/null +++ b/alembic/versions/20250114_c800cc42184a_set_none_subtitles_to_null.py @@ -0,0 +1,23 @@ +"""Set none subtitles to null + +Revision ID: c800cc42184a +Revises: 579786fecbf4 +Create Date: 2025-01-14 18:36:21.116427+00:00 + +""" + +from alembic import op + +# revision identifiers, used by Alembic. +revision = "c800cc42184a" +down_revision = "579786fecbf4" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.execute("update editions set subtitle = null where subtitle = 'None'") + + +def downgrade() -> None: + pass diff --git a/src/palace/manager/core/opds2_import.py b/src/palace/manager/core/opds2_import.py index 857a0cf2d..535a715db 100644 --- a/src/palace/manager/core/opds2_import.py +++ b/src/palace/manager/core/opds2_import.py @@ -630,7 +630,11 @@ def _extract_publication_metadata( self.log.debug(f"Started extracting metadata from publication {publication}") title = str(publication.metadata.title) - subtitle = str(publication.metadata.subtitle) + subtitle = ( + str(publication.metadata.subtitle) + if publication.metadata.subtitle + else None + ) languages = first_or_default(publication.metadata.languages) derived_medium = self._extract_medium_from_links(publication.links)