🪛 chore: 整理直播切片

This commit is contained in:
zhiyu1998 2024-10-03 21:44:46 +08:00
parent c7b5c0dc7a
commit 16fbdd8ab7
3 changed files with 13 additions and 11 deletions

View File

@ -231,6 +231,8 @@ export class tools extends plugin {
this.identifyPrefix = this.toolsConfig.identifyPrefix; this.identifyPrefix = this.toolsConfig.identifyPrefix;
// 加载直播录制时长 // 加载直播录制时长
this.streamDuration = this.toolsConfig.streamDuration; this.streamDuration = this.toolsConfig.streamDuration;
// 加载直播是否开启兼容模式
this.streamCompatibility = this.toolsConfig.streamCompatibility;
// 加载哔哩哔哩配置 // 加载哔哩哔哩配置
this.biliSessData = this.toolsConfig.biliSessData; this.biliSessData = this.toolsConfig.biliSessData;
// 加载哔哩哔哩的限制时长 // 加载哔哩哔哩的限制时长
@ -261,8 +263,6 @@ export class tools extends plugin {
this.douyinCompression = this.toolsConfig.douyinCompression; this.douyinCompression = this.toolsConfig.douyinCompression;
// 加载抖音是否开启评论 // 加载抖音是否开启评论
this.douyinComments = this.toolsConfig.douyinComments; this.douyinComments = this.toolsConfig.douyinComments;
// 加载抖音的是否开启兼容模式
this.douyinStreamCompatibility = this.toolsConfig.douyinStreamCompatibility;
// 加载小红书Cookie // 加载小红书Cookie
this.xiaohongshuCookie = this.toolsConfig.xiaohongshuCookie; this.xiaohongshuCookie = this.toolsConfig.xiaohongshuCookie;
// 翻译引擎 // 翻译引擎
@ -485,7 +485,7 @@ export class tools extends plugin {
async sendStreamSegment(e, stream_url, second = this.streamDuration) { async sendStreamSegment(e, stream_url, second = this.streamDuration) {
let outputFilePath = `${ this.getCurDownloadPath(e) }/stream_${second}s.flv`; let outputFilePath = `${ this.getCurDownloadPath(e) }/stream_${second}s.flv`;
// 删除临时文件 // 删除临时文件
if (this.douyinStreamCompatibility) { if (this.streamCompatibility) {
await checkAndRemoveFile(outputFilePath.replace("flv", "mp4")); await checkAndRemoveFile(outputFilePath.replace("flv", "mp4"));
} else { } else {
await checkAndRemoveFile(outputFilePath); await checkAndRemoveFile(outputFilePath);
@ -513,7 +513,7 @@ export class tools extends plugin {
response.data.unpipe(file); // 取消管道连接 response.data.unpipe(file); // 取消管道连接
file.end(); // 结束写入 file.end(); // 结束写入
// 这里判断是否开启兼容模式 // 这里判断是否开启兼容模式
if (this.douyinStreamCompatibility) { if (this.streamCompatibility) {
logger.info(`[R插件][发送直播流] 开启兼容模式开始转换mp4格式...`); logger.info(`[R插件][发送直播流] 开启兼容模式开始转换mp4格式...`);
const resolvedOutputPath = await convertFlvToMp4(outputFilePath, outputFilePath.replace(".flv", ".mp4")); const resolvedOutputPath = await convertFlvToMp4(outputFilePath, outputFilePath.replace(".flv", ".mp4"));
fs.unlinkSync(outputFilePath); fs.unlinkSync(outputFilePath);

View File

@ -7,6 +7,7 @@ identifyPrefix: '' # 识别前缀,比如你识别哔哩哔哩,那么就有
deeplApiUrls: 'http://www.gptspt.cn/translate,http://gptspt.top/translate,http://8.134.135.4:1188/translate,http://120.76.141.173:1188/translate,http://bit.x7ys.com:1188/translate,http://deeplxapi.x7ys.com:1188/translate' deeplApiUrls: 'http://www.gptspt.cn/translate,http://gptspt.top/translate,http://8.134.135.4:1188/translate,http://120.76.141.173:1188/translate,http://bit.x7ys.com:1188/translate,http://deeplxapi.x7ys.com:1188/translate'
streamDuration: 10 # 视频最大时长(单位秒) streamDuration: 10 # 视频最大时长(单位秒)
streamCompatibility: false # 兼容模式NCQQ不用开其他ICQQ、LLO需要开启
biliSessData: '' # 哔哩哔哩的SESSDATA biliSessData: '' # 哔哩哔哩的SESSDATA
biliIntroLenLimit: 50 # 哔哩哔哩简介长度限制,填 0 或者 -1 可以不做任何限制,显示完整简介 biliIntroLenLimit: 50 # 哔哩哔哩简介长度限制,填 0 或者 -1 可以不做任何限制,显示完整简介
@ -26,7 +27,6 @@ YouTubeGraphicsOptions: 720 #YouTobe的下载画质0为原画1080720
douyinCookie: '' # douyin's cookie, 格式odin_tt=xxx;passport_fe_beating_status=xxx;sid_guard=xxx;uid_tt=xxx;uid_tt_ss=xxx;sid_tt=xxx;sessionid=xxx;sessionid_ss=xxx;sid_ucp_v1=xxx;ssid_ucp_v1=xxx;passport_assist_user=xxx;ttwid=xxx; douyinCookie: '' # douyin's cookie, 格式odin_tt=xxx;passport_fe_beating_status=xxx;sid_guard=xxx;uid_tt=xxx;uid_tt_ss=xxx;sid_tt=xxx;sessionid=xxx;sessionid_ss=xxx;sid_ucp_v1=xxx;ssid_ucp_v1=xxx;passport_assist_user=xxx;ttwid=xxx;
douyinCompression: true # true-压缩false-不压缩;是否使用压缩视频格式的抖音(默认使用),使用后加速视频发送 douyinCompression: true # true-压缩false-不压缩;是否使用压缩视频格式的抖音(默认使用),使用后加速视频发送
douyinComments: false # true-开启评论false-关闭评论 douyinComments: false # true-开启评论false-关闭评论
douyinStreamCompatibility: false # 兼容模式NCQQ不用开其他ICQQ、LLO需要开启
xiaohongshuCookie: '' # 2024-8-2后反馈必须使用ck不然无法解析 xiaohongshuCookie: '' # 2024-8-2后反馈必须使用ck不然无法解析

View File

@ -80,6 +80,14 @@ export function supportGuoba() {
placeholder: "请输入最大解析直播时长", placeholder: "请输入最大解析直播时长",
}, },
}, },
{
field: "tools.streamCompatibility",
label: "直播是否开启兼容模式",
bottomHelpMessage:
"兼容模式NCQQ不用开其他ICQQ、LLO需要开启",
component: "Switch",
required: false,
},
{ {
field: "tools.defaultPath", field: "tools.defaultPath",
label: "视频暂存位置", label: "视频暂存位置",
@ -245,12 +253,6 @@ export function supportGuoba() {
component: "Switch", component: "Switch",
required: false, required: false,
}, },
{
field: "tools.douyinStreamCompatibility",
label: "抖音直播是否开启兼容模式",
component: "Switch",
required: false,
},
{ {
field: "tools.xiaohongshuCookie", field: "tools.xiaohongshuCookie",
label: "小红书的Cookie", label: "小红书的Cookie",