Merge pull request #2 from syt2/support-jsonc

Support jsonc
This commit is contained in:
syt 2024-03-07 11:47:32 +08:00 committed by GitHub
commit 6d48e275a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 8 deletions

View File

@ -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;

View File

@ -2,10 +2,6 @@
"name": "Night for Zotero",
"repo": "tefkah/zotero-night",
"releases": [
{
"targetZoteroVersion": "7",
"tagName": "pre"
},
{
"targetZoteroVersion": "6",
"tagName": "latest"

View File

@ -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):

View File

@ -1,5 +1,5 @@
import zipfile
import json
import commentjson as json
import os
from xml.dom import minidom

View File

@ -1,2 +1,3 @@
requests
argparse
argparse
commentjson