fix minor issues with corrupted data

This commit is contained in:
Your Name 2024-07-15 15:47:22 -04:00 committed by Henri Dickson
parent 18d9370ae0
commit 3fbc3624bd
4 changed files with 5 additions and 2 deletions

View file

@ -137,7 +137,7 @@ class Edition(Item):
"binding",
"pages",
"price",
"brief",
# "brief",
"localized_description",
"contents",
]

View file

@ -636,7 +636,7 @@ class Item(PolymorphicModel):
@property
def brief_description(self):
return self.display_description[:155]
return (self.display_description or "")[:155]
@classmethod
def get_by_url(cls, url_or_b62: str, resolve_merge=False) -> "Self | None":

View file

@ -80,6 +80,8 @@ class Command(BaseCommand):
lang = i.metadata.get("language")
if isinstance(lang, str) and lang:
i.metadata["language"] = [lang]
if i.__class__ == Podcast and i.metadata.get("host", None) is None:
i.metadata["host"] = i.metadata.get("hosts", [])
i.localized_title = uniq(localized_title)
localized_desc = [{"lang": detect_language(i.brief), "text": i.brief}]
i.localized_description = localized_desc

View file

@ -165,6 +165,7 @@ class Indexer:
"type": "string[]",
},
{"name": "artist", "optional": True, "locale": "zh", "type": "string[]"},
{"name": "host", "optional": True, "locale": "zh", "type": "string[]"},
{"name": "company", "optional": True, "locale": "zh", "type": "string[]"},
{"name": "developer", "optional": True, "locale": "zh", "type": "string[]"},
{"name": "publisher", "optional": True, "locale": "zh", "type": "string[]"},