@makemidas/cli 0.11.0 → 0.11.1
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/dist/config.js +1 -1
- package/dist/words.js +21 -2
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
export const VERSION = '0.11.
|
|
4
|
+
export const VERSION = '0.11.1';
|
|
5
5
|
export const USER_AGENT = `makemidas-cli/${VERSION}`;
|
|
6
6
|
export const DEFAULT_BASE_URL = 'https://makemidas.com';
|
|
7
7
|
export function resolveBaseUrl(flag) {
|
package/dist/words.js
CHANGED
|
@@ -84,15 +84,34 @@ export function estimateWords(text, start, end) {
|
|
|
84
84
|
return { text: word, start: round(from), end: round(at) };
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
+
/** The shortest a word is taken to last. */
|
|
88
|
+
export const MIN_WORD = 0.15;
|
|
89
|
+
/**
|
|
90
|
+
* Speech models sometimes time a word far too short (a 0.03 s "kept" after
|
|
91
|
+
* a pause): its sound began earlier. Such a word starts earlier, into the
|
|
92
|
+
* silence before it but never into the word before, so its caption lights
|
|
93
|
+
* long enough to see and a cut before it doesn't clip it.
|
|
94
|
+
*/
|
|
95
|
+
export function widenShortWords(words) {
|
|
96
|
+
return words.map((word, i) => {
|
|
97
|
+
const short = MIN_WORD - (word.end - word.start);
|
|
98
|
+
if (short <= 0)
|
|
99
|
+
return word;
|
|
100
|
+
const room = word.start - (words[i - 1]?.end ?? 0);
|
|
101
|
+
if (room <= 0)
|
|
102
|
+
return word;
|
|
103
|
+
return { ...word, start: round(word.start - Math.min(room, short)) };
|
|
104
|
+
});
|
|
105
|
+
}
|
|
87
106
|
/** Every word with its time: the transcript's own, or estimated. */
|
|
88
107
|
export function timedWords(t) {
|
|
89
108
|
const last = t.segments.at(-1)?.end ?? 0;
|
|
90
109
|
const duration = Math.max(t.durationSeconds || 0, last);
|
|
91
110
|
if (t.words?.length) {
|
|
92
111
|
return {
|
|
93
|
-
words: t.words
|
|
112
|
+
words: widenShortWords(t.words
|
|
94
113
|
.map((w) => ({ text: w.word.trim(), start: w.start, end: w.end }))
|
|
95
|
-
.filter((w) => w.text && w.end >= w.start),
|
|
114
|
+
.filter((w) => w.text && w.end >= w.start)),
|
|
96
115
|
estimated: false,
|
|
97
116
|
duration,
|
|
98
117
|
language: t.language,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makemidas/cli",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "AI image, video and audio generation CLI for AI agents (Claude Code, Cursor, Codex) and people: Nano Banana, GPT Image, Seedream, Seedance, Kling, Veo, Suno and more, plus talking avatars, HTML templates and short films, through MakeMidas.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-image-generator",
|