bililive-cli 3.20.0 → 3.22.0

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.
@@ -4,7 +4,7 @@ var path$3 = require('node:path');
4
4
  var http$4 = require('node:http');
5
5
  var urlLib = require('node:url');
6
6
  var https = require('node:https');
7
- var index$1 = require('./index-RwUbYTSt.cjs');
7
+ var index$1 = require('./index-ByKMHGR7.cjs');
8
8
  var require$$0$5 = require('tty');
9
9
  var require$$1$4 = require('util');
10
10
  var require$$0$b = require('assert');
@@ -26,8 +26,8 @@ var require$$1$6 = require('os');
26
26
  var require$$1$1 = require('node:child_process');
27
27
  var crypto$3 = require('node:crypto');
28
28
  var fs$6 = require('node:fs');
29
+ require('node:module');
29
30
  var EventEmitter$4 = require('node:events');
30
- require('ntsuspend');
31
31
  require('node:readline');
32
32
  require('@napi-rs/canvas');
33
33
  require('better-sqlite3');
@@ -30041,8 +30041,11 @@ router$h.post("/webhook/bililiverecorder", async (ctx) => {
30041
30041
  return;
30042
30042
  }
30043
30043
  const roomId = event.EventData.RoomId;
30044
- // 如果是docker,那么将recoderFolder参数修改为 /app/video路径
30045
- const recoderFolder = isDocker ? "/app/video" : config.webhook.recoderFolder;
30044
+ let recoderFolder = config.webhook.recoderFolder;
30045
+ if (isDocker && !config.webhook.recoderFolder) {
30046
+ // 如果是docker,且不存在recoderFolder参数,那么修改默认值
30047
+ recoderFolder = "/app/video";
30048
+ }
30046
30049
  const filePath = path$3.join(recoderFolder, event.EventData.RelativePath);
30047
30050
  index$1.logObj.info("录播姬文件路径:", filePath, recoderFolder);
30048
30051
  handler.handle({
@@ -56214,7 +56217,7 @@ router$c.get("/video/:id", async (ctx) => {
56214
56217
  router$c.post("/video", async (ctx) => {
56215
56218
  const preset = container.resolve("videoPreset");
56216
56219
  const data = ctx.request.body;
56217
- data.config = index$1.omit(data.config, ["dtime"]);
56220
+ data.config = index$1.omit(data.config, ["dtime", "staffs"]);
56218
56221
  const [status, msg] = index$1.validateBiliupConfig(data.config);
56219
56222
  if (!status) {
56220
56223
  throw new Error(msg || "配置验证失败");
@@ -56228,7 +56231,7 @@ router$c.del("/video/:id", async (ctx) => {
56228
56231
  router$c.put("/video/:id", async (ctx) => {
56229
56232
  const preset = container.resolve("videoPreset");
56230
56233
  const data = ctx.request.body;
56231
- data.config = index$1.omit(data.config, ["dtime"]);
56234
+ data.config = index$1.omit(data.config, ["dtime", "staffs"]);
56232
56235
  const [status, msg] = index$1.validateBiliupConfig(data.config);
56233
56236
  if (!status) {
56234
56237
  throw new Error(msg || "配置验证失败");
@@ -62603,7 +62606,7 @@ class MultipartBody {
62603
62606
  let fileFromPathWarned = false;
62604
62607
  async function fileFromPath(path, ...args) {
62605
62608
  // this import fails in environments that don't handle export maps correctly, like old versions of Jest
62606
- const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-Cqq5W5LP.cjs'); });
62609
+ const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-1V4Za2hv.cjs'); });
62607
62610
  if (!fileFromPathWarned) {
62608
62611
  console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`);
62609
62612
  fileFromPathWarned = true;
@@ -68770,7 +68773,7 @@ class QwenLLM {
68770
68773
  this.client = new OpenAI({
68771
68774
  apiKey: config.apiKey,
68772
68775
  baseURL: config.baseURL || "https://dashscope.aliyuncs.com/compatible-mode/v1",
68773
- timeout: config.timeout || 60000,
68776
+ timeout: config.timeout || 300000,
68774
68777
  });
68775
68778
  this.model = config.model || "qwen-plus";
68776
68779
  }
@@ -73203,7 +73206,13 @@ async function recognize(file, lyricOptimize) {
73203
73206
  // console.log("Shazam 识别结果:", JSON.stringify(result, null, 2));
73204
73207
  if (!result)
73205
73208
  return null;
73206
- const info = await shazamQueryInfo(result.trackId);
73209
+ let info = null;
73210
+ try {
73211
+ info = await shazamQueryInfo(result.trackId);
73212
+ }
73213
+ catch (error) {
73214
+ console.error("Shazam 查询信息失败:", error);
73215
+ }
73207
73216
  const appleMusicId = result.appleMusicId || info?.appleMusicId;
73208
73217
  const title = info?.title || result.title;
73209
73218
  const subtitle = info?.subtitle || "";
@@ -73379,6 +73388,7 @@ async function optimizeLyrics(asrData, lyrics, offset) {
73379
73388
  temperature: 0.5,
73380
73389
  enableSearch: false,
73381
73390
  responseFormat: enableStructuredOutput ? { type: "json_object" } : undefined,
73391
+ enableThinking: false,
73382
73392
  });
73383
73393
  index$1.logObj.info("优化结果:", response);
73384
73394
  if (!response.content) {
@@ -73471,6 +73481,7 @@ async function recognizeSongNameWithLLM(asrText, vendorId, options) {
73471
73481
  enableSearch: options.enableSearch,
73472
73482
  responseFormat: options.enableStructuredOutput ? { type: "json_object" } : undefined,
73473
73483
  temperature: 0.6,
73484
+ enableThinking: false,
73474
73485
  searchOptions: {
73475
73486
  forcedSearch: options.enableSearch,
73476
73487
  search_strategy: "max",
@@ -74035,7 +74046,7 @@ router$a.get("/ws/danma-test", async (ctx) => {
74035
74046
  };
74036
74047
  });
74037
74048
  router$a.post("/add", async (ctx) => {
74038
- const args = index$1.pick((ctx.request.body ?? {}), "providerId", "channelId", "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "extra", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "segment", "sendToWebhook", "uid", "saveCover", "convert2Mp4", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "liveStartNotification", "chargeLiveNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "api");
74049
+ const args = index$1.pick((ctx.request.body ?? {}), "providerId", "channelId", "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "extra", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "segment", "sendToWebhook", "uid", "saveCover", "convert2Mp4", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "segmentOnTitleChange", "liveStartNotification", "chargeLiveNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "api");
74039
74050
  const data = await recorderService.addRecorder(args);
74040
74051
  ctx.body = { payload: data };
74041
74052
  });
@@ -74064,7 +74075,7 @@ router$a.post("/:id/stream", async (ctx) => {
74064
74075
  });
74065
74076
  router$a.put("/:id", (ctx) => {
74066
74077
  const { id } = ctx.params;
74067
- const patch = index$1.pick(ctx.request.body, "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "saveCover", "segment", "sendToWebhook", "uid", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "liveStartNotification", "chargeLiveNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "convert2Mp4", "api");
74078
+ const patch = index$1.pick(ctx.request.body, "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "saveCover", "segment", "sendToWebhook", "uid", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "segmentOnTitleChange", "liveStartNotification", "chargeLiveNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "convert2Mp4", "api");
74068
74079
  ctx.body = { payload: recorderService.updateRecorder({ id, ...patch }) };
74069
74080
  });
74070
74081
  /**
@@ -74350,6 +74361,11 @@ router$9.get("/seasons", async (ctx) => {
74350
74361
  const data = await index$1.biliApi.getSeasonList(uid);
74351
74362
  ctx.body = data;
74352
74363
  });
74364
+ router$9.get("/reserveList", async (ctx) => {
74365
+ const { uid } = ctx.request.query;
74366
+ const data = await index$1.biliApi.getReserveList(uid);
74367
+ ctx.body = data;
74368
+ });
74353
74369
  router$9.get("/season/:aid", async (ctx) => {
74354
74370
  const { uid } = ctx.request.query;
74355
74371
  const { aid } = ctx.params;
@@ -74381,6 +74397,11 @@ router$9.post("/upload", async (ctx) => {
74381
74397
  ctx.status = 400;
74382
74398
  return;
74383
74399
  }
74400
+ if (data.config.staffs && data.config.staffs.length > 0) {
74401
+ if (appConfig?.get("biliUpload")?.useBCutAPI) {
74402
+ throw new Error("联合投稿暂不支持必剪接口");
74403
+ }
74404
+ }
74384
74405
  if (data.vid) {
74385
74406
  const task = await index$1.biliApi.editMedia(data.vid, data.videos, data.config, data.uid, {
74386
74407
  afterUploadDeletAction: data.options?.removeOriginAfterUploadCheck
@@ -74499,6 +74520,18 @@ router$9.post("/formatDesc", async (ctx) => {
74499
74520
  }, template);
74500
74521
  ctx.body = desc;
74501
74522
  });
74523
+ // 搜索联合投稿UP主
74524
+ router$9.get("/searchStaff", async (ctx) => {
74525
+ const { kw, uid } = ctx.request.query;
74526
+ const data = await index$1.biliApi.searchStaffUser(Number(uid), kw);
74527
+ ctx.body = data;
74528
+ });
74529
+ // 获取联合投稿剩余次数
74530
+ router$9.get("/staffRemaining", async (ctx) => {
74531
+ const { uid } = ctx.request.query;
74532
+ const data = await index$1.biliApi.getStaffRemaining(Number(uid));
74533
+ ctx.body = data;
74534
+ });
74502
74535
 
74503
74536
  async function flvRepair(input, output, opts) {
74504
74537
  // 如果不是flv,直接报错
@@ -76808,6 +76841,7 @@ async function subtitleRecognize(file, modelId, options) {
76808
76841
  fillGap,
76809
76842
  disableCache,
76810
76843
  song: options?.song,
76844
+ modelId,
76811
76845
  });
76812
76846
  try {
76813
76847
  // 生成缓存路径
@@ -76917,8 +76951,11 @@ router$1.post("/subtitle", async (ctx) => {
76917
76951
  };
76918
76952
  return;
76919
76953
  }
76920
- const config = index$1.appConfig.get("ai") || {};
76921
- const asrModelId = config.subtitleRecognize.modelId;
76954
+ let asrModelId = data.modelId;
76955
+ if (!asrModelId) {
76956
+ const config = index$1.appConfig.get("ai") || {};
76957
+ asrModelId = config.subtitleRecognize.modelId;
76958
+ }
76922
76959
  if (!asrModelId) {
76923
76960
  throw new Error("请先在配置中设置字幕识别ASR模型");
76924
76961
  }
@@ -79238,7 +79275,7 @@ let handler;
79238
79275
  let appConfig;
79239
79276
  let container;
79240
79277
  const fileCache = createFileCache();
79241
- path$3.dirname(urlLib.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-DTguSku6.cjs', document.baseURI).href))));
79278
+ path$3.dirname(urlLib.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Db-mrTi0.cjs', document.baseURI).href))));
79242
79279
  const authMiddleware = (passKey) => {
79243
79280
  return async (ctx, next) => {
79244
79281
  const authHeader = ctx.headers["authorization"] || ctx.request.query.auth;
package/lib/index.cjs CHANGED
@@ -3715,7 +3715,7 @@ const {
3715
3715
  Help,
3716
3716
  } = commander;
3717
3717
 
3718
- var version = "3.20.0";
3718
+ var version = "3.22.0";
3719
3719
 
3720
3720
  process.on("uncaughtException", function (error) {
3721
3721
  console.error(`${new Date().toISOString()} uncaughtException`, error);
@@ -3741,8 +3741,8 @@ program
3741
3741
  throw new Error(`${c.configFolder}参数不存在,请先重新运行 config gen 命令`);
3742
3742
  }
3743
3743
  // 下面两行顺序不能换(
3744
- const { init } = await Promise.resolve().then(function () { return require('./index-RwUbYTSt.cjs'); }).then(function (n) { return n.index; });
3745
- const { serverStart } = await Promise.resolve().then(function () { return require('./index-DTguSku6.cjs'); }).then(function (n) { return n.index; });
3744
+ const { init } = await Promise.resolve().then(function () { return require('./index-ByKMHGR7.cjs'); }).then(function (n) { return n.index; });
3745
+ const { serverStart } = await Promise.resolve().then(function () { return require('./index-Db-mrTi0.cjs'); }).then(function (n) { return n.index; });
3746
3746
  const globalConfig = {
3747
3747
  ffmpegPresetPath: path$1.join(c.configFolder, "ffmpeg_presets.json"),
3748
3748
  videoPresetPath: path$1.join(c.configFolder, "presets.json"),
@@ -4,7 +4,7 @@ var os$3 = require('node:os');
4
4
  var path$5 = require('node:path');
5
5
  var fs$3 = require('node:fs');
6
6
  var crypto = require('node:crypto');
7
- var index = require('./index-RwUbYTSt.cjs');
7
+ var index = require('./index-ByKMHGR7.cjs');
8
8
  var require$$0$1 = require('fs');
9
9
  var require$$0 = require('path');
10
10
  var require$$0$2 = require('child_process');
@@ -30,7 +30,7 @@ require('crypto');
30
30
  require('http2');
31
31
  require('tty');
32
32
  require('zlib');
33
- require('ntsuspend');
33
+ require('node:module');
34
34
  require('node:readline');
35
35
  require('node:https');
36
36
  require('node:url');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bililive-cli",
3
- "version": "3.20.0",
3
+ "version": "3.22.0",
4
4
  "type": "module",
5
5
  "description": "biliLive-tools的cli程序",
6
6
  "main": "./lib/index.js",
@@ -24,13 +24,15 @@
24
24
  "lib"
25
25
  ],
26
26
  "dependencies": {
27
- "@napi-rs/canvas": "^0.1.60",
27
+ "@napi-rs/canvas": "^1.0.9",
28
28
  "font-ls": "0.6.6",
29
- "ntsuspend": "^1.0.2",
30
29
  "better-sqlite3": "12.11.1",
31
30
  "shazamio-core": "^1.3.1",
32
31
  "music-segment-detector": "^0.3.1"
33
32
  },
33
+ "optionalDependencies": {
34
+ "ntsuspend": "^1.0.2"
35
+ },
34
36
  "devDependencies": {
35
37
  "@types/cli-progress": "^3.11.6",
36
38
  "@yao-pkg/pkg": "^6.1.1",
@@ -39,9 +41,9 @@
39
41
  "commander": "^12.1.0",
40
42
  "rimraf": "^6.0.1",
41
43
  "tsx": "^4.19.2",
42
- "@biliLive-tools/http": "3.20.0",
43
- "@biliLive-tools/types": "3.20.0",
44
- "@biliLive-tools/shared": "3.20.0"
44
+ "@biliLive-tools/shared": "3.22.0",
45
+ "@biliLive-tools/types": "3.22.0",
46
+ "@biliLive-tools/http": "3.22.0"
45
47
  },
46
48
  "scripts": {
47
49
  "start": "tsx src/index.ts",