koishi-plugin-music-parser-all 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -0
- package/lib/index.js +11 -16
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -506,19 +506,16 @@ function apply(ctx, config) {
|
|
|
506
506
|
let aria2 = null;
|
|
507
507
|
if (downloadEngine === 'aria2') {
|
|
508
508
|
try {
|
|
509
|
-
|
|
510
|
-
aria2
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
});
|
|
517
|
-
aria2.open();
|
|
518
|
-
logger.info('aria2 连接成功');
|
|
509
|
+
aria2 = ctx.aria2;
|
|
510
|
+
if (aria2) {
|
|
511
|
+
logger.info('已获取 aria2 服务实例 (koishi-plugin-aria2-plus)');
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
logger.warn('aria2 服务不可用,将回退到内置下载');
|
|
515
|
+
}
|
|
519
516
|
}
|
|
520
517
|
catch (e) {
|
|
521
|
-
logger.warn('aria2
|
|
518
|
+
logger.warn('获取 aria2 服务失败,将回退到内置下载');
|
|
522
519
|
}
|
|
523
520
|
}
|
|
524
521
|
const customPlatforms = (config.customPlatforms || []).map((p) => ({
|
|
@@ -629,7 +626,7 @@ function apply(ctx, config) {
|
|
|
629
626
|
}
|
|
630
627
|
else if (downloadEngine === 'aria2' && aria2 && config.resumeDownload) {
|
|
631
628
|
try {
|
|
632
|
-
const gid = await aria2.
|
|
629
|
+
const gid = await aria2.addUri([url], {
|
|
633
630
|
dir: cacheDir,
|
|
634
631
|
out: fileName,
|
|
635
632
|
split: 4,
|
|
@@ -645,10 +642,10 @@ function apply(ctx, config) {
|
|
|
645
642
|
const ariaStartTime = Date.now();
|
|
646
643
|
while (!completed) {
|
|
647
644
|
if (Date.now() - ariaStartTime > timeout) {
|
|
648
|
-
await aria2.
|
|
645
|
+
await aria2.remove(gid).catch(() => { });
|
|
649
646
|
throw new Error('aria2下载超时');
|
|
650
647
|
}
|
|
651
|
-
const status = await aria2.
|
|
648
|
+
const status = await aria2.tellStatus(gid);
|
|
652
649
|
if (status.status === 'complete') {
|
|
653
650
|
completed = true;
|
|
654
651
|
}
|
|
@@ -1073,8 +1070,6 @@ function apply(ctx, config) {
|
|
|
1073
1070
|
}, 3600000);
|
|
1074
1071
|
ctx.on('dispose', () => {
|
|
1075
1072
|
clearInterval(tempCleanupInterval);
|
|
1076
|
-
if (aria2)
|
|
1077
|
-
aria2.close();
|
|
1078
1073
|
urlCacheLocal.clear();
|
|
1079
1074
|
dedupCache.clear();
|
|
1080
1075
|
debugLog('INFO', '音乐解析插件已卸载');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-music-parser-all",
|
|
3
3
|
"description": "Koishi 全平台音乐解析插件,支持网易云音乐/酷我音乐/QQ音乐/汽水音乐等平台",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"koishi-plugin-downloads": "^1.0.0",
|
|
47
47
|
"koishi-plugin-silk": "^1.0.0",
|
|
48
48
|
"koishi-plugin-ffmpeg": "^1.0.0",
|
|
49
|
-
"aria2": "^
|
|
49
|
+
"koishi-plugin-aria2-plus": "^1.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"koishi-plugin-downloads": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"koishi-plugin-ffmpeg": {
|
|
59
59
|
"optional": true
|
|
60
60
|
},
|
|
61
|
-
"aria2": {
|
|
61
|
+
"koishi-plugin-aria2-plus": {
|
|
62
62
|
"optional": true
|
|
63
63
|
}
|
|
64
64
|
},
|