vocnu 0.2.0 → 0.3.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/README.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +4 -4
- package/src/mcp.js +7 -4
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ progress and time left, and saves the results next to the file. Options:
|
|
|
26
26
|
| --- | --- |
|
|
27
27
|
| `--output video\|audio\|subtitles` | the video with the voice-over (default for video files), the voice-over audio, or subtitles only |
|
|
28
28
|
| `--from <lang>` | spoken language (detected by default) |
|
|
29
|
-
| `--voice female
|
|
29
|
+
| `--voice male\|female\|<voice id>` | a voice type, read by the language's default voice of it (default: male), or a voice from `vocnu voices <lang>` |
|
|
30
30
|
| `--format mp4\|mkv\|mov\|webm\|avi` | video file format, or several separated by commas (`--format mp4,mkv`: one file each, for the price of the dearest); default: the upload's own, else MP4 |
|
|
31
31
|
| `--audio-format m4a\|mp3\|wav\|flac\|ogg` | voice-over audio format |
|
|
32
32
|
| `--burn-subtitles` | subtitles burned into the picture |
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ Usage:
|
|
|
26
26
|
vocnu translate <file> --to <lang> Upload, see the price, translate and download the results
|
|
27
27
|
--output video|audio|subtitles What you get (default: video for a video file, else audio)
|
|
28
28
|
--from <lang> Spoken language (default: detected)
|
|
29
|
-
--voice female
|
|
29
|
+
--voice male|female|<voice id> A voice type, or a voice from \`vocnu voices\` (default: male)
|
|
30
30
|
--format mp4|mkv|mov|webm|avi Video file format, or several: mp4,mkv (default: the upload's, else mp4)
|
|
31
31
|
--audio-format m4a|mp3|wav|flac|ogg
|
|
32
32
|
--burn-subtitles Subtitles burned into the picture
|
|
@@ -169,12 +169,12 @@ async function translate(args, { api, err, out, print }) {
|
|
|
169
169
|
const videoFormats = values.format === undefined ? [defaultVideoFormat(path)] : videoFormatsFrom(values.format)
|
|
170
170
|
const audioFormat = values['audio-format'] ?? 'm4a'
|
|
171
171
|
// A voice type, or a catalog voice of the target language, whose type the API takes.
|
|
172
|
-
const voice = values.voice ?? '
|
|
173
|
-
const voiceType = ['
|
|
172
|
+
const voice = values.voice ?? 'male'
|
|
173
|
+
const voiceType = ['male', 'female'].includes(voice) ? voice : 'male'
|
|
174
174
|
if (!OUTPUTS.includes(output)) throw new UsageError(`--output is one of ${OUTPUTS.join(', ')}.`)
|
|
175
175
|
if (!videoFormats) throw new UsageError(`--format is one or more of ${VIDEO_FORMATS.join(', ')}, separated by commas.`)
|
|
176
176
|
if (!AUDIO_FORMATS.includes(audioFormat)) throw new UsageError(`--audio-format is one of ${AUDIO_FORMATS.join(', ')}.`)
|
|
177
|
-
if (!/^[a-z0-9-]+$/.test(voice)) throw new UsageError('--voice is
|
|
177
|
+
if (!/^[a-z0-9-]+$/.test(voice)) throw new UsageError('--voice is male, female or a voice id from `vocnu voices <lang>`.')
|
|
178
178
|
if (output === 'video' && !isVideo(path)) throw new UsageError('This is an audio file: use --output audio or subtitles.')
|
|
179
179
|
if (!contentType(path)) throw new UsageError('Vocnu takes video and audio files (MP4, MOV, MKV, WebM, MP3, M4A, WAV...).')
|
|
180
180
|
if (voice !== voiceType && !(await api.voices(target)).some((candidate) => candidate.id === voice)) {
|
package/src/mcp.js
CHANGED
|
@@ -60,7 +60,8 @@ export function createServer(api, { cwd = process.cwd() } = {}) {
|
|
|
60
60
|
tool('vocnu_upload_media', {
|
|
61
61
|
description: 'Upload a local video or audio file (up to 10 GB) to Vocnu, wait until it is analysed and return its '
|
|
62
62
|
+ 'source_id, length and price in credits for each output. Nothing is charged until vocnu_start_job. '
|
|
63
|
-
+ '
|
|
63
|
+
+ 'captions_only is true for a video nobody speaks in whose story is told in captions burned into the picture: '
|
|
64
|
+
+ 'Vocnu narrates the captions. Large files take minutes to upload.',
|
|
64
65
|
inputSchema: { path: z.string().describe('Path of the video or audio file on this computer') },
|
|
65
66
|
title: 'Upload media to Vocnu',
|
|
66
67
|
}, async ({ path }) => {
|
|
@@ -70,6 +71,7 @@ export function createServer(api, { cwd = process.cwd() } = {}) {
|
|
|
70
71
|
const { balance } = await api.credits()
|
|
71
72
|
return {
|
|
72
73
|
balance,
|
|
74
|
+
captions_only: source.captions_only === true,
|
|
73
75
|
duration_seconds: source.duration_seconds,
|
|
74
76
|
has_video: source.has_video,
|
|
75
77
|
price_credits: {
|
|
@@ -96,7 +98,8 @@ export function createServer(api, { cwd = process.cwd() } = {}) {
|
|
|
96
98
|
+ 'is the video with the voice-over, "audio" the voice-over audio, "subtitles" subtitles only; every output '
|
|
97
99
|
+ 'also includes subtitles. sdh adds SDH subtitles (sound descriptions, speaker names, songs) for deaf and '
|
|
98
100
|
+ 'hard-of-hearing viewers to any output, at the sdh_extra price. Subtitles may be in the spoken language '
|
|
99
|
-
+ '(target_language = source_language, e.g. German SDH of a German film); a voice-over may not
|
|
101
|
+
+ '(target_language = source_language, e.g. German SDH of a German film); a voice-over may not, except for a '
|
|
102
|
+
+ 'captions_only upload, whose captions the narrator then reads as written.',
|
|
100
103
|
inputSchema: {
|
|
101
104
|
audio_format: z.enum(AUDIO_FORMATS).optional().describe('Voice-over audio format (default m4a)'),
|
|
102
105
|
burn_subtitles: z.boolean().optional().describe('Burn the subtitles into the picture (video only)'),
|
|
@@ -110,7 +113,7 @@ export function createServer(api, { cwd = process.cwd() } = {}) {
|
|
|
110
113
|
video_formats: z.array(z.enum(VIDEO_FORMATS)).min(1).optional()
|
|
111
114
|
.describe('Several video file formats at once, e.g. ["mp4", "mkv"], each its own file (instead of '
|
|
112
115
|
+ 'video_format); they cost what the dearest of them costs'),
|
|
113
|
-
voice: z.enum(['
|
|
116
|
+
voice: z.enum(['male', 'female']).optional().describe('Voice type (default male), read by the language\'s '
|
|
114
117
|
+ 'default voice of that type'),
|
|
115
118
|
voice_id: z.string().optional().describe('A voice of the target language from vocnu_voices, instead of a type'),
|
|
116
119
|
},
|
|
@@ -126,7 +129,7 @@ export function createServer(api, { cwd = process.cwd() } = {}) {
|
|
|
126
129
|
target_language: input.target_language,
|
|
127
130
|
video_format: videoFormats[0],
|
|
128
131
|
video_formats: videoFormats,
|
|
129
|
-
voice: input.voice ?? '
|
|
132
|
+
voice: input.voice ?? 'male',
|
|
130
133
|
...(input.voice_id ? { voice_id: input.voice_id } : {}),
|
|
131
134
|
})
|
|
132
135
|
return { balance_after: created.credit_balance, job_id: created.job.id, status: created.job.status }
|