bililive-cli 3.17.0 → 3.19.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.
- package/lib/{fileFromPath-x9JhF4gH.cjs → fileFromPath-DdVRxbmq.cjs} +2 -2
- package/lib/{index-cBdgazGf.cjs → index-BFO4BeOx.cjs} +231 -119
- package/lib/{index-BZBJd-mI.cjs → index-CApcEp1I.cjs} +8318 -944
- package/lib/index.cjs +3 -3
- package/lib/{linux-D1unhaX7.cjs → linux-BukkGorT.cjs} +1 -1
- package/package.json +5 -5
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var require$$0 = require('fs');
|
|
4
4
|
var require$$0$1 = require('path');
|
|
5
|
-
var index$1 = require('./index-
|
|
6
|
-
var index = require('./index-
|
|
5
|
+
var index$1 = require('./index-CApcEp1I.cjs');
|
|
6
|
+
var index = require('./index-BFO4BeOx.cjs');
|
|
7
7
|
require('node:dns');
|
|
8
8
|
require('constants');
|
|
9
9
|
require('stream');
|
|
@@ -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-
|
|
7
|
+
var index$1 = require('./index-CApcEp1I.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');
|
|
@@ -29621,8 +29621,9 @@ async function getRecorders(params) {
|
|
|
29621
29621
|
if (params.platform) {
|
|
29622
29622
|
list = list.filter((item) => item.providerId === params.platform);
|
|
29623
29623
|
}
|
|
29624
|
-
if (params.
|
|
29625
|
-
|
|
29624
|
+
if (params.status) {
|
|
29625
|
+
const normalizedStatus = params.status;
|
|
29626
|
+
list = list.filter((item) => item.state === normalizedStatus);
|
|
29626
29627
|
}
|
|
29627
29628
|
if (params.name) {
|
|
29628
29629
|
list = list.filter((item) => item.remarks?.includes(params.name) ||
|
|
@@ -29841,7 +29842,12 @@ function recorderToClient(recorder) {
|
|
|
29841
29842
|
}
|
|
29842
29843
|
function resolveChannel(url) {
|
|
29843
29844
|
const recorderManager = container.resolve("recorderManager");
|
|
29844
|
-
|
|
29845
|
+
const matchedProviders = recorderManager.manager.getChannelURLMatchedRecorderProviders(url);
|
|
29846
|
+
const isTikTok = matchedProviders.some((provider) => provider.id === "TikTok");
|
|
29847
|
+
const proxy = isTikTok
|
|
29848
|
+
? container.resolve("appConfig").get("recorder").tiktok.proxy || undefined
|
|
29849
|
+
: undefined;
|
|
29850
|
+
return recorderManager.resolveChannel(url, { proxy });
|
|
29845
29851
|
}
|
|
29846
29852
|
async function resolve(url) {
|
|
29847
29853
|
const channelInfo = await resolveChannel(url);
|
|
@@ -48078,6 +48084,15 @@ router$g.post("/", async (ctx) => {
|
|
|
48078
48084
|
appConfig.setAll(data);
|
|
48079
48085
|
ctx.body = "success";
|
|
48080
48086
|
});
|
|
48087
|
+
router$g.get("/get", async (ctx) => {
|
|
48088
|
+
const key = ctx.query.key;
|
|
48089
|
+
if (!key) {
|
|
48090
|
+
ctx.body = "key is required";
|
|
48091
|
+
return;
|
|
48092
|
+
}
|
|
48093
|
+
const value = appConfig.get(key);
|
|
48094
|
+
ctx.body = value;
|
|
48095
|
+
});
|
|
48081
48096
|
router$g.post("/set", async (ctx) => {
|
|
48082
48097
|
const data = ctx.request.body;
|
|
48083
48098
|
if (!data.key || !data.value) {
|
|
@@ -48132,7 +48147,7 @@ router$g.post("/verifyBiliKey", async (ctx) => {
|
|
|
48132
48147
|
ctx.body = response;
|
|
48133
48148
|
}
|
|
48134
48149
|
});
|
|
48135
|
-
router$g.post("/
|
|
48150
|
+
router$g.post("/reset-bin", async (ctx) => {
|
|
48136
48151
|
const data = ctx.request.body;
|
|
48137
48152
|
const type = data.type;
|
|
48138
48153
|
if (!type) {
|
|
@@ -54061,46 +54076,55 @@ const coerce$1 = (version, options) => {
|
|
|
54061
54076
|
};
|
|
54062
54077
|
var coerce_1 = coerce$1;
|
|
54063
54078
|
|
|
54064
|
-
|
|
54065
|
-
|
|
54066
|
-
this.max = 1000;
|
|
54067
|
-
this.map = new Map();
|
|
54068
|
-
}
|
|
54079
|
+
var lrucache;
|
|
54080
|
+
var hasRequiredLrucache;
|
|
54069
54081
|
|
|
54070
|
-
|
|
54071
|
-
|
|
54072
|
-
|
|
54073
|
-
return undefined
|
|
54074
|
-
} else {
|
|
54075
|
-
// Remove the key from the map and add it to the end
|
|
54076
|
-
this.map.delete(key);
|
|
54077
|
-
this.map.set(key, value);
|
|
54078
|
-
return value
|
|
54079
|
-
}
|
|
54080
|
-
}
|
|
54082
|
+
function requireLrucache () {
|
|
54083
|
+
if (hasRequiredLrucache) return lrucache;
|
|
54084
|
+
hasRequiredLrucache = 1;
|
|
54081
54085
|
|
|
54082
|
-
|
|
54083
|
-
|
|
54084
|
-
|
|
54086
|
+
class LRUCache {
|
|
54087
|
+
constructor () {
|
|
54088
|
+
this.max = 1000;
|
|
54089
|
+
this.map = new Map();
|
|
54090
|
+
}
|
|
54085
54091
|
|
|
54086
|
-
|
|
54087
|
-
|
|
54092
|
+
get (key) {
|
|
54093
|
+
const value = this.map.get(key);
|
|
54094
|
+
if (value === undefined) {
|
|
54095
|
+
return undefined
|
|
54096
|
+
} else {
|
|
54097
|
+
// Remove the key from the map and add it to the end
|
|
54098
|
+
this.map.delete(key);
|
|
54099
|
+
this.map.set(key, value);
|
|
54100
|
+
return value
|
|
54101
|
+
}
|
|
54102
|
+
}
|
|
54088
54103
|
|
|
54089
|
-
|
|
54090
|
-
|
|
54091
|
-
|
|
54092
|
-
const firstKey = this.map.keys().next().value;
|
|
54093
|
-
this.delete(firstKey);
|
|
54094
|
-
}
|
|
54104
|
+
delete (key) {
|
|
54105
|
+
return this.map.delete(key)
|
|
54106
|
+
}
|
|
54095
54107
|
|
|
54096
|
-
|
|
54097
|
-
|
|
54108
|
+
set (key, value) {
|
|
54109
|
+
const deleted = this.delete(key);
|
|
54098
54110
|
|
|
54099
|
-
|
|
54100
|
-
|
|
54101
|
-
|
|
54111
|
+
if (!deleted && value !== undefined) {
|
|
54112
|
+
// If cache is full, delete the least recently used item
|
|
54113
|
+
if (this.map.size >= this.max) {
|
|
54114
|
+
const firstKey = this.map.keys().next().value;
|
|
54115
|
+
this.delete(firstKey);
|
|
54116
|
+
}
|
|
54102
54117
|
|
|
54103
|
-
|
|
54118
|
+
this.map.set(key, value);
|
|
54119
|
+
}
|
|
54120
|
+
|
|
54121
|
+
return this
|
|
54122
|
+
}
|
|
54123
|
+
}
|
|
54124
|
+
|
|
54125
|
+
lrucache = LRUCache;
|
|
54126
|
+
return lrucache;
|
|
54127
|
+
}
|
|
54104
54128
|
|
|
54105
54129
|
var range;
|
|
54106
54130
|
var hasRequiredRange;
|
|
@@ -54323,7 +54347,7 @@ function requireRange () {
|
|
|
54323
54347
|
|
|
54324
54348
|
range = Range;
|
|
54325
54349
|
|
|
54326
|
-
const LRU =
|
|
54350
|
+
const LRU = requireLrucache();
|
|
54327
54351
|
const cache = new LRU();
|
|
54328
54352
|
|
|
54329
54353
|
const parseOptions = parseOptions_1;
|
|
@@ -55535,7 +55559,7 @@ router$e.post("/danma/timestamp", async (ctx) => {
|
|
|
55535
55559
|
const { filepath } = ctx.request.body;
|
|
55536
55560
|
ctx.body = await index$1.readXmlTimestamp(filepath);
|
|
55537
55561
|
});
|
|
55538
|
-
router$e.post("/
|
|
55562
|
+
router$e.post("/parse-video-metadata", async (ctx) => {
|
|
55539
55563
|
const files = ctx.request.body;
|
|
55540
55564
|
ctx.body = await index$1.parseMeta(files);
|
|
55541
55565
|
});
|
|
@@ -56145,7 +56169,7 @@ router$c.get("/danmu/:id", async (ctx) => {
|
|
|
56145
56169
|
router$c.post("/danmu", async (ctx) => {
|
|
56146
56170
|
const danmuPreset = container.resolve("danmuPreset");
|
|
56147
56171
|
const data = ctx.request.body;
|
|
56148
|
-
ctx.body = await danmuPreset.save(data);
|
|
56172
|
+
ctx.body = await danmuPreset.save({ ...data, id: index$1.uuid() });
|
|
56149
56173
|
});
|
|
56150
56174
|
router$c.del("/danmu/:id", async (ctx) => {
|
|
56151
56175
|
const danmuPreset = container.resolve("danmuPreset");
|
|
@@ -56169,7 +56193,11 @@ router$c.post("/video", async (ctx) => {
|
|
|
56169
56193
|
const preset = container.resolve("videoPreset");
|
|
56170
56194
|
const data = ctx.request.body;
|
|
56171
56195
|
data.config = index$1.omit(data.config, ["dtime"]);
|
|
56172
|
-
|
|
56196
|
+
const [status, msg] = index$1.validateBiliupConfig(data.config);
|
|
56197
|
+
if (!status) {
|
|
56198
|
+
throw new Error(msg || "配置验证失败");
|
|
56199
|
+
}
|
|
56200
|
+
ctx.body = await preset.save({ ...data, id: index$1.uuid() });
|
|
56173
56201
|
});
|
|
56174
56202
|
router$c.del("/video/:id", async (ctx) => {
|
|
56175
56203
|
const preset = container.resolve("videoPreset");
|
|
@@ -56179,6 +56207,10 @@ router$c.put("/video/:id", async (ctx) => {
|
|
|
56179
56207
|
const preset = container.resolve("videoPreset");
|
|
56180
56208
|
const data = ctx.request.body;
|
|
56181
56209
|
data.config = index$1.omit(data.config, ["dtime"]);
|
|
56210
|
+
const [status, msg] = index$1.validateBiliupConfig(data.config);
|
|
56211
|
+
if (!status) {
|
|
56212
|
+
throw new Error(msg || "配置验证失败");
|
|
56213
|
+
}
|
|
56182
56214
|
ctx.body = await preset.save({ ...data, id: ctx.params.id });
|
|
56183
56215
|
});
|
|
56184
56216
|
////////////////// ffmpeg预设 ///////////////////////////////
|
|
@@ -56197,7 +56229,7 @@ router$c.get("/ffmpeg/:id", async (ctx) => {
|
|
|
56197
56229
|
router$c.post("/ffmpeg", async (ctx) => {
|
|
56198
56230
|
const preset = container.resolve("ffmpegPreset");
|
|
56199
56231
|
const data = ctx.request.body;
|
|
56200
|
-
ctx.body = await preset.save(data);
|
|
56232
|
+
ctx.body = await preset.save({ ...data, id: index$1.uuid() });
|
|
56201
56233
|
});
|
|
56202
56234
|
router$c.del("/ffmpeg/:id", async (ctx) => {
|
|
56203
56235
|
const preset = container.resolve("ffmpegPreset");
|
|
@@ -56220,7 +56252,7 @@ router$c.get("/subtitle-style/:id", async (ctx) => {
|
|
|
56220
56252
|
router$c.post("/subtitle-style", async (ctx) => {
|
|
56221
56253
|
const preset = container.resolve("subtitleStylePreset");
|
|
56222
56254
|
const data = ctx.request.body;
|
|
56223
|
-
ctx.body = await preset.save(data);
|
|
56255
|
+
ctx.body = await preset.save({ ...data, id: index$1.uuid() });
|
|
56224
56256
|
});
|
|
56225
56257
|
router$c.del("/subtitle-style/:id", async (ctx) => {
|
|
56226
56258
|
const preset = container.resolve("subtitleStylePreset");
|
|
@@ -62549,7 +62581,7 @@ class MultipartBody {
|
|
|
62549
62581
|
let fileFromPathWarned = false;
|
|
62550
62582
|
async function fileFromPath(path, ...args) {
|
|
62551
62583
|
// 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-
|
|
62584
|
+
const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-DdVRxbmq.cjs'); });
|
|
62553
62585
|
if (!fileFromPathWarned) {
|
|
62554
62586
|
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`);
|
|
62555
62587
|
fileFromPathWarned = true;
|
|
@@ -69858,32 +69890,36 @@ class Shazam {
|
|
|
69858
69890
|
*/
|
|
69859
69891
|
async recognise(path, language = "en-US", minimal = false) {
|
|
69860
69892
|
const signatures = shazamioCore.recognizeBytes(require$$0$9.readFileSync(path), 0, Number.MAX_SAFE_INTEGER);
|
|
69861
|
-
|
|
69862
|
-
|
|
69863
|
-
|
|
69864
|
-
|
|
69865
|
-
|
|
69866
|
-
|
|
69867
|
-
|
|
69868
|
-
|
|
69869
|
-
|
|
69870
|
-
|
|
69871
|
-
|
|
69872
|
-
|
|
69873
|
-
|
|
69874
|
-
|
|
69875
|
-
|
|
69876
|
-
|
|
69877
|
-
|
|
69878
|
-
|
|
69893
|
+
try {
|
|
69894
|
+
let response;
|
|
69895
|
+
for (let i = Math.floor(signatures.length / 2); i < signatures.length; i += 4) {
|
|
69896
|
+
const data = {
|
|
69897
|
+
timezone: this.endpoint.timezone,
|
|
69898
|
+
signature: {
|
|
69899
|
+
uri: signatures[i].uri,
|
|
69900
|
+
samplems: signatures[i].samplems,
|
|
69901
|
+
},
|
|
69902
|
+
timestamp: new Date().getTime(),
|
|
69903
|
+
context: {},
|
|
69904
|
+
geolocation: {},
|
|
69905
|
+
};
|
|
69906
|
+
const url = new URL(this.endpoint.url());
|
|
69907
|
+
Object.entries(this.endpoint.params()).forEach(([a, b]) => url.searchParams.append(a, b));
|
|
69908
|
+
response = await this.endpoint.sendRecognizeRequest(url.toString(), JSON.stringify(data), language);
|
|
69909
|
+
if (response?.matches?.length === 0)
|
|
69910
|
+
continue;
|
|
69911
|
+
break;
|
|
69912
|
+
}
|
|
69913
|
+
if (!response)
|
|
69914
|
+
return null;
|
|
69915
|
+
if (response?.matches?.length === 0)
|
|
69916
|
+
return null;
|
|
69917
|
+
return response;
|
|
69918
|
+
}
|
|
69919
|
+
finally {
|
|
69920
|
+
for (const sig of signatures)
|
|
69921
|
+
sig.free();
|
|
69879
69922
|
}
|
|
69880
|
-
for (const sig of signatures)
|
|
69881
|
-
sig.free();
|
|
69882
|
-
if (!response)
|
|
69883
|
-
return null;
|
|
69884
|
-
if (response?.matches.length === 0)
|
|
69885
|
-
return null;
|
|
69886
|
-
return response;
|
|
69887
69923
|
}
|
|
69888
69924
|
createSignatureGenerator(samples) {
|
|
69889
69925
|
const signatureGenerator = new SignatureGenerator();
|
|
@@ -73901,7 +73937,7 @@ danmaTestWSS.on("connection", (socket, request) => {
|
|
|
73901
73937
|
}, sendTextAfterMs);
|
|
73902
73938
|
}
|
|
73903
73939
|
});
|
|
73904
|
-
const getSingleQueryValue = (value) => {
|
|
73940
|
+
const getSingleQueryValue$1 = (value) => {
|
|
73905
73941
|
if (Array.isArray(value)) {
|
|
73906
73942
|
return value[0];
|
|
73907
73943
|
}
|
|
@@ -73910,8 +73946,8 @@ const getSingleQueryValue = (value) => {
|
|
|
73910
73946
|
/**
|
|
73911
73947
|
* 录制任务相关接口
|
|
73912
73948
|
* @route GET /recorder/list
|
|
73913
|
-
* @param platform 直播平台,DouYu: 斗鱼, HuYa: 虎牙, Bilibili: 哔哩哔哩, DouYin:
|
|
73914
|
-
* @param
|
|
73949
|
+
* @param platform 直播平台,DouYu: 斗鱼, HuYa: 虎牙, Bilibili: 哔哩哔哩, DouYin: 抖音, XHS: 小红书, TikTok: TikTok
|
|
73950
|
+
* @param status 录制状态 recording: 录制中 idle: 空闲中 check-error: 检查错误 title-blocked: 标题被屏蔽
|
|
73915
73951
|
* @param name 备注名称或直播间号,模糊搜索
|
|
73916
73952
|
* @param autoCheck 是否自动监控
|
|
73917
73953
|
* @param page 页码
|
|
@@ -73925,11 +73961,11 @@ router$a.get("/list", async (ctx) => {
|
|
|
73925
73961
|
ctx.body = { payload: await recorderService.getRecorders(query) };
|
|
73926
73962
|
});
|
|
73927
73963
|
router$a.get("/detail", async (ctx) => {
|
|
73928
|
-
const recorderId = getSingleQueryValue(ctx.request.query.recorderId);
|
|
73929
|
-
const page = getSingleQueryValue(ctx.request.query.page);
|
|
73930
|
-
const pageSize = getSingleQueryValue(ctx.request.query.pageSize);
|
|
73931
|
-
const startTime = getSingleQueryValue(ctx.request.query.startTime);
|
|
73932
|
-
const endTime = getSingleQueryValue(ctx.request.query.endTime);
|
|
73964
|
+
const recorderId = getSingleQueryValue$1(ctx.request.query.recorderId);
|
|
73965
|
+
const page = getSingleQueryValue$1(ctx.request.query.page);
|
|
73966
|
+
const pageSize = getSingleQueryValue$1(ctx.request.query.pageSize);
|
|
73967
|
+
const startTime = getSingleQueryValue$1(ctx.request.query.startTime);
|
|
73968
|
+
const endTime = getSingleQueryValue$1(ctx.request.query.endTime);
|
|
73933
73969
|
if (!recorderId) {
|
|
73934
73970
|
ctx.status = 400;
|
|
73935
73971
|
ctx.body = {
|
|
@@ -74012,16 +74048,28 @@ router$a.delete("/:id", (ctx) => {
|
|
|
74012
74048
|
});
|
|
74013
74049
|
/**
|
|
74014
74050
|
* 开始录制
|
|
74051
|
+
* @deprecated
|
|
74015
74052
|
* @route POST /recorder/:recorderId/start_record
|
|
74016
|
-
* @param recorderId
|
|
74053
|
+
* @param recorderId 录制ID
|
|
74017
74054
|
* @returns 录制任务信息
|
|
74018
74055
|
*/
|
|
74019
74056
|
router$a.post("/:id/start_record", async (ctx) => {
|
|
74020
74057
|
const { id } = ctx.params;
|
|
74021
74058
|
ctx.body = { payload: await recorderService.startRecord({ id }) };
|
|
74022
74059
|
});
|
|
74060
|
+
/**
|
|
74061
|
+
* 开始录制
|
|
74062
|
+
* @route POST /recorder/:recorderId/start
|
|
74063
|
+
* @param recorderId 录制ID
|
|
74064
|
+
* @returns 录制任务信息
|
|
74065
|
+
*/
|
|
74066
|
+
router$a.post("/:id/start", async (ctx) => {
|
|
74067
|
+
const { id } = ctx.params;
|
|
74068
|
+
ctx.body = { payload: await recorderService.startRecord({ id }) };
|
|
74069
|
+
});
|
|
74023
74070
|
/**
|
|
74024
74071
|
* 停止录制
|
|
74072
|
+
* @deprecated
|
|
74025
74073
|
* @route POST /recorder/:recorderId/stop_record
|
|
74026
74074
|
* @param recorderId 直播间ID
|
|
74027
74075
|
* @returns 录制任务信息
|
|
@@ -74030,6 +74078,17 @@ router$a.post("/:id/stop_record", async (ctx) => {
|
|
|
74030
74078
|
const { id } = ctx.params;
|
|
74031
74079
|
ctx.body = { payload: await recorderService.stopRecord({ id }) };
|
|
74032
74080
|
});
|
|
74081
|
+
/**
|
|
74082
|
+
* 停止录制
|
|
74083
|
+
* @deprecated
|
|
74084
|
+
* @route POST /recorder/:recorderId/stop
|
|
74085
|
+
* @param recorderId 录制ID
|
|
74086
|
+
* @returns 录制任务信息
|
|
74087
|
+
*/
|
|
74088
|
+
router$a.post("/:id/stop", async (ctx) => {
|
|
74089
|
+
const { id } = ctx.params;
|
|
74090
|
+
ctx.body = { payload: await recorderService.stopRecord({ id }) };
|
|
74091
|
+
});
|
|
74033
74092
|
/**
|
|
74034
74093
|
* 切割录制
|
|
74035
74094
|
* @route POST /recorder/:recorderId/cut
|
|
@@ -74072,11 +74131,11 @@ router$a.post("/manager/batch_stop_record", async (ctx) => {
|
|
|
74072
74131
|
});
|
|
74073
74132
|
/**
|
|
74074
74133
|
* 解析直播间地址,获取对应的直播间信息
|
|
74075
|
-
* @route GET /recorder/manager/
|
|
74134
|
+
* @route GET /recorder/manager/resolve-channel
|
|
74076
74135
|
* @param url 直播间地址
|
|
74077
74136
|
* @returns 直播间信息
|
|
74078
74137
|
*/
|
|
74079
|
-
router$a.get("/manager/
|
|
74138
|
+
router$a.get("/manager/resolve-channel", async (ctx) => {
|
|
74080
74139
|
const { url } = ctx.query;
|
|
74081
74140
|
const data = await recorderService.resolveChannel(url);
|
|
74082
74141
|
ctx.body = { payload: data };
|
|
@@ -74105,12 +74164,12 @@ router$a.post("/manager/batchResolveChannel", async (ctx) => {
|
|
|
74105
74164
|
});
|
|
74106
74165
|
/**
|
|
74107
74166
|
* 获取直播间实时信息
|
|
74108
|
-
* @route POST /recorder/manager/
|
|
74167
|
+
* @route POST /recorder/manager/live-info
|
|
74109
74168
|
* @param ids 直播间ID列表
|
|
74110
74169
|
* @param forceRequest 强制查询直播间信息,不受配置限制,默认true
|
|
74111
74170
|
* @returns 直播间实时信息列表
|
|
74112
74171
|
*/
|
|
74113
|
-
router$a.post("/manager/
|
|
74172
|
+
router$a.post("/manager/live-info", async (ctx) => {
|
|
74114
74173
|
const { ids } = ctx.request.body;
|
|
74115
74174
|
const forceRequest = ctx.request.body.forceRequest ?? true;
|
|
74116
74175
|
let requestInfoForRecord = true;
|
|
@@ -74168,7 +74227,7 @@ router$a.get("/douyin/stream-info", async (ctx) => {
|
|
|
74168
74227
|
try {
|
|
74169
74228
|
const info = await index$1.getStream({
|
|
74170
74229
|
channelId: roomId,
|
|
74171
|
-
quality: getSingleQueryValue(quality) || "origin",
|
|
74230
|
+
quality: getSingleQueryValue$1(quality) || "origin",
|
|
74172
74231
|
streamPriorities: [],
|
|
74173
74232
|
sourcePriorities: [],
|
|
74174
74233
|
formatPriorities: ["flv"],
|
|
@@ -74667,15 +74726,47 @@ const generateWaveformData = async (videoFilePath) => {
|
|
|
74667
74726
|
const router$8 = new Router$1({
|
|
74668
74727
|
prefix: "/task",
|
|
74669
74728
|
});
|
|
74729
|
+
const getSingleQueryValue = (value) => {
|
|
74730
|
+
if (Array.isArray(value)) {
|
|
74731
|
+
return value[0];
|
|
74732
|
+
}
|
|
74733
|
+
return value;
|
|
74734
|
+
};
|
|
74670
74735
|
router$8.get("/", async (ctx) => {
|
|
74671
|
-
const type = ctx.query.type;
|
|
74736
|
+
const type = getSingleQueryValue(ctx.request.query.type);
|
|
74737
|
+
const status = getSingleQueryValue(ctx.request.query.status);
|
|
74738
|
+
const page = getSingleQueryValue(ctx.request.query.page);
|
|
74739
|
+
const pageSize = getSingleQueryValue(ctx.request.query.pageSize);
|
|
74672
74740
|
let data = index$1.handleListTask();
|
|
74673
74741
|
if (type) {
|
|
74674
74742
|
data = data.filter((item) => item.type === type);
|
|
74675
74743
|
}
|
|
74744
|
+
if (status) {
|
|
74745
|
+
data = data.filter((item) => item.status === status);
|
|
74746
|
+
}
|
|
74747
|
+
const currentPage = page ? Number(page) : 1;
|
|
74748
|
+
const currentPageSize = pageSize ? Number(pageSize) : data.length || 1;
|
|
74749
|
+
if (!Number.isInteger(currentPage) || currentPage < 1) {
|
|
74750
|
+
ctx.status = 400;
|
|
74751
|
+
ctx.body = "page must be a positive integer";
|
|
74752
|
+
return;
|
|
74753
|
+
}
|
|
74754
|
+
if (!Number.isInteger(currentPageSize) || currentPageSize < 1) {
|
|
74755
|
+
ctx.status = 400;
|
|
74756
|
+
ctx.body = "pageSize must be a positive integer";
|
|
74757
|
+
return;
|
|
74758
|
+
}
|
|
74759
|
+
const total = data.length;
|
|
74760
|
+
const start = (currentPage - 1) * currentPageSize;
|
|
74761
|
+
const list = data.slice(start, start + currentPageSize);
|
|
74676
74762
|
ctx.body = {
|
|
74677
|
-
list
|
|
74763
|
+
list,
|
|
74678
74764
|
runningTaskNum: data.filter((item) => item.status === "running").length,
|
|
74765
|
+
pagination: {
|
|
74766
|
+
total,
|
|
74767
|
+
page: currentPage,
|
|
74768
|
+
pageSize: currentPageSize,
|
|
74769
|
+
},
|
|
74679
74770
|
};
|
|
74680
74771
|
});
|
|
74681
74772
|
router$8.get("/:id", async (ctx) => {
|
|
@@ -75277,6 +75368,28 @@ router$6.post("/download", async (ctx) => {
|
|
|
75277
75368
|
let options = ctx.request.body;
|
|
75278
75369
|
ctx.body = await downloadVideo(options);
|
|
75279
75370
|
});
|
|
75371
|
+
router$6.get("/douyu/videoList", async (ctx) => {
|
|
75372
|
+
const { subId, page, limit } = ctx.query;
|
|
75373
|
+
const res = await index$1.douyu.getReplayList(String(subId), {
|
|
75374
|
+
page: Number(page || 1),
|
|
75375
|
+
limit: Number(limit || 20),
|
|
75376
|
+
});
|
|
75377
|
+
const data = res.list.map((item) => {
|
|
75378
|
+
const firstVideo = item.video_list[0];
|
|
75379
|
+
return {
|
|
75380
|
+
startTime: firstVideo?.start_time,
|
|
75381
|
+
title: item.title,
|
|
75382
|
+
timeStr: new Date(firstVideo?.start_time * 1000).toLocaleString(),
|
|
75383
|
+
videos: item.video_list.map((video) => ({
|
|
75384
|
+
videoId: video.hash_id,
|
|
75385
|
+
title: video.title,
|
|
75386
|
+
url: `https://v.douyu.com/show/${video.hash_id}`,
|
|
75387
|
+
})),
|
|
75388
|
+
};
|
|
75389
|
+
});
|
|
75390
|
+
console.log(data);
|
|
75391
|
+
ctx.body = data;
|
|
75392
|
+
});
|
|
75280
75393
|
router$6.post("/sub/parse", async (ctx) => {
|
|
75281
75394
|
let data = ctx.request.body;
|
|
75282
75395
|
if (!data.url) {
|
|
@@ -76726,7 +76839,7 @@ const router$1 = new Router$1({
|
|
|
76726
76839
|
// });
|
|
76727
76840
|
// ctx.body = result;
|
|
76728
76841
|
// });
|
|
76729
|
-
router$1.post("/
|
|
76842
|
+
router$1.post("/song-recognize", async (ctx) => {
|
|
76730
76843
|
const data = ctx.request.body;
|
|
76731
76844
|
if (!data.file || data.startTime == null || data.endTime == null) {
|
|
76732
76845
|
ctx.status = 400;
|
|
@@ -77055,7 +77168,7 @@ class ConfigManager {
|
|
|
77055
77168
|
uploadToSameMedia,
|
|
77056
77169
|
noDanmuVideoPreset,
|
|
77057
77170
|
videoHandleTime: limitVideoConvertTime ? videoHandleTime : undefined,
|
|
77058
|
-
partTitleTemplate: this.getRoomSetting("partTitleTemplate", roomSetting) || "
|
|
77171
|
+
partTitleTemplate: this.getRoomSetting("partTitleTemplate", roomSetting) || "",
|
|
77059
77172
|
afterUploadDeletAction: this.getRoomSetting("afterUploadDeletAction", roomSetting) ?? "none",
|
|
77060
77173
|
syncId,
|
|
77061
77174
|
flvRepair,
|
|
@@ -78606,10 +78719,21 @@ class WebhookHandler {
|
|
|
78606
78719
|
const runtimePart = this.getRuntimePart(part);
|
|
78607
78720
|
return type === "handled" ? runtimePart.handledCid : runtimePart.rawCid;
|
|
78608
78721
|
}
|
|
78722
|
+
createUploadFileMeta(live, part, index) {
|
|
78723
|
+
return {
|
|
78724
|
+
index,
|
|
78725
|
+
title: part.title,
|
|
78726
|
+
username: live.username,
|
|
78727
|
+
roomId: live.roomId,
|
|
78728
|
+
startTimestamp: part.startTime ? Math.floor(part.startTime / 1000) : null,
|
|
78729
|
+
platform: live.platform,
|
|
78730
|
+
};
|
|
78731
|
+
}
|
|
78609
78732
|
toPathArray(items) {
|
|
78610
78733
|
return items.map((item) => ({
|
|
78611
78734
|
path: item.path,
|
|
78612
78735
|
title: item.title,
|
|
78736
|
+
meta: item.meta,
|
|
78613
78737
|
}));
|
|
78614
78738
|
}
|
|
78615
78739
|
createUploadItems(filePaths, type) {
|
|
@@ -78698,28 +78822,22 @@ class WebhookHandler {
|
|
|
78698
78822
|
* 构建上传文件列表
|
|
78699
78823
|
* @private
|
|
78700
78824
|
*/
|
|
78701
|
-
buildUploadFileList(live, uploadableParts, type
|
|
78825
|
+
buildUploadFileList(live, uploadableParts, type) {
|
|
78702
78826
|
const updateStatusField = type === "handled" ? "uploadStatus" : "rawUploadStatus";
|
|
78703
78827
|
const filePathField = type === "handled" ? "filePath" : "rawFilePath";
|
|
78704
78828
|
let cover;
|
|
78705
78829
|
const filePaths = [];
|
|
78706
|
-
// 计算已上传分段的数量,用于生成正确的索引
|
|
78707
78830
|
const uploadedCount = live
|
|
78708
78831
|
.getNonErrorParts(type)
|
|
78709
78832
|
.filter((part) => part[updateStatusField] === "uploaded").length;
|
|
78710
78833
|
let currentIndex = uploadedCount + 1;
|
|
78711
78834
|
// 构建上传文件列表
|
|
78712
78835
|
for (const part of uploadableParts) {
|
|
78713
|
-
|
|
78714
|
-
|
|
78715
|
-
|
|
78716
|
-
|
|
78717
|
-
|
|
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 });
|
|
78836
|
+
filePaths.push({
|
|
78837
|
+
path: part[filePathField],
|
|
78838
|
+
meta: this.createUploadFileMeta(live, part, currentIndex),
|
|
78839
|
+
part,
|
|
78840
|
+
});
|
|
78723
78841
|
if (!cover)
|
|
78724
78842
|
cover = part.cover;
|
|
78725
78843
|
currentIndex++;
|
|
@@ -78772,13 +78890,13 @@ class WebhookHandler {
|
|
|
78772
78890
|
}
|
|
78773
78891
|
return sortParams;
|
|
78774
78892
|
}
|
|
78775
|
-
getUploadedItemCountForSameMedia(live,
|
|
78893
|
+
getUploadedItemCountForSameMedia(live, type) {
|
|
78776
78894
|
let uploadedCount = 0;
|
|
78777
78895
|
for (const part of live.parts) {
|
|
78778
|
-
if (part.uploadStatus === "uploaded") {
|
|
78896
|
+
if (type === "handled" && part.uploadStatus === "uploaded") {
|
|
78779
78897
|
uploadedCount++;
|
|
78780
78898
|
}
|
|
78781
|
-
if (
|
|
78899
|
+
if (type === "raw" && part.rawUploadStatus === "uploaded") {
|
|
78782
78900
|
uploadedCount++;
|
|
78783
78901
|
}
|
|
78784
78902
|
}
|
|
@@ -78787,7 +78905,10 @@ class WebhookHandler {
|
|
|
78787
78905
|
buildSameMediaUploadFileList(live, config) {
|
|
78788
78906
|
let cover;
|
|
78789
78907
|
const filePaths = [];
|
|
78790
|
-
|
|
78908
|
+
const currentIndexes = {
|
|
78909
|
+
handled: this.getUploadedItemCountForSameMedia(live, "handled") + 1,
|
|
78910
|
+
raw: this.getUploadedItemCountForSameMedia(live, "raw") + 1,
|
|
78911
|
+
};
|
|
78791
78912
|
for (const type of SAME_MEDIA_UPLOAD_ORDER) {
|
|
78792
78913
|
for (const part of live.parts) {
|
|
78793
78914
|
const item = this.getSameMediaUploadCandidate(part, type, config);
|
|
@@ -78797,27 +78918,16 @@ class WebhookHandler {
|
|
|
78797
78918
|
continue;
|
|
78798
78919
|
if (!item.canUpload)
|
|
78799
78920
|
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
78921
|
filePaths.push({
|
|
78812
78922
|
part,
|
|
78813
78923
|
path: item.path,
|
|
78814
|
-
|
|
78924
|
+
meta: this.createUploadFileMeta(live, part, currentIndexes[type]),
|
|
78815
78925
|
type: item.type,
|
|
78816
78926
|
});
|
|
78817
78927
|
if (!cover) {
|
|
78818
78928
|
cover = part.cover;
|
|
78819
78929
|
}
|
|
78820
|
-
|
|
78930
|
+
currentIndexes[type]++;
|
|
78821
78931
|
}
|
|
78822
78932
|
}
|
|
78823
78933
|
return { filePaths, cover };
|
|
@@ -78860,6 +78970,8 @@ class WebhookHandler {
|
|
|
78860
78970
|
if (config.useLiveCover && cover) {
|
|
78861
78971
|
uploadPreset.cover = cover;
|
|
78862
78972
|
}
|
|
78973
|
+
uploadPreset.partTitleTemplate =
|
|
78974
|
+
config.partTitleTemplate?.trim() || uploadPreset.partTitleTemplate?.trim() || "";
|
|
78863
78975
|
// 处理转载来源:当设置为转载类型且转载来源为空时,自动生成直播间链接
|
|
78864
78976
|
// TODO: 考虑迁移到上传预设配置实现,需要将metadata参数传递到上传函数中
|
|
78865
78977
|
if (uploadPreset.copyright === 2 &&
|
|
@@ -79001,7 +79113,7 @@ class WebhookHandler {
|
|
|
79001
79113
|
// 3. 获取配置
|
|
79002
79114
|
const config = this.configManager.getConfig(live.roomId);
|
|
79003
79115
|
// 4. 构建上传文件列表
|
|
79004
|
-
const { filePaths, cover } = this.buildUploadFileList(live, uploadableParts, type
|
|
79116
|
+
const { filePaths, cover } = this.buildUploadFileList(live, uploadableParts, type);
|
|
79005
79117
|
// 5. 验证上传配置
|
|
79006
79118
|
if (!this.validateUploadConfig(live, filePaths, type, config)) {
|
|
79007
79119
|
return;
|
|
@@ -79091,7 +79203,7 @@ let handler;
|
|
|
79091
79203
|
let appConfig;
|
|
79092
79204
|
let container;
|
|
79093
79205
|
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-
|
|
79206
|
+
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-BFO4BeOx.cjs', document.baseURI).href))));
|
|
79095
79207
|
const authMiddleware = (passKey) => {
|
|
79096
79208
|
return async (ctx, next) => {
|
|
79097
79209
|
const authHeader = ctx.headers["authorization"] || ctx.request.query.auth;
|