@ww_nero/media 1.0.7 → 1.0.9

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/index.js +8 -7
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,8 +13,8 @@
13
13
  - `audio_file`: 音频文件的相对路径(相对于工作目录),支持 mp3/wav 格式
14
14
 
15
15
  **限制:**
16
- - 音频长度最大 1 分钟
17
- - 文件大小不超过 5MB
16
+ - 音频长度最大 30 分钟
17
+ - 文件大小不超过 120MB
18
18
  - 超出限制需要外部分段处理后逐段识别
19
19
 
20
20
  **输出:**
package/index.js CHANGED
@@ -14,7 +14,7 @@ const ASR_UPLOAD_URL = 'http://fsheep.com:10808/upload';
14
14
  const ASR_SERVICE_URL = 'https://dashscope.aliyuncs.com/api/v1/services/audio/asr/transcription';
15
15
 
16
16
  const SUPPORTED_AUDIO_TYPES = ['.mp3', '.wav'];
17
- const MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024; // 5MB
17
+ const MAX_FILE_SIZE_BYTES = 120 * 1024 * 1024; // 120MB
18
18
  const LANGUAGE_HINTS = ['zh', 'en', 'ja'];
19
19
 
20
20
  /**
@@ -302,7 +302,7 @@ const asr = async ({ working_directory, audio_file }) => {
302
302
  const fileSize = fs.statSync(audioPath).size;
303
303
  if (fileSize > MAX_FILE_SIZE_BYTES) {
304
304
  throw new Error(
305
- `音频文件大小 ${(fileSize / 1024 / 1024).toFixed(2)}MB 超过限制(最大 5MB)。` +
305
+ `音频文件大小 ${(fileSize / 1024 / 1024).toFixed(2)}MB 超过限制(最大 120MB)。` +
306
306
  `请先对音频进行分段处理后再逐段识别。`
307
307
  );
308
308
  }
@@ -328,16 +328,17 @@ const asr = async ({ working_directory, audio_file }) => {
328
328
 
329
329
  // 6. 转换为 SRT 格式并保存
330
330
  const srtContent = asrToSrt(transcriptions);
331
- const outputPath = path.join(workingDir, 'transcribe.srt');
331
+ const filename = `asr_${Date.now()}.srt`;
332
+ const outputPath = path.join(workingDir, filename);
332
333
  fs.writeFileSync(outputPath, srtContent, 'utf-8');
333
334
 
334
- return 'transcribe.srt';
335
+ return filename;
335
336
  };
336
337
 
337
338
  const server = new Server(
338
339
  {
339
340
  name: 'media',
340
- version: '1.0.7',
341
+ version: '1.0.9',
341
342
  },
342
343
  {
343
344
  capabilities: {
@@ -356,11 +357,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
356
357
  properties: {
357
358
  working_directory: {
358
359
  type: 'string',
359
- description: '工作目录的绝对路径,识别结果将保存到此目录下的 transcribe.srt 文件',
360
+ description: '工作目录的绝对路径,识别结果将保存到此目录',
360
361
  },
361
362
  audio_file: {
362
363
  type: 'string',
363
- description: '音频文件的相对路径(相对于工作目录),支持 mp3/wav 格式,音频长度限制 1 分钟以内,文件大小不超过 5MB',
364
+ description: '音频文件的相对路径(相对于工作目录),支持 mp3/wav 格式,音频长度限制 30 分钟以内,文件大小不超过 120MB',
364
365
  },
365
366
  },
366
367
  required: ['working_directory', 'audio_file'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ww_nero/media",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "MCP server for media processing, including ASR speech recognition",
5
5
  "main": "index.js",
6
6
  "bin": {