From b8b9f9f2fc0b7956d4d9d128b4d651ef01456b08 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 24 Apr 2022 19:15:25 +0100 Subject: [PATCH] Get hashtag categories only when needed --- inbox.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/inbox.py b/inbox.py index 59ed67f6d..bef69c55c 100644 --- a/inbox.py +++ b/inbox.py @@ -227,8 +227,6 @@ def store_hash_tags(base_dir: str, nickname: str, domain: str, print('Creating tags directory') os.mkdir(tags_dir) - hashtag_categories = get_hashtag_categories(base_dir) - hashtags_ctr = 0 for tag in post_json_object['object']['tag']: if not tag.get('type'): @@ -280,6 +278,7 @@ def store_hash_tags(base_dir: str, nickname: str, domain: str, # automatically assign a category to the tag if possible category_filename = tags_dir + '/' + tag_name + '.category' if not os.path.isfile(category_filename): + hashtag_categories = get_hashtag_categories(base_dir) category_str = \ guess_hashtag_category(tag_name, hashtag_categories) if category_str: