From c7dba305667578d51461960cd292a846ff295fdb Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 11 May 2025 17:55:56 +0100 Subject: [PATCH] Check for category within post object --- maps.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/maps.py b/maps.py index b5d9b7d7d..8c962ee54 100644 --- a/maps.py +++ b/maps.py @@ -312,6 +312,22 @@ def get_category_from_post(post_json_object: {}, translate: {}) -> str: if isinstance(post_obj['tag'], list): catstr = _get_category_from_tags(post_obj['tag'], translate) + if not catstr: + if post_obj.get('category'): + text = post_obj['category'] + if isinstance(text, str): + if translate.get(text): + catstr = translate[text] + elif isinstance(text, list): + catstr = '' + for cat_text in text: + if not isinstance(cat_text, str): + continue + if not translate.get(cat_text): + continue + if catstr: + catstr += ', ' + catstr += translate[cat_text] return catstr