eprec 1.15.0 → 1.15.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/app/client/app.tsx +1 -2
- package/app/client/editing-workspace.tsx +6 -2
- package/app/client/trim-points.tsx +8 -2
- package/app/components/style-system-sample.tsx +1 -2
- package/app/trim-api.ts +6 -1
- package/app/video-api.ts +2 -2
- package/package.json +2 -1
- package/process-course/cli.ts +0 -1
- package/process-course/edits/cli.ts +10 -5
- package/process-course/summary.ts +0 -3
- package/server/processing-queue.ts +1 -0
- package/src/app-server.ts +6 -2
- package/src/cli.ts +5 -5
package/app/client/app.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { Handle } from 'remix/component'
|
|
2
1
|
import { EditingWorkspace } from './editing-workspace.tsx'
|
|
3
2
|
import { TrimPoints } from './trim-points.tsx'
|
|
4
3
|
|
|
5
|
-
export function App(
|
|
4
|
+
export function App() {
|
|
6
5
|
return () => {
|
|
7
6
|
const pathname =
|
|
8
7
|
typeof window === 'undefined' ? '/' : window.location.pathname
|
|
@@ -314,7 +314,7 @@ export function EditingWorkspace(handle: Handle) {
|
|
|
314
314
|
if (command.action === 'rename' && command.value) {
|
|
315
315
|
chapters = chapters.map((chapter) =>
|
|
316
316
|
chapter.id === command.chapterId
|
|
317
|
-
? { ...chapter, outputName: command.value
|
|
317
|
+
? { ...chapter, outputName: command.value!, status: 'review' }
|
|
318
318
|
: chapter,
|
|
319
319
|
)
|
|
320
320
|
handle.update()
|
|
@@ -1529,10 +1529,14 @@ function sortRanges(ranges: CutRange[]) {
|
|
|
1529
1529
|
function mergeOverlappingRanges(ranges: CutRange[]) {
|
|
1530
1530
|
if (ranges.length === 0) return []
|
|
1531
1531
|
const sorted = sortRanges(ranges)
|
|
1532
|
-
const
|
|
1532
|
+
const first = sorted[0]
|
|
1533
|
+
if (!first) return []
|
|
1534
|
+
const merged: CutRange[] = [{ ...first }]
|
|
1533
1535
|
for (let i = 1; i < sorted.length; i++) {
|
|
1534
1536
|
const current = sorted[i]
|
|
1537
|
+
if (!current) continue
|
|
1535
1538
|
const last = merged[merged.length - 1]
|
|
1539
|
+
if (!last) continue
|
|
1536
1540
|
if (current.start <= last.end) {
|
|
1537
1541
|
last.end = Math.max(last.end, current.end)
|
|
1538
1542
|
} else {
|
|
@@ -595,8 +595,14 @@ export function TrimPoints(handle: Handle) {
|
|
|
595
595
|
trimRanges = sortRanges(
|
|
596
596
|
trimRanges.map((range) => {
|
|
597
597
|
if (range.id !== rangeId) return range
|
|
598
|
-
let nextStart =
|
|
599
|
-
|
|
598
|
+
let nextStart =
|
|
599
|
+
typeof patch.start === 'number' && Number.isFinite(patch.start)
|
|
600
|
+
? patch.start
|
|
601
|
+
: range.start
|
|
602
|
+
let nextEnd =
|
|
603
|
+
typeof patch.end === 'number' && Number.isFinite(patch.end)
|
|
604
|
+
? patch.end
|
|
605
|
+
: range.end
|
|
600
606
|
if (edge === 'start') {
|
|
601
607
|
nextStart = clamp(
|
|
602
608
|
nextStart,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Handle } from 'remix/component'
|
|
2
1
|
import {
|
|
3
2
|
colors,
|
|
4
3
|
mq,
|
|
@@ -94,7 +93,7 @@ const swatchStyle = (color: string) => ({
|
|
|
94
93
|
boxShadow: `0 0 0 1px ${colors.border}`,
|
|
95
94
|
})
|
|
96
95
|
|
|
97
|
-
export function StyleSystemSample(
|
|
96
|
+
export function StyleSystemSample() {
|
|
98
97
|
return () => (
|
|
99
98
|
<section css={sectionStyle}>
|
|
100
99
|
<header css={headerStyle}>
|
package/app/trim-api.ts
CHANGED
|
@@ -60,6 +60,7 @@ function parseOutTimeValue(value: string) {
|
|
|
60
60
|
const parts = value.trim().split(':')
|
|
61
61
|
if (parts.length !== 3) return null
|
|
62
62
|
const [hours, minutes, seconds] = parts
|
|
63
|
+
if (!hours || !minutes || !seconds) return null
|
|
63
64
|
const h = Number.parseFloat(hours)
|
|
64
65
|
const m = Number.parseFloat(minutes)
|
|
65
66
|
const s = Number.parseFloat(seconds)
|
|
@@ -78,7 +79,11 @@ async function readLines(
|
|
|
78
79
|
onLine: (line: string) => void,
|
|
79
80
|
) {
|
|
80
81
|
if (!stream) return
|
|
81
|
-
const
|
|
82
|
+
const decoder = new TextDecoderStream()
|
|
83
|
+
const transformed = stream.pipeThrough(
|
|
84
|
+
decoder as unknown as ReadableWritablePair<string, Uint8Array>,
|
|
85
|
+
)
|
|
86
|
+
const reader = transformed.getReader()
|
|
82
87
|
let buffer = ''
|
|
83
88
|
while (true) {
|
|
84
89
|
const { value, done } = await reader.read()
|
package/app/video-api.ts
CHANGED
|
@@ -18,8 +18,8 @@ function isLocalhostOrigin(origin: string | null): boolean {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
function getVideoCorsHeaders(origin: string | null) {
|
|
22
|
-
if (!isLocalhostOrigin(origin)) {
|
|
21
|
+
function getVideoCorsHeaders(origin: string | null): Record<string, string> {
|
|
22
|
+
if (!isLocalhostOrigin(origin) || !origin) {
|
|
23
23
|
return {}
|
|
24
24
|
}
|
|
25
25
|
return {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eprec",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"test:e2e": "bun test ./e2e",
|
|
15
15
|
"test:smoke": "bunx playwright test -c playwright/playwright-smoke-config.ts",
|
|
16
16
|
"test:all": "bun test '**/*.test.ts'",
|
|
17
|
+
"typecheck": "bunx tsc --noEmit",
|
|
17
18
|
"validate": "bun run test"
|
|
18
19
|
},
|
|
19
20
|
"bin": {
|
package/process-course/cli.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import path from 'node:path'
|
|
3
|
-
import type { Argv, Arguments
|
|
3
|
+
import type { Argv, Arguments } from 'yargs'
|
|
4
4
|
import yargs from 'yargs/yargs'
|
|
5
5
|
import { hideBin } from 'yargs/helpers'
|
|
6
|
+
|
|
7
|
+
type CommandHandler = (argv: Arguments) => Promise<void>
|
|
6
8
|
import {
|
|
7
9
|
PromptCancelled,
|
|
8
10
|
createInquirerPrompter,
|
|
@@ -179,7 +181,7 @@ function resolvePaddingMs(value: unknown) {
|
|
|
179
181
|
}
|
|
180
182
|
|
|
181
183
|
export function createEditVideoHandler(options: CliUxOptions): CommandHandler {
|
|
182
|
-
return async (argv) => {
|
|
184
|
+
return async (argv: Arguments) => {
|
|
183
185
|
const args = await resolveEditVideoArgs(argv, options)
|
|
184
186
|
const progress = options.interactive
|
|
185
187
|
? createStepProgressReporter({ action: 'Editing video' })
|
|
@@ -216,7 +218,7 @@ export function createEditVideoHandler(options: CliUxOptions): CommandHandler {
|
|
|
216
218
|
export function createCombineVideosHandler(
|
|
217
219
|
options: CliUxOptions,
|
|
218
220
|
): CommandHandler {
|
|
219
|
-
return async (argv) => {
|
|
221
|
+
return async (argv: Arguments) => {
|
|
220
222
|
const args = await resolveCombineVideosArgs(argv, options)
|
|
221
223
|
const progress = options.interactive
|
|
222
224
|
? createStepProgressReporter({ action: 'Combining videos' })
|
|
@@ -253,6 +255,9 @@ export function createCombineVideosHandler(
|
|
|
253
255
|
if (!result.success) {
|
|
254
256
|
throw new Error(result.error ?? 'Combine failed.')
|
|
255
257
|
}
|
|
258
|
+
if (!result.outputPath) {
|
|
259
|
+
throw new Error('Combine completed but no output path returned.')
|
|
260
|
+
}
|
|
256
261
|
outputPath = result.outputPath
|
|
257
262
|
} finally {
|
|
258
263
|
setLogHooks({})
|
|
@@ -363,13 +368,13 @@ export async function runEditsCli(rawArgs = hideBin(process.argv)) {
|
|
|
363
368
|
.command(
|
|
364
369
|
'edit-video',
|
|
365
370
|
'Edit a single video using transcript text edits',
|
|
366
|
-
configureEditVideoCommand
|
|
371
|
+
configureEditVideoCommand,
|
|
367
372
|
createEditVideoHandler(handlerOptions),
|
|
368
373
|
)
|
|
369
374
|
.command(
|
|
370
375
|
'combine-videos',
|
|
371
376
|
'Combine two videos with speech-aligned padding',
|
|
372
|
-
configureCombineVideosCommand
|
|
377
|
+
configureCombineVideosCommand,
|
|
373
378
|
createCombineVideosHandler(handlerOptions),
|
|
374
379
|
)
|
|
375
380
|
.demandCommand(1)
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from './paths'
|
|
9
9
|
import { logInfo } from './logging'
|
|
10
10
|
import type {
|
|
11
|
-
Chapter,
|
|
12
11
|
JarvisWarning,
|
|
13
12
|
JarvisEdit,
|
|
14
13
|
JarvisNote,
|
|
@@ -162,8 +161,6 @@ export async function writeSummaryLogs(options: {
|
|
|
162
161
|
inputPath,
|
|
163
162
|
summary,
|
|
164
163
|
summaryDetails,
|
|
165
|
-
jarvisWarnings,
|
|
166
|
-
jarvisEdits,
|
|
167
164
|
editWorkspaces,
|
|
168
165
|
dryRun,
|
|
169
166
|
} = options
|
|
@@ -222,6 +222,7 @@ async function runTask(task: ProcessingTask) {
|
|
|
222
222
|
for (let index = 0; index < steps.length; index++) {
|
|
223
223
|
if (controller.signal.aborted) return
|
|
224
224
|
const label = steps[index]
|
|
225
|
+
if (!label) continue
|
|
225
226
|
updateTask(task.id, {
|
|
226
227
|
progress: buildProgress(index + 1, steps.length, label),
|
|
227
228
|
})
|
package/src/app-server.ts
CHANGED
|
@@ -231,11 +231,15 @@ export async function startAppServer(options: AppServerOptions = {}) {
|
|
|
231
231
|
process.env.EPREC_APP_VIDEO_PATH = options.videoPath.trim()
|
|
232
232
|
}
|
|
233
233
|
const env = getEnv()
|
|
234
|
-
const host = options.host ?? env.HOST
|
|
234
|
+
const host = options.host ?? env.HOST ?? 'localhost'
|
|
235
235
|
const desiredPort = options.port ?? env.PORT
|
|
236
236
|
const port = await getServerPort(env.NODE_ENV, desiredPort)
|
|
237
237
|
let server = startServer(port, host)
|
|
238
|
-
const getUrl = () =>
|
|
238
|
+
const getUrl = () => {
|
|
239
|
+
const serverHostname = server.hostname ?? host
|
|
240
|
+
const serverPort = server.port ?? port
|
|
241
|
+
return formatServerUrl(serverHostname, serverPort)
|
|
242
|
+
}
|
|
239
243
|
let cleanupInput = () => {}
|
|
240
244
|
let isRestarting = false
|
|
241
245
|
const stopServer = () => {
|
package/src/cli.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import path from 'node:path'
|
|
3
|
-
import type {
|
|
3
|
+
import type { Arguments } from 'yargs'
|
|
4
4
|
import yargs from 'yargs/yargs'
|
|
5
5
|
import { hideBin } from 'yargs/helpers'
|
|
6
6
|
import { startAppServer } from './app-server'
|
|
@@ -89,14 +89,14 @@ async function main(rawArgs = hideBin(process.argv)) {
|
|
|
89
89
|
.command(
|
|
90
90
|
'edit',
|
|
91
91
|
'Edit a single video using transcript text edits',
|
|
92
|
-
configureEditVideoCommand
|
|
93
|
-
createEditVideoHandler(handlerOptions)
|
|
92
|
+
configureEditVideoCommand,
|
|
93
|
+
createEditVideoHandler(handlerOptions),
|
|
94
94
|
)
|
|
95
95
|
.command(
|
|
96
96
|
'combine',
|
|
97
97
|
'Combine two videos with speech-aligned padding',
|
|
98
|
-
configureCombineVideosCommand
|
|
99
|
-
createCombineVideosHandler(handlerOptions)
|
|
98
|
+
configureCombineVideosCommand,
|
|
99
|
+
createCombineVideosHandler(handlerOptions),
|
|
100
100
|
)
|
|
101
101
|
.command(
|
|
102
102
|
'app start',
|