mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
feat: ffmpeg下载来源更换
This commit is contained in:
@@ -8,11 +8,12 @@ import { pipeline } from 'stream/promises';
|
|||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { LogWrapper } from './log';
|
import { LogWrapper } from './log';
|
||||||
|
|
||||||
const downloadOri = "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2025-04-16-12-54/ffmpeg-n7.1.1-6-g48c0f071d4-win64-lgpl-7.1.zip"
|
const downloadOri = "https://github.com/NapNeko/ffmpeg-build/releases/download/v1.0.0/ffmpeg-7.1.1-win64.zip"
|
||||||
const urls = [
|
const urls = [
|
||||||
"https://github.moeyy.xyz/" + downloadOri,
|
"https://github.moeyy.xyz/" + downloadOri,
|
||||||
"https://ghp.ci/" + downloadOri,
|
"https://ghp.ci/" + downloadOri,
|
||||||
"https://gh.api.99988866.xyz/" + downloadOri,
|
"https://gh.api.99988866.xyz/" + downloadOri,
|
||||||
|
"https://gh.api.99988866.xyz/" + downloadOri,
|
||||||
downloadOri
|
downloadOri
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -336,9 +337,16 @@ export async function downloadFFmpegIfNotExists(log: LogWrapper) {
|
|||||||
const ffprobe_exist = fs.existsSync(path.join(currentPath, 'ffmpeg', 'ffprobe.exe'));
|
const ffprobe_exist = fs.existsSync(path.join(currentPath, 'ffmpeg', 'ffprobe.exe'));
|
||||||
|
|
||||||
if (!ffmpeg_exist || !ffprobe_exist) {
|
if (!ffmpeg_exist || !ffprobe_exist) {
|
||||||
await downloadFFmpeg(path.join(currentPath, 'ffmpeg'), path.join(currentPath, 'cache'), (percentage: number, message: string) => {
|
let url = await downloadFFmpeg(path.join(currentPath, 'ffmpeg'), path.join(currentPath, 'cache'), (percentage: number, message: string) => {
|
||||||
log.log(`[FFmpeg] [Download] ${percentage}% - ${message}`);
|
log.log(`[FFmpeg] [Download] ${percentage}% - ${message}`);
|
||||||
});
|
});
|
||||||
|
if (!url) {
|
||||||
|
log.log('[FFmpeg] [Error] 下载FFmpeg失败');
|
||||||
|
return {
|
||||||
|
path: null,
|
||||||
|
reset: false
|
||||||
|
};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
path: path.join(currentPath, 'ffmpeg'),
|
path: path.join(currentPath, 'ffmpeg'),
|
||||||
reset: true
|
reset: true
|
||||||
|
@@ -12,7 +12,6 @@ import { Writable } from 'stream';
|
|||||||
export function connectToNamedPipe(logger: LogWrapper, timeoutMs: number = 5000): Promise<{ disconnect: () => void }> {
|
export function connectToNamedPipe(logger: LogWrapper, timeoutMs: number = 5000): Promise<{ disconnect: () => void }> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (process.platform !== 'win32') {
|
if (process.platform !== 'win32') {
|
||||||
logger.log('只有Windows平台支持命名管道');
|
|
||||||
// 非Windows平台不reject,而是返回一个空的disconnect函数
|
// 非Windows平台不reject,而是返回一个空的disconnect函数
|
||||||
return resolve({ disconnect: () => { } });
|
return resolve({ disconnect: () => { } });
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user