diff --git a/main.py b/main.py index b3de0bf7dd6ae7d2c9a1c2e97732d532ab080d62..69afaa075d84910fa4e1878795b6298634850ea3 100644 --- a/main.py +++ b/main.py @@ -9,17 +9,12 @@ if __name__ == '__main__': ignore_keywords=True, enable_notebook=False, authors={ - "Python小白进阶": "youcans", - "youcans": "youcans", - "AI浩": "hhhhhhhhhhwwwwwwwwww", - "hhhhhhhhhhwwwwwwwwww": "hhhhhhhhhhwwwwwwwwww", - "吴佳WuJia": "yvettewu", - "yvettewu": "yvettewu", - "幻灰龙": "huanhuilong", - "feilong": "huanhuilong", - "huanhuilong": "huanhuilong", - "xiaozhi_5638": "xiaozhi_5638", - "请叫我卷福": "xiaozhi_5638" + "youcans":["Python小白进阶"], + "hhhhhhhhhhwwwwwwwwww":["AI浩"], + "yvettewu": ["吴佳WuJia"], + "huanhuilong":["幻灰龙", + "feilong"], + "xiaozhi_5638": ["请叫我卷福"], } ) walker.walk() diff --git a/src/tree.py b/src/tree.py index 99a69363bd3f9de50fd9f017b7164fde53bce8c8..7a18dd22448a0d30309b4ace87c785307271393d 100644 --- a/src/tree.py +++ b/src/tree.py @@ -16,6 +16,12 @@ formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) logger.addHandler(handler) +def search_author(author_dict, username): + for key in author_dict: + names = author_dict[key] + if username in names: + return key + return username def user_name(md_file, author_dict): ret = subprocess.Popen([ @@ -27,8 +33,7 @@ def user_name(md_file, author_dict): if line.startswith('Author'): author_lines.append(line.split(' ')[1]) author_nick_name = author_lines[-1] - return author_dict.get(author_nick_name, "") - + return search_author(author_dict, author_nick_name) def load_json(p): with open(p, 'r') as f: