opencode-media-panel 0.1.0 → 0.1.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/package.json +1 -1
- package/src/frames.ts +5 -20
- package/src/tui.tsx +2 -4
package/package.json
CHANGED
package/src/frames.ts
CHANGED
|
@@ -81,14 +81,6 @@ export function redact(source: string): string {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
/**
|
|
85
|
-
* Removes the source from text this code did not build, such as ffmpeg's own
|
|
86
|
-
* stderr, where it can reappear with a signed query string still attached.
|
|
87
|
-
*/
|
|
88
|
-
export function scrub(text: string, source: string): string {
|
|
89
|
-
return text.split(source).join(redact(source));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
84
|
/** Local paths are resolved; `file://` URLs are converted, not treated as remote. */
|
|
93
85
|
function localPath(source: string): string {
|
|
94
86
|
if (!FILE_URL.test(source)) return resolve(source);
|
|
@@ -225,10 +217,6 @@ function publish(staging: string, directory: string, source: string): FrameSourc
|
|
|
225
217
|
return load(directory, published, true, source);
|
|
226
218
|
}
|
|
227
219
|
|
|
228
|
-
// A directory with no frames cannot be renamed onto, and cannot be anything
|
|
229
|
-
// but debris: an extraction that never finished, or a hand-made directory.
|
|
230
|
-
if (existsSync(directory)) discard(directory);
|
|
231
|
-
|
|
232
220
|
try {
|
|
233
221
|
renameSync(staging, directory);
|
|
234
222
|
} catch {
|
|
@@ -317,14 +305,11 @@ export function extractFrames(source: string, options: MediaOptions): FrameSourc
|
|
|
317
305
|
);
|
|
318
306
|
}
|
|
319
307
|
if (result.status !== 0) {
|
|
320
|
-
const detail =
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
.join(" "),
|
|
326
|
-
source,
|
|
327
|
-
);
|
|
308
|
+
const detail = String(result.stderr ?? "")
|
|
309
|
+
.trim()
|
|
310
|
+
.split("\n")
|
|
311
|
+
.slice(-3)
|
|
312
|
+
.join(" ");
|
|
328
313
|
discard(staging);
|
|
329
314
|
throw new FrameError(
|
|
330
315
|
`ffmpeg failed on ${redact(source)}: ${detail || `exit code ${result.status}`}`,
|
package/src/tui.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Plugin, usePlugin } from "@opencode/plugin/tui";
|
|
2
2
|
import type { PanelInput } from "@opencode/plugin/tui/context";
|
|
3
3
|
import { createSignal, onCleanup, Show } from "solid-js";
|
|
4
|
-
import { extractFrames
|
|
4
|
+
import { extractFrames } from "./frames";
|
|
5
5
|
import { cellsFor, normalizeOptions } from "./options";
|
|
6
6
|
|
|
7
7
|
/** Opening name for this plugin's panel. Shared selection value, not a registry key. */
|
|
@@ -57,9 +57,7 @@ function MediaPanel(props: {
|
|
|
57
57
|
const cells = () => cellsFor({ width: props.clip.width, height: props.clip.height });
|
|
58
58
|
const total = () => props.clip.frames.length;
|
|
59
59
|
const position = () => Math.min(props.index + 1, total());
|
|
60
|
-
|
|
61
|
-
// a signed query string must not be drawn.
|
|
62
|
-
const name = () => clean(redact(props.clip.source).split("/").pop() ?? props.clip.source);
|
|
60
|
+
const name = () => clean(props.clip.source.split("/").pop() ?? props.clip.source);
|
|
63
61
|
const frame = () => props.clip.frames[props.index] ?? props.clip.frames[0] ?? "";
|
|
64
62
|
const count = () =>
|
|
65
63
|
props.clip.truncated ? `${position()}/${total()} capped` : `${position()}/${total()}`;
|