From 877eeec796e640dae95981e7b69a61484722726d Mon Sep 17 00:00:00 2001 From: ytshen Date: Tue, 20 Feb 2024 19:55:04 +0800 Subject: [PATCH 1/3] support jsonc --- moz_addons.py | 2 +- requirements.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/moz_addons.py b/moz_addons.py index a3fbe3e..d4dd67e 100644 --- a/moz_addons.py +++ b/moz_addons.py @@ -1,5 +1,5 @@ import zipfile -import json +import commentjson as json import os from xml.dom import minidom diff --git a/requirements.txt b/requirements.txt index cd6b55d..b267f2d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ requests -argparse \ No newline at end of file +argparse +commentjson \ No newline at end of file From 631634ad612d5b54a55bcd6327bfad212fefc288 Mon Sep 17 00:00:00 2001 From: ytshen Date: Tue, 20 Feb 2024 20:22:31 +0800 Subject: [PATCH 2/3] rm night for 7 --- addons/tefkah#zotero-night.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/addons/tefkah#zotero-night.json b/addons/tefkah#zotero-night.json index e0824d3..7d907c8 100644 --- a/addons/tefkah#zotero-night.json +++ b/addons/tefkah#zotero-night.json @@ -2,10 +2,6 @@ "name": "Night for Zotero", "repo": "tefkah/zotero-night", "releases": [ - { - "targetZoteroVersion": "7", - "tagName": "pre" - }, { "targetZoteroVersion": "6", "tagName": "latest" From dbc65c7c1cbe9c6d931af47f7e26fcb0d384c824 Mon Sep 17 00:00:00 2001 From: shenyutao Date: Thu, 7 Mar 2024 11:46:35 +0800 Subject: [PATCH 3/3] update --- addon_keys.py | 3 ++- main.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addon_keys.py b/addon_keys.py index 6c57db8..7a21f8b 100644 --- a/addon_keys.py +++ b/addon_keys.py @@ -18,6 +18,7 @@ id = "id" xpiVersion = "xpiVersion" description = "description" star = "star" +stars = "stars" author = "author" url = "url" avatar = "avatar" @@ -67,7 +68,7 @@ avatar = "avatar" # }>; # # description?: string; -# star?: number; +# stars?: number; # author?: { # name: string; # url: string; diff --git a/main.py b/main.py index 524d2d7..f39682e 100644 --- a/main.py +++ b/main.py @@ -80,6 +80,8 @@ def parse(plugin, **kwargs): if repos_info['description'] and description not in plugin: plugin[description] = repos_info['description'] if repos_info['stargazers_count'] is not None: + plugin[stars] = repos_info['stargazers_count'] + # todo: remove plugin[star] = repos_info['stargazers_count'] except Exception as 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', []): 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) if dir and not os.path.exists(dir):