This commit is contained in:
shenyutao 2024-03-07 11:46:35 +08:00
parent 631634ad61
commit dbc65c7c1c
2 changed files with 5 additions and 2 deletions

View File

@ -18,6 +18,7 @@ id = "id"
xpiVersion = "xpiVersion" xpiVersion = "xpiVersion"
description = "description" description = "description"
star = "star" star = "star"
stars = "stars"
author = "author" author = "author"
url = "url" url = "url"
avatar = "avatar" avatar = "avatar"
@ -67,7 +68,7 @@ avatar = "avatar"
# }>; # }>;
# #
# description?: string; # description?: string;
# star?: number; # stars?: number;
# author?: { # author?: {
# name: string; # name: string;
# url: string; # url: string;

View File

@ -80,6 +80,8 @@ def parse(plugin, **kwargs):
if repos_info['description'] and description not in plugin: if repos_info['description'] and description not in plugin:
plugin[description] = repos_info['description'] plugin[description] = repos_info['description']
if repos_info['stargazers_count'] is not None: if repos_info['stargazers_count'] is not None:
plugin[stars] = repos_info['stargazers_count']
# todo: remove
plugin[star] = repos_info['stargazers_count'] plugin[star] = repos_info['stargazers_count']
except Exception as e: except Exception as e:
print(f'request {repo_url} failed: {e}') print(f'request {repo_url} failed: {e}')
@ -224,7 +226,7 @@ def parse_addon_infos(input_dir, output_filepath, **kwargs):
for previous_info_url in kwargs.get('previous_info_urls', []): for previous_info_url in kwargs.get('previous_info_urls', []):
addon_infos = fallback(addon_infos, previous_info_url, github_token=kwargs.get('github_token')) addon_infos = fallback(addon_infos, previous_info_url, github_token=kwargs.get('github_token'))
addon_infos.sort(key=lambda item: item[star] if star in item else 0, reverse=True) addon_infos.sort(key=lambda item: item[stars] if stars in item else 0, reverse=True)
dir = os.path.dirname(output_filepath) dir = os.path.dirname(output_filepath)
if dir and not os.path.exists(dir): if dir and not os.path.exists(dir):