bililive-cli 3.17.0 → 3.18.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 require$$2$1 = require('node:http');
5
5
  var require$$0$4 = require('node:url');
6
6
  var a$1 = require('node:https');
7
- var index$1 = require('./index-BZBJd-mI.cjs');
7
+ var index$1 = require('./index-CWUSa9VA.cjs');
8
8
  var require$$0$6 = require('tty');
9
9
  var require$$1$3 = require('util');
10
10
  var require$$0$c = require('assert');
@@ -62549,7 +62549,7 @@ class MultipartBody {
62549
62549
  let fileFromPathWarned = false;
62550
62550
  async function fileFromPath(path, ...args) {
62551
62551
  // this import fails in environments that don't handle export maps correctly, like old versions of Jest
62552
- const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-x9JhF4gH.cjs'); });
62552
+ const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-Df_wQ1he.cjs'); });
62553
62553
  if (!fileFromPathWarned) {
62554
62554
  console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`);
62555
62555
  fileFromPathWarned = true;
@@ -77055,7 +77055,7 @@ class ConfigManager {
77055
77055
  uploadToSameMedia,
77056
77056
  noDanmuVideoPreset,
77057
77057
  videoHandleTime: limitVideoConvertTime ? videoHandleTime : undefined,
77058
- partTitleTemplate: this.getRoomSetting("partTitleTemplate", roomSetting) || "{{filename}}",
77058
+ partTitleTemplate: this.getRoomSetting("partTitleTemplate", roomSetting) || "",
77059
77059
  afterUploadDeletAction: this.getRoomSetting("afterUploadDeletAction", roomSetting) ?? "none",
77060
77060
  syncId,
77061
77061
  flvRepair,
@@ -78606,10 +78606,21 @@ class WebhookHandler {
78606
78606
  const runtimePart = this.getRuntimePart(part);
78607
78607
  return type === "handled" ? runtimePart.handledCid : runtimePart.rawCid;
78608
78608
  }
78609
+ createUploadFileMeta(live, part, index) {
78610
+ return {
78611
+ index,
78612
+ title: part.title,
78613
+ username: live.username,
78614
+ roomId: live.roomId,
78615
+ startTimestamp: part.startTime ? Math.floor(part.startTime / 1000) : null,
78616
+ platform: live.platform,
78617
+ };
78618
+ }
78609
78619
  toPathArray(items) {
78610
78620
  return items.map((item) => ({
78611
78621
  path: item.path,
78612
78622
  title: item.title,
78623
+ meta: item.meta,
78613
78624
  }));
78614
78625
  }
78615
78626
  createUploadItems(filePaths, type) {
@@ -78698,28 +78709,22 @@ class WebhookHandler {
78698
78709
  * 构建上传文件列表
78699
78710
  * @private
78700
78711
  */
78701
- buildUploadFileList(live, uploadableParts, type, config) {
78712
+ buildUploadFileList(live, uploadableParts, type) {
78702
78713
  const updateStatusField = type === "handled" ? "uploadStatus" : "rawUploadStatus";
78703
78714
  const filePathField = type === "handled" ? "filePath" : "rawFilePath";
78704
78715
  let cover;
78705
78716
  const filePaths = [];
78706
- // 计算已上传分段的数量,用于生成正确的索引
78707
78717
  const uploadedCount = live
78708
78718
  .getNonErrorParts(type)
78709
78719
  .filter((part) => part[updateStatusField] === "uploaded").length;
78710
78720
  let currentIndex = uploadedCount + 1;
78711
78721
  // 构建上传文件列表
78712
78722
  for (const part of uploadableParts) {
78713
- const filename = path$3.parse(part[filePathField]).name;
78714
- const title = index$1.formatPartTitle({
78715
- title: part.title,
78716
- username: live.username,
78717
- roomId: live.roomId,
78718
- time: part?.startTime ? new Date(part.startTime).toISOString() : new Date().toISOString(),
78719
- filename,
78720
- index: currentIndex,
78721
- }, config.partTitleTemplate ?? "{{filename}}");
78722
- filePaths.push({ path: part[filePathField], title, part });
78723
+ filePaths.push({
78724
+ path: part[filePathField],
78725
+ meta: this.createUploadFileMeta(live, part, currentIndex),
78726
+ part,
78727
+ });
78723
78728
  if (!cover)
78724
78729
  cover = part.cover;
78725
78730
  currentIndex++;
@@ -78772,13 +78777,13 @@ class WebhookHandler {
78772
78777
  }
78773
78778
  return sortParams;
78774
78779
  }
78775
- getUploadedItemCountForSameMedia(live, config) {
78780
+ getUploadedItemCountForSameMedia(live, type) {
78776
78781
  let uploadedCount = 0;
78777
78782
  for (const part of live.parts) {
78778
- if (part.uploadStatus === "uploaded") {
78783
+ if (type === "handled" && part.uploadStatus === "uploaded") {
78779
78784
  uploadedCount++;
78780
78785
  }
78781
- if (config.uploadNoDanmu && part.rawUploadStatus === "uploaded") {
78786
+ if (type === "raw" && part.rawUploadStatus === "uploaded") {
78782
78787
  uploadedCount++;
78783
78788
  }
78784
78789
  }
@@ -78787,7 +78792,10 @@ class WebhookHandler {
78787
78792
  buildSameMediaUploadFileList(live, config) {
78788
78793
  let cover;
78789
78794
  const filePaths = [];
78790
- let currentIndex = this.getUploadedItemCountForSameMedia(live, config) + 1;
78795
+ const currentIndexes = {
78796
+ handled: this.getUploadedItemCountForSameMedia(live, "handled") + 1,
78797
+ raw: this.getUploadedItemCountForSameMedia(live, "raw") + 1,
78798
+ };
78791
78799
  for (const type of SAME_MEDIA_UPLOAD_ORDER) {
78792
78800
  for (const part of live.parts) {
78793
78801
  const item = this.getSameMediaUploadCandidate(part, type, config);
@@ -78797,27 +78805,16 @@ class WebhookHandler {
78797
78805
  continue;
78798
78806
  if (!item.canUpload)
78799
78807
  continue;
78800
- const filename = path$3.parse(item.path).name;
78801
- const baseTitle = index$1.formatPartTitle({
78802
- title: part.title,
78803
- username: live.username,
78804
- roomId: live.roomId,
78805
- time: part?.startTime
78806
- ? new Date(part.startTime).toISOString()
78807
- : new Date().toISOString(),
78808
- filename,
78809
- index: currentIndex,
78810
- }, config.partTitleTemplate ?? "{{filename}}");
78811
78808
  filePaths.push({
78812
78809
  part,
78813
78810
  path: item.path,
78814
- title: baseTitle,
78811
+ meta: this.createUploadFileMeta(live, part, currentIndexes[type]),
78815
78812
  type: item.type,
78816
78813
  });
78817
78814
  if (!cover) {
78818
78815
  cover = part.cover;
78819
78816
  }
78820
- currentIndex++;
78817
+ currentIndexes[type]++;
78821
78818
  }
78822
78819
  }
78823
78820
  return { filePaths, cover };
@@ -78860,6 +78857,8 @@ class WebhookHandler {
78860
78857
  if (config.useLiveCover && cover) {
78861
78858
  uploadPreset.cover = cover;
78862
78859
  }
78860
+ uploadPreset.partTitleTemplate =
78861
+ config.partTitleTemplate?.trim() || uploadPreset.partTitleTemplate?.trim() || "";
78863
78862
  // 处理转载来源:当设置为转载类型且转载来源为空时,自动生成直播间链接
78864
78863
  // TODO: 考虑迁移到上传预设配置实现,需要将metadata参数传递到上传函数中
78865
78864
  if (uploadPreset.copyright === 2 &&
@@ -79001,7 +79000,7 @@ class WebhookHandler {
79001
79000
  // 3. 获取配置
79002
79001
  const config = this.configManager.getConfig(live.roomId);
79003
79002
  // 4. 构建上传文件列表
79004
- const { filePaths, cover } = this.buildUploadFileList(live, uploadableParts, type, config);
79003
+ const { filePaths, cover } = this.buildUploadFileList(live, uploadableParts, type);
79005
79004
  // 5. 验证上传配置
79006
79005
  if (!this.validateUploadConfig(live, filePaths, type, config)) {
79007
79006
  return;
@@ -79091,7 +79090,7 @@ let handler;
79091
79090
  let appConfig;
79092
79091
  let container;
79093
79092
  const fileCache = createFileCache();
79094
- path$3.dirname(require$$0$4.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-cBdgazGf.cjs', document.baseURI).href))));
79093
+ path$3.dirname(require$$0$4.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CYt93UQb.cjs', document.baseURI).href))));
79095
79094
  const authMiddleware = (passKey) => {
79096
79095
  return async (ctx, next) => {
79097
79096
  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.17.0";
3718
+ var version = "3.18.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-BZBJd-mI.cjs'); }).then(function (n) { return n.index; });
3745
- const { serverStart } = await Promise.resolve().then(function () { return require('./index-cBdgazGf.cjs'); }).then(function (n) { return n.index; });
3744
+ const { init } = await Promise.resolve().then(function () { return require('./index-CWUSa9VA.cjs'); }).then(function (n) { return n.index; });
3745
+ const { serverStart } = await Promise.resolve().then(function () { return require('./index-CYt93UQb.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-BZBJd-mI.cjs');
7
+ var index = require('./index-CWUSa9VA.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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bililive-cli",
3
- "version": "3.17.0",
3
+ "version": "3.18.0",
4
4
  "type": "module",
5
5
  "description": "biliLive-tools的cli程序",
6
6
  "main": "./lib/index.js",
@@ -27,7 +27,7 @@
27
27
  "@napi-rs/canvas": "^0.1.60",
28
28
  "font-ls": "0.6.6",
29
29
  "ntsuspend": "^1.0.2",
30
- "better-sqlite3": "12.6.2",
30
+ "better-sqlite3": "12.11.1",
31
31
  "shazamio-core": "^1.3.1",
32
32
  "music-segment-detector": "^0.3.1"
33
33
  },
@@ -39,9 +39,9 @@
39
39
  "commander": "^12.1.0",
40
40
  "rimraf": "^6.0.1",
41
41
  "tsx": "^4.19.2",
42
- "@biliLive-tools/http": "3.17.0",
43
- "@biliLive-tools/types": "3.17.0",
44
- "@biliLive-tools/shared": "3.17.0"
42
+ "@biliLive-tools/http": "3.18.0",
43
+ "@biliLive-tools/types": "3.18.0",
44
+ "@biliLive-tools/shared": "3.18.0"
45
45
  },
46
46
  "scripts": {
47
47
  "start": "tsx src/index.ts",