Skip to content

Commit 6cfe67a

Browse files
committed
bugfix
修复版本号小于0.0.1时桌面客户端无法显示的错误
1 parent 04e191a commit 6cfe67a

File tree

3 files changed

+133
-11
lines changed

3 files changed

+133
-11
lines changed

extras.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extras": [
3+
{
4+
"name": "云电台",
5+
"url": "https://cdn.jsdelivr.net/gh/GuGuMur/MusicFreePlugin-NeteaseRadio@master/dist/plugin.js",
6+
"version": "0.0.1"
7+
}
8+
]
9+
}

plugins.json

+104-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,104 @@
1-
{"plugins": [{"name": "歌词千寻", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/geciqianxun/index.js", "version": "0.0.0"}, {"name": "bilibili", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/bilibili/index.js", "version": "0.1.15"}, {"name": "Audiomack", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/audiomack/index.js", "version": "0.0.2"}, {"name": "歌词网", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/geciwang/index.js", "version": "0.0.0"}, {"name": "快手", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/kuaishou/index.js", "version": "0.0.1"}, {"name": "Navidrome", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/navidrome/index.js", "version": "0.0.0"}, {"name": "猫耳FM", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/maoerfm/index.js", "version": "0.1.4"}, {"name": "suno", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/suno/index.js", "version": "0.0.0"}, {"name": "WebDAV", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/webdav/index.js", "version": "0.0.2"}, {"name": "udio", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/udio/index.js", "version": "0.0.0"}, {"name": "音悦台", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/yinyuetai/index.js", "version": "0.0.1"}, {"name": "Youtube", "url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/youtube/index.js", "version": "0.0.1"}, {"name": "QQ音乐", "url": "https://gitee.com/ThomasYou/musicfree/raw/master/dist/qq/index.js", "version": "0.2.6"}, {"name": "简繁音乐", "url": "https://gitee.com/ThomasYou/musicfree/raw/master/dist/wy/index.js", "version": "0.0.6"}, {"name": "云音乐", "url": "http://adad23u.appinstall.life/dist/kuwo/index.js", "version": "0.1.6"}, {"name": "咪咕音乐", "url": "https://gitee.com/ThomasYou/musicfree/raw/master/dist/mg/index.js", "version": "0.2.2"}, {"name": "酷狗", "url": "https://gitee.com/ThomasYou/musicfree/raw/master/dist/kg/index.js", "version": "0.1.6"}, {"name": "5sing", "url": "https://agit.ai/vale_gtt/MSC_API/raw/branch/master/%e7%8c%ab%e5%a4%b4%e7%8c%ab_plugs/5sing/index.js", "version": "0.1.1"}, {"name": "酷歌词", "url": "https://gitee.com/ThomasYou/musicfree/raw/master/dist/kugeci.js", "version": "0.0.0"}, {"name": "网易云电台", "url": "https://cdn.jsdelivr.net/gh/GuGuMur/MusicFreePlugin-NeteaseRadio@master/dist/plugin.js", "version": "0.0.0"}]}
1+
{
2+
"plugins": [
3+
{
4+
"name": "歌词千寻",
5+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/geciqianxun/index.js",
6+
"version": "0.0.1"
7+
},
8+
{
9+
"name": "bilibili",
10+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/bilibili/index.js",
11+
"version": "0.1.15"
12+
},
13+
{
14+
"name": "Audiomack",
15+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/audiomack/index.js",
16+
"version": "0.0.2"
17+
},
18+
{
19+
"name": "歌词网",
20+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/geciwang/index.js",
21+
"version": "0.0.1"
22+
},
23+
{
24+
"name": "快手",
25+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/kuaishou/index.js",
26+
"version": "0.0.1"
27+
},
28+
{
29+
"name": "Navidrome",
30+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/navidrome/index.js",
31+
"version": "0.0.1"
32+
},
33+
{
34+
"name": "猫耳FM",
35+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/maoerfm/index.js",
36+
"version": "0.1.4"
37+
},
38+
{
39+
"name": "suno",
40+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/suno/index.js",
41+
"version": "0.0.1"
42+
},
43+
{
44+
"name": "WebDAV",
45+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/webdav/index.js",
46+
"version": "0.0.2"
47+
},
48+
{
49+
"name": "udio",
50+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/udio/index.js",
51+
"version": "0.0.1"
52+
},
53+
{
54+
"name": "音悦台",
55+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/yinyuetai/index.js",
56+
"version": "0.0.1"
57+
},
58+
{
59+
"name": "Youtube",
60+
"url": "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/youtube/index.js",
61+
"version": "0.0.1"
62+
},
63+
{
64+
"name": "QQ音乐",
65+
"url": "https://gitee.com/ThomasYou/musicfree/raw/master/dist/qq/index.js",
66+
"version": "0.2.6"
67+
},
68+
{
69+
"name": "简繁音乐",
70+
"url": "https://gitee.com/ThomasYou/musicfree/raw/master/dist/wy/index.js",
71+
"version": "0.0.6"
72+
},
73+
{
74+
"name": "云音乐",
75+
"url": "http://adad23u.appinstall.life/dist/kuwo/index.js",
76+
"version": "0.1.6"
77+
},
78+
{
79+
"name": "咪咕音乐",
80+
"url": "https://gitee.com/ThomasYou/musicfree/raw/master/dist/mg/index.js",
81+
"version": "0.2.2"
82+
},
83+
{
84+
"name": "酷狗",
85+
"url": "https://gitee.com/ThomasYou/musicfree/raw/master/dist/kg/index.js",
86+
"version": "0.1.6"
87+
},
88+
{
89+
"name": "5sing",
90+
"url": "https://agit.ai/vale_gtt/MSC_API/raw/branch/master/%e7%8c%ab%e5%a4%b4%e7%8c%ab_plugs/5sing/index.js",
91+
"version": "0.1.1"
92+
},
93+
{
94+
"name": "酷歌词",
95+
"url": "https://gitee.com/ThomasYou/musicfree/raw/master/dist/kugeci.js",
96+
"version": "0.0.1"
97+
},
98+
{
99+
"name": "云电台",
100+
"url": "https://cdn.jsdelivr.net/gh/GuGuMur/MusicFreePlugin-NeteaseRadio@master/dist/plugin.js",
101+
"version": "0.0.1"
102+
}
103+
]
104+
}

worker.py

+20-10
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,19 @@ def download_file(url):
3737
return {} # 在失败时返回一个空字典,这里应直接返回空字典,不需要调用 .json()
3838

3939

40+
def is_version_smaller(ver_str, target_ver_str):
41+
try:
42+
ver = version.parse(ver_str)
43+
target_ver = version.parse(target_ver_str)
44+
return ver < target_ver
45+
except:
46+
return True
47+
48+
4049
def main():
4150
"""主函数"""
4251
# 读取 JSON 文件
43-
with open("subscriptions.json", "r") as file:
52+
with open("subscriptions.json", "r", encoding="utf-8") as file:
4453
data = json.load(file)
4554
subscriptions = data["subscriptions"]
4655

@@ -72,6 +81,9 @@ def main():
7281
for n in pluginsDataRaw:
7382
nextNew = False
7483

84+
if is_version_smaller(n["version"], "0.0.1"):
85+
n["version"] = "0.0.1"
86+
7587
for o in pluginsDataMerged:
7688
if nextNew:
7789
nextNew = False
@@ -81,25 +93,23 @@ def main():
8193
nextNew = True
8294
if n["url"] == o["url"]:
8395
break
84-
if version.parse(n["version"]) > version.parse(o["version"]):
96+
if is_version_smaller(o["version"], n["version"]):
8597
o["url"] = n["url"]
8698
o["version"] = n["version"]
8799

88100
if not nextNew:
89101
pluginsDataMerged.append(n)
90102

91103
# print(pluginsDataMerged)
92-
pluginsDataMerged.append(
93-
{
94-
"name": "云电台",
95-
"url": "https://cdn.jsdelivr.net/gh/GuGuMur/MusicFreePlugin-NeteaseRadio@master/dist/plugin.js",
96-
"version": "0.0.0",
97-
},
98-
)
104+
with open("extras.json", "r", encoding="utf-8") as file:
105+
data = json.load(file)
106+
extras = data["extras"]
107+
for extra in extras:
108+
pluginsDataMerged.append(extra)
99109
resultData = {"plugins": pluginsDataMerged}
100110

101111
with open("plugins.json", "w", encoding="utf-8") as file:
102-
json.dump(resultData, file, ensure_ascii=False) # , indent=4)
112+
json.dump(resultData, file, ensure_ascii=False, indent=2)
103113

104114

105115
if __name__ == "__main__":

0 commit comments

Comments
 (0)