Skip to content

A full-featured download manager.

feat(plugins): add manual audio and video merging (#2308)

Dr_rOot4bf3c7b3c6ae
diff --git a/docs/manual-media-merge.md b/docs/manual-media-merge.md
new file mode 100644
index 00000000..5fe5822e
--- /dev/null
+++ b/docs/manual-media-merge.md
@@ -0,0 +1,130 @@
+# Manual audio and video merging
+
+This feature requires a Motrix build containing the manual media merge interface
+and an enabled media merge plugin. Installing the plugin alone in an older build
+does not add the interface.
+
+The official plugin is `motrix.media-merge`, maintained in
+[builtin-plugins](https://github.com/motrixapp/builtin-plugins). It is installed
+separately and is not part of Motrix's default bundle. Its
+[directory listing](https://motrix.app/plugins/motrix.media-merge/) provides
+compatibility and package availability; a signed release is required for
+directory installation.
+
+Configure FFmpeg in **Settings → Integration → Media Tools**, then install the
+plugin's `.moext` package from the Plugins page. The plugin requests the `ffmpeg`
+permission. If you configure FFmpeg after activating the plugin, disable and
+re-enable the plugin to refresh its capability snapshot.
+
+There are two entry points:
+
+1. Select two completed, single-file downloads and choose **Merge audio and video**
+ in the task action menu. The window pre-fills their paths.
+2. Open the installed media merge plugin's **Operations** tab. Select a local
+ video, an audio file, and an output filename directly on the page.
+
+![Media merge Operations tab in the Web UI (Simplified Chinese)](../screenshots/motrix-media-merge-cn-light.png)
+
+The Operations tab and the task-menu dialog share the same form. Switching tabs
+keeps the selected files and progress. Returning to the page in the same window
+restores your draft and refreshes its recent merge status. After success,
+**Merge another file** keeps the inputs and clears the output for a new filename.
+These drafts are not saved across application restarts.
+
+In either entry point on desktop, drop one video and one audio file onto their
+cards, or click a card to open the existing file picker. Cards emphasize the
+filename; hover to see the full path. Choose **MP4** or **MKV** to update the output
+extension automatically. Choosing a format before a video also uses that format
+for the suggested filename. The format is retained with the draft. Confirm a
+save location and new filename, then click **Merge**. Audio-only MP4 files are supported. The supplied plugin
+inspects stream types and swaps the inputs when they are unambiguously reversed.
+If both files contain both types of tracks, the Video field supplies the first
+video track and the Audio field supplies the first audio track.
+
+The plugin copies the encoded tracks without re-encoding them. It does not join
+clips end to end, align recordings with different start times, or adjust audio
+sync. MP4 cannot carry every codec; try MKV if the MP4 merge fails.
+
+Select standalone media files: MP4/MOV, MKV/WebM, AVI, MPEG/TS, FLV, AAC, MP3,
+FLAC, Ogg or WAV. HLS/DASH playlists, concat scripts and image sequences are not
+supported, even when they reference local files. Motrix restricts the input
+demuxers before probing or merging, so references inside a selected file cannot
+implicitly authorize another file. Renaming a playlist does not make it a video.
+
+Original files remain in place. Existing output files are never overwritten,
+including files created while the merge is running. A temporary directory beside
+the destination is removed after success, failure, or cancellation. Publication
+uses an atomic, non-replacing hard link; the destination filesystem must support
+hard links. A failed publication preserves the original files and reports an
+error. Unexpected process termination may leave a `.motrix-merge-*` temporary
+directory; remove it only after confirming no merge is running.
+
+Only one manual merge runs per host. The window displays progress and provides
+**Cancel**; the operation has a one-hour limit. Jobs are not restored after an app
+restart. The merged file is saved to the selected destination, not added as a new
+download task.
+
+Both shells use the existing shared path picker. Desktop uses native file dialogs;
+the Web UI reuses the server directory browser, including navigation, favorites,
+hidden files and sorting. Select the input files, then choose the output folder and
+enter a new filename in the save dialog. Existing files cannot be overwritten.
+The browser operates on the Motrix server’s files; it does not upload local files.
+The server’s configured download-directory policy applies to browsing, input
+selection and output. Files are revalidated when selected and when merging.
+
+Open **Logs** from the top-right actions in the plugin detail page to inspect
+merge activity. The host records start, cancellation requests, completion,
+cancellation, and failure, with a job ID, filenames, output format, and elapsed
+time. Failures include the stage and reason, including file validation and final
+save failures. Completion is logged only after the output is successfully saved.
+Entries also go to the existing plugin log file on both desktop and Server.
+File fields show filenames by default; the log page's verbose mode retains full
+paths. Progress updates do not generate individual log entries.
+
+## Plugin command contract
+
+A feature introduced during beta must declare an explicit beta minimum in
+`engines.motrix`, using the first host version that contains the feature. For
+example, `>=2.0.0-beta.45` rejects beta.44, accepts beta.45 and later betas, and
+also accepts the final `2.0.0` release. Any range containing a prerelease uses
+full SemVer precedence. Release-only ranges retain the existing host API-line
+compatibility behavior, so `>=2.0.0 <3.0.0` continues to allow 2.0.0 beta hosts;
+use an explicit beta minimum when a plugin needs a newer beta capability.
+
+A plugin opts into this interface by requesting the required `ffmpeg` permission
+and declaring a public command named `<plugin-id>.mergeStreams` with both argument
+and result schemas. This convention uses the existing manifest schema; it does
+not introduce new manifest keywords or a general-purpose command console.
+
+The `.mergeStreams` command name is reserved for host-authorized manual jobs.
+Its `public` flag enables provider discovery; it does not permit cross-plugin
+execution. Both cross-plugin calls and generic command invocations are rejected
+before the plugin runs. Always use the manual merge interface.
+
+The host passes `{ videoInput, audioInput, output }`, all absolute paths. `output`
+is a host-owned temporary path with the user's chosen extension. The command
+returns `{ outputPath: output }` only after its FFmpeg operation succeeds.
+Relative top-level paths are rejected instead of being resolved against the
+process working directory. The host resolves symlinks before applying the
+server's directory policy. Relative references *inside* a playlist would normally
+resolve from the playlist's directory, but those inputs are rejected altogether;
+they do not inherit the selected file's authorization.
+
+```ts
+commands.register('example.media-merge.mergeStreams', async (args) => {
+ const operation = await ffmpeg.mergeStreams(args)
+ await operation.result
+ return { outputPath: args.output }
+})
+```
+
+Await the launch call as well as `operation.result`: the current QuickJS bridge
+returns the handle asynchronously. The host validates command arguments and
+results against the manifest, runs the command in the plugin's FIFO lane, and
+holds the job until its processes have stopped. During this invocation, FFmpeg
+can probe only the two selected input paths and launch one merge into the reserved
+output. Other FFmpeg operations and nested plugin commands are rejected. Input
+protocols and demuxers are restricted to standalone local media. Probe cancellation
+and timeouts terminate the child and wait for its exit before releasing the job.
+Progress and cancellation are
+owned by the host; the plugin does not need a polling loop.
diff --git a/docs/manual-media-merge.zh-CN.md b/docs/manual-media-merge.zh-CN.md
new file mode 100644
index 00000000..184fba36
--- /dev/null
+++ b/docs/manual-media-merge.zh-CN.md
@@ -0,0 +1,100 @@
+# 手动合并音频和视频
+
+此功能需要包含手动媒体合并界面的 Motrix 版本,以及已启用的音视频合并插件。
+仅在旧版本中安装插件,不会增加操作界面。
+
+官方插件 ID 为 `motrix.media-merge`,源码由
+[builtin-plugins](https://github.com/motrixapp/builtin-plugins) 维护。
+插件需要单独安装,不属于 Motrix 默认打包内容。
+[插件目录](https://motrix.app/zh/plugins/motrix.media-merge/)提供兼容版本和安装包状态;
+通过目录安装需要先发布正式签名包。
+
+先在 **设置 → 集成 → 媒体工具** 中配置 FFmpeg,再到插件页面安装插件的 `.moext`
+文件。插件需要 `ffmpeg` 权限。如果在插件启用后才配置 FFmpeg,请停用再启用插件,
+以刷新能力状态。
+
+支持两种入口:
+
+1. 选中两个已完成的单文件下载任务,在任务操作菜单中选择 **合并音频和视频**。
+ 窗口会预填两个文件的路径。
+2. 打开已安装的音视频合并插件详情,在 **操作** 页直接选择本地视频、音频文件
+ 及输出文件名。
+
+![Web UI 的音视频合并操作页(简体中文)](../screenshots/motrix-media-merge-cn-light.png)
+
+操作页和任务菜单弹窗共用一套表单。切换 Tab 会保留已选文件和进度;离开后返回页面
+会恢复当前窗口的草稿,并刷新最近一次合并状态。成功后点击 **再次合并**,会
+保留输入文件并清空输出位置,方便填写新文件名。草稿不会在应用重启后保留。
+
+在任一入口中,桌面端可拖入一个视频和一个音频文件,也可点击卡片打开文件选择器。
+卡片显示文件名,悬停可查看完整路径。选择 **MP4** 或 **MKV** 后,输出文件的扩展名
+会同步更新;先选格式再选视频时,也会自动建议对应格式的文件名。格式选择随草稿保留。
+确认保存位置和新文件名后点击 **合并**。
+支持仅含音轨的 MP4 文件。配套插件会检查媒体轨道,在输入顺序明确反转时自动交换。
+如果两个文件都包含音轨和视频轨,则使用“视频文件”的第一条视频轨,以及“音频文件”
+的第一条音轨。
+
+插件直接复制编码后的媒体轨道,不重新编码。此功能不进行片段首尾拼接,也不校准
+起始时间不同的录制文件或调整音画同步。MP4 无法容纳所有编码;合并失败时可尝试 MKV。
+
+请选择独立的媒体文件:MP4/MOV、MKV/WebM、AVI、MPEG/TS、FLV、AAC、MP3、FLAC、
+Ogg 或 WAV。不支持 HLS/DASH 播放列表、concat 脚本或图片序列,即使它们引用的也是
+本地文件。宿主在探测和合并前限制输入解析器,避免选中文件内部的引用间接获得其他
+文件的读取权限。修改播放列表的后缀不会使它成为可合并的视频文件。
+
+源文件始终保留。不会覆盖已有输出文件,包括合并期间新出现的同名文件。输出先写入
+目标目录旁的临时目录,在成功、失败或取消后清理。最终保存使用原子且不覆盖的硬链接,
+因此目标文件系统需要支持硬链接。保存失败会保留源文件并显示错误。进程意外终止时
+可能留下 `.motrix-merge-*` 临时目录,确认没有合并操作正在运行后才可删除。
+
+每个宿主同时运行一个手动合并任务。窗口提供进度和 **取消** 操作,执行时限为一小时。
+应用重启后不会恢复合并任务。合并文件会保存到指定位置,不会作为新的下载任务加入列表。
+
+两端复用现有的路径选择组件。桌面端打开原生文件对话框;Web UI 复用服务器目录浏览器,
+保留导航、收藏、隐藏文件和排序功能。选择输入文件后,在保存对话框中选择输出文件夹,
+填写新文件名;已有文件不会被覆盖。浏览器操作的是 Motrix 服务器上的文件,不会上传本机文件。
+服务器下载目录策略同样约束浏览、输入选择和输出;选择文件和开始合并时都会重新验证路径。
+
+合并日志可从插件详情页右上角的 **日志** 按钮查看。宿主记录开始、取消请求、
+完成、取消和失败,并附带任务编号、文件名、输出格式和耗时。失败日志还包含
+处理阶段与原因;文件检查和最终保存失败也会记录。只有输出成功保存后才会记录完成。
+这些记录同时写入现有插件日志文件,桌面端和 Server 行为一致。默认仅记录文件名;
+日志页的详细模式可保留完整路径。进度更新不会逐条写入日志。
+
+## 插件命令约定
+
+测试版期间新增的能力,应在 `engines.motrix` 中明确声明首次包含该能力的 beta
+版本。例如,`>=2.0.0-beta.45` 会拒绝 beta.44,接受 beta.45 及后续 beta,也接受
+`2.0.0` 正式版。范围中只要包含测试版编号,就会按完整 SemVer 优先级比较。
+仅含正式版本号的范围保留现有的宿主 API 版本兼容规则,因此 `>=2.0.0 <3.0.0`
+仍允许 2.0.0 beta 宿主;插件依赖较新 beta 的能力时,应明确写出最低 beta 版本。
+
+插件通过申请必需的 `ffmpeg` 权限,并声明名为 `<plugin-id>.mergeStreams` 的公开命令
+来接入此界面。命令需同时声明参数和结果 schema。拖拽和格式选择属于宿主界面能力。此约定复用现有 manifest schema,
+不新增 manifest 字段,也不提供通用命令控制台。
+
+`.mergeStreams` 命令名保留给宿主授权的手动合并任务。`public` 标记用于发现提供此功能的
+插件,不允许其他插件借此执行合并。跨插件调用和通用命令调用都会在插件执行前被拒绝,
+请始终通过手动合并界面调用。
+
+宿主传入 `{ videoInput, audioInput, output }`,三个字段均为绝对路径。`output` 是宿主
+分配的临时路径,扩展名与用户选择一致。命令应在 FFmpeg 操作成功后返回
+`{ outputPath: output }`。
+顶层相对路径会被拒绝,不会按照进程工作目录补全。宿主先解析符号链接,再应用服务器
+目录策略。播放列表内部的相对引用通常以播放列表所在目录为基准,但此类输入整体不受
+支持,不会继承选中文件的授权。
+
+```ts
+commands.register('example.media-merge.mergeStreams', async (args) => {
+ const operation = await ffmpeg.mergeStreams(args)
+ await operation.result
+ return { outputPath: args.output }
+})
+```
+
+启动调用和 `operation.result` 都需要等待:当前 QuickJS 桥接会异步返回操作句柄。
+宿主根据 manifest 验证命令参数和结果,在插件的 FIFO 队列中运行命令,并等待相关进程
+停止后才结束任务。在此次调用中,FFmpeg 只能探测选中的两个路径,并向预留的输出路径
+启动一次合并。其他 FFmpeg 操作和嵌套插件命令会被拒绝,输入协议和解析器限定为独立的
+本地媒体文件。探测被取消或超时时,会终止子进程,并等待进程退出后才释放任务。
+进度和取消由宿主管理,插件不需要自行轮询。
diff --git a/screenshots/motrix-media-merge-cn-light.png b/screenshots/motrix-media-merge-cn-light.png
new file mode 100644
index 00000000..0df6ea91
Binary files /dev/null and b/screenshots/motrix-media-merge-cn-light.png differ
diff --git a/src/core/plugin/capabilities/ffmpeg.local-inputs.test.ts b/src/core/plugin/capabilities/ffmpeg.local-inputs.test.ts
new file mode 100644
index 00000000..15bbbd84
--- /dev/null
+++ b/src/core/plugin/capabilities/ffmpeg.local-inputs.test.ts
@@ -0,0 +1,178 @@
+// @vitest-environment node
+import { execFileSync } from 'node:child_process'
+import { existsSync } from 'node:fs'
+import {
+ mkdir,
+ mkdtemp,
+ readFile,
+ rm,
+ symlink,
+ writeFile,
+} from 'node:fs/promises'
+import { tmpdir } from 'node:os'
+import path from 'node:path'
+import { afterAll, beforeAll, describe, expect, it } from 'vitest'
+import { FfmpegCapabilityHost } from './ffmpeg'
+
+// Real demuxers are essential here: argv-only mocks cannot show whether an
+// input opens another file before a post-probe check gets a chance to run.
+describe.skipIf(!process.env.MOTRIX_TEST_FFMPEG)(
+ 'standalone local media inputs',
+ () => {
+ const binaryPath = process.env.MOTRIX_TEST_FFMPEG as string
+ const host = new FfmpegCapabilityHost({
+ detect: { available: true, binaryPath },
+ })
+ const demuxers = binaryPath
+ ? execFileSync(binaryPath, ['-hide_banner', '-demuxers'], {
+ encoding: 'utf8',
+ })
+ : ''
+ let dir: string
+ let video: string
+ let audio: string
+ let allowed: string
+ let privateDir: string
+ const run = (...args: string[]) =>
+ execFileSync(binaryPath, ['-loglevel', 'error', ...args], {
+ timeout: 15_000,
+ })
+
+ beforeAll(async () => {
+ dir = await mkdtemp(path.join(tmpdir(), 'ffmpeg-local-inputs-'))
+ allowed = path.join(dir, 'allowed')
+ privateDir = path.join(dir, 'private')
+ await mkdir(allowed)
+ await mkdir(privateDir)
+ video = path.join(allowed, 'video.mp4')
+ audio = path.join(allowed, 'audio.m4a')
+ run(
+ '-f',
+ 'lavfi',
+ '-i',
+ 'color=c=blue:s=32x32:r=5',
+ '-t',
+ '1',
+ '-an',
+ '-c:v',
+ 'libx264',
+ video
+ )
+ run(
+ '-f',
+ 'lavfi',
+ '-i',
+ 'sine=frequency=440',
+ '-t',
+ '1',
+ '-c:a',
+ 'aac',
+ audio
+ )
+ run(
+ '-i',
+ video,
+ '-c',
+ 'copy',
+ '-f',
+ 'mpegts',
+ path.join(privateDir, 'not-selected.ts')
+ )
+ run(
+ '-i',
+ video,
+ '-c',
+ 'copy',
+ '-f',
+ 'dash',
+ path.join(privateDir, 'manifest.mpd')
+ )
+ const dash = await readFile(path.join(privateDir, 'manifest.mpd'), 'utf8')
+ await writeFile(
+ path.join(allowed, 'download.mpd'),
+ dash.replace(/(<Period[^>]*>)/, '$1<BaseURL>../private/</BaseURL>')
+ )
+ await symlink(
+ path.join(privateDir, 'not-selected.ts'),
+ path.join(allowed, 'linked.ts')
+ )
+ for (const [name, target] of [
+ ['relative', '../private/not-selected.ts'],
+ ['absolute', path.join(privateDir, 'not-selected.ts')],
+ ['symlink', 'linked.ts'],
+ ]) {
+ await writeFile(
+ path.join(allowed, `${name}.m3u8`),
+ `#EXTM3U\n#EXT-X-VERSION:3\n#EXT-X-TARGETDURATION:1\n#EXT-X-MEDIA-SEQUENCE:0\n#EXTINF:1.0,\n${target}\n#EXT-X-ENDLIST\n`
+ )
+ }
+ // Valid concat input disguised as MP4; basename filtering is insufficient.
+ await writeFile(
+ path.join(allowed, 'disguised.mp4'),
+ "ffconcat version 1.0\nfile 'linked.ts'\n"
+ )
+ })
+
+ afterAll(async () => {
+ await rm(dir, { recursive: true, force: true })
+ })
+
+ it.each([
+ 'relative.m3u8',
+ 'absolute.m3u8',
+ 'symlink.m3u8',
+ ...(/^ D\s+dash\s/m.test(demuxers) ? ['download.mpd'] : []),
+ 'disguised.mp4',
+ ])(
+ 'rejects indirect input %s during both probe and merge',
+ async (name) => {
+ const input = path.join(allowed, name)
+ // Prove the fixture actually exposes video without the manual policy.
+ expect(
+ (await host.probe({ path: input })).streams.some(
+ (s) => s.type === 'video'
+ )
+ ).toBe(true)
+ expect(
+ (await host.probe({ path: input, localOnly: true })).streams
+ ).toEqual([])
+ for (const videoRole of [true, false]) {
+ const output = path.join(allowed, `${name}-${videoRole}.mkv`)
+ await expect(
+ host.mergeStreams({
+ videoInput: videoRole ? input : video,
+ audioInput: videoRole ? audio : input,
+ output,
+ localOnly: true,
+ }).result
+ ).rejects.toMatchObject({ code: 'plugin.ffmpeg.exit_nonzero' })
+ expect(existsSync(output)).toBe(false)
+ }
+ }
+ )
+
+ it.each(['mp4', 'mkv'])(
+ 'still merges standalone media into %s',
+ async (extension) => {
+ const output = path.join(allowed, `normal.${extension}`)
+ expect(
+ (await host.probe({ path: video, localOnly: true })).streams[0].type
+ ).toBe('video')
+ expect(
+ (await host.probe({ path: audio, localOnly: true })).streams[0].type
+ ).toBe('audio')
+ await host.mergeStreams({
+ videoInput: video,
+ audioInput: audio,
+ output,
+ localOnly: true,
+ }).result
+ expect(
+ (await host.probe({ path: output, localOnly: true })).streams.map(
+ (s) => s.type
+ )
+ ).toEqual(['video', 'audio'])
+ }
+ )
+ }
+)
diff --git a/src/core/plugin/capabilities/ffmpeg.test.ts b/src/core/plugin/capabilities/ffmpeg.test.ts
index 18731261..31f912be 100644
--- a/src/core/plugin/capabilities/ffmpeg.test.ts
+++ b/src/core/plugin/capabilities/ffmpeg.test.ts
@@ -177,6 +177,61 @@ describe('FfmpegCapabilityHost — probe', () => {
spawnMock = vi.fn().mockReturnValue(proc)
})
+ afterEach(() => vi.useRealTimers())
+
+ it.each(['cancel', 'timeout'] as const)(
+ 'waits for probe close after %s and escalates to SIGKILL',
+ async (cause) => {
+ vi.useFakeTimers()
+ const controller = new AbortController()
+ const host = new FfmpegCapabilityHost({
+ detect: AVAILABLE_DETECT,
+ spawnFn:
+ spawnMock as unknown as typeof import('node:child_process').spawn,
+ })
+ const result = host.probe({
+ path: '/in.mp4',
+ signal: controller.signal,
+ localOnly: true,
+ })
+ let settled = false
+ const observed = result.catch((error: unknown) => {
+ settled = true
+ return error
+ })
+ if (cause === 'cancel') controller.abort()
+ else await vi.advanceTimersByTimeAsync(30_000)
+ expect(proc.kill).toHaveBeenCalledWith('SIGTERM')
+ await vi.advanceTimersByTimeAsync(5_000)
+ expect(proc.kill).toHaveBeenCalledWith('SIGKILL')
+ expect(settled).toBe(false)
+ proc._close(null)
+ expect(await observed).toMatchObject({
+ code:
+ cause === 'cancel'
+ ? 'plugin.ffmpeg.aborted'
+ : 'plugin.ffmpeg.probe_timeout',
+ })
+ expect(vi.getTimerCount()).toBe(0)
+ }
+ )
+
+ it('does not launch an already-cancelled probe', async () => {
+ const host = new FfmpegCapabilityHost({
+ detect: AVAILABLE_DETECT,
+ spawnFn:
+ spawnMock as unknown as typeof import('node:child_process').spawn,
+ })
+ await expect(
+ host.probe({
+ path: '/in.mp4',
+ signal: AbortSignal.abort(),
+ localOnly: true,
+ })
+ ).rejects.toThrow()
+ expect(spawnMock).not.toHaveBeenCalled()
+ })
+
it('header-only probe (no -f null full decode) parses metadata', async () => {
const host = new FfmpegCapabilityHost({
detect: AVAILABLE_DETECT,
@@ -204,6 +259,25 @@ describe('FfmpegCapabilityHost — probe', () => {
expect(info.format).toBe('mov')
expect(info.streams[0]).toEqual({ type: 'video', codec: 'h264' })
})
+
+ it('restricts local probing before opening the input', async () => {
+ const host = new FfmpegCapabilityHost({
+ detect: AVAILABLE_DETECT,
+ spawnFn:
+ spawnMock as unknown as typeof import('node:child_process').spawn,
+ })
+ const pending = host.probe({ path: '/playlist.m3u8', localOnly: true })
+ const argv = spawnMock.mock.calls[0][1] as string[]
+ expect(argv.slice(0, argv.indexOf('-i'))).toEqual([
+ '-nostdin',
+ '-protocol_whitelist',
+ 'file',
+ '-format_whitelist',
+ 'mov,matroska,webm,avi,mpegts,mpegvideo,mpeg,aac,mp3,flac,ogg,wav,flv',
+ ])
+ proc._close(1)
+ await pending
+ })
})
// ---------------------------------------------------------------------------
@@ -611,10 +685,15 @@ describe('FfmpegCapabilityHost — helpers', () => {
expect(spawnMock).toHaveBeenCalledWith(
'/usr/bin/ffmpeg',
[
+ '-nostdin',
'-i',
'/v.mp4',
'-i',
'/a.mp3',
+ '-map',
+ '0:v:0',
+ '-map',
+ '1:a:0',
'-c:v',
'copy',
'-c:a',
@@ -626,6 +705,26 @@ describe('FfmpegCapabilityHost — helpers', () => {
)
})
+ it('mergeStreams: constrains both local inputs independently', async () => {
+ const operation = host.mergeStreams({
+ videoInput: '/v.mp4',
+ audioInput: '/a.mp3',
+ output: '/out.mp4',
+ localOnly: true,
+ })
+ const argv = spawnMock.mock.calls[0][1] as string[]
+ const firstInput = argv.indexOf('-i')
+ const secondInput = argv.indexOf('-i', firstInput + 1)
+ const inputOptions = argv.slice(1, firstInput)
+ expect(argv.slice(firstInput + 2, secondInput)).toEqual(inputOptions)
+ expect(inputOptions).toContain('-format_whitelist')
+ expect(inputOptions[inputOptions.indexOf('-protocol_whitelist') + 1]).toBe(
+ 'file'
+ )
+ proc._close(0)
+ await operation.result
+ })
+
it('generateThumbnail: has -ss and -frames:v 1', () => {
host.generateThumbnail({ input: '/in.mp4', output: '/thumb.jpg' })
proc._close(0)
diff --git a/src/core/plugin/capabilities/ffmpeg.ts b/src/core/plugin/capabilities/ffmpeg.ts
index 1bcea357..d91238c1 100644
--- a/src/core/plugin/capabilities/ffmpeg.ts
+++ b/src/core/plugin/capabilities/ffmpeg.ts
@@ -33,6 +33,19 @@ import { spawn } from 'node:child_process'
import { randomUUID } from 'node:crypto'
import type { FfmpegDetection } from './ffmpeg-detect'
+// Manual merges accept standalone media, never playlists or demuxers that
+// discover other files. A file-only protocol allowlist alone still lets HLS,
+// DASH, concat and image sequences read paths the user never selected.
+// MOV external data references keep FFmpeg's disabled default; this API does
+// not accept demuxer options that could enable them. Apply this policy
+// before opening *each* input, for both probing and merging.
+const LOCAL_MEDIA_INPUT_OPTIONS = [
+ '-protocol_whitelist',
+ 'file',
+ '-format_whitelist',
+ 'mov,matroska,webm,avi,mpegts,mpegvideo,mpeg,aac,mp3,flac,ogg,wav,flv',
+]
+
// ---------------------------------------------------------------------------
// Error class
// ---------------------------------------------------------------------------
@@ -297,11 +310,12 @@ export class FfmpegCapabilityHost {
// -----------------------------------------------------------------------
let aborted = false
+ let settled = false
let killTimer: ReturnType<typeof setTimeout> | undefined
let timeoutTimer: ReturnType<typeof setTimeout>
const abort = (): void => {
- if (aborted) return
+ if (aborted || settled) return
aborted = true
clearTimeout(timeoutTimer)
try {
@@ -368,8 +382,8 @@ export class FfmpegCapabilityHost {
let stderrBuf = ''
proc.stderr?.on('data', (chunk: Buffer) => {
stderrBuf += chunk.toString()
- const lines = stderrBuf.split('\n')
- stderrBuf = lines.pop() ?? ''
+ const lines = stderrBuf.split(/[\r\n]/)
+ stderrBuf = (lines.pop() ?? '').slice(-8192)
for (const line of lines) {
const p = parseProgress(line, expectedDurationMs)
if (p !== null) emitProgress(p)
@@ -382,6 +396,8 @@ export class FfmpegCapabilityHost {
const result = new Promise<{ outputPath: string }>((resolve, reject) => {
proc.on('error', (err: Error) => {
+ settled = true
+ opts.signal?.removeEventListener('abort', abort)
clearTimeout(timeoutTimer)
clearTimeout(killTimer)
clearTimeout(keepAliveTimer)
@@ -395,12 +411,21 @@ export class FfmpegCapabilityHost {
})
proc.on('close', (code: number | null) => {
+ settled = true
+ opts.signal?.removeEventListener('abort', abort)
clearTimeout(timeoutTimer)
clearTimeout(killTimer)
clearTimeout(keepAliveTimer)
queue.close()
- if (code === 0) {
+ if (aborted) {
+ reject(
+ new FfmpegError(
+ 'plugin.ffmpeg.aborted',
+ 'FFmpeg operation cancelled'
+ )
+ )
+ } else if (code === 0) {
resolve({ outputPath: resolvedOutputPath })
} else {
reject(
@@ -420,7 +445,11 @@ export class FfmpegCapabilityHost {
// probe
// -------------------------------------------------------------------------
- probe(input: { path: string }): Promise<MediaInfo> {
+ probe(input: {
+ path: string
+ signal?: AbortSignal
+ localOnly?: boolean
+ }): Promise<MediaInfo> {
if (!this.detect.available || !this.detect.binaryPath) {
return Promise.reject(
new FfmpegError('plugin.capability.unavailable', 'ffmpeg not available')
@@ -448,17 +477,47 @@ export class FfmpegCapabilityHost {
// `-f null -`: that forces a full decode of the entire file (minutes for
// a multi-GB video, tripping the 30s timeout) yet produces nothing this
// parser reads — duration/format/streams all come from the header block.
- const proc = this.spawnFn(binaryPath, ['-i', input.path], {
- stdio: ['ignore', 'pipe', 'pipe'],
- })
+ input.signal?.throwIfAborted()
+ const proc = this.spawnFn(
+ binaryPath,
+ [
+ ...(input.localOnly
+ ? ['-nostdin', ...LOCAL_MEDIA_INPUT_OPTIONS]
+ : []),
+ '-i',
+ input.path,
+ ],
+ {
+ stdio: ['ignore', 'pipe', 'pipe'],
+ }
+ )
- const timer = setTimeout(() => {
+ let closed = false
+ let failure: FfmpegError | undefined
+ let killTimer: ReturnType<typeof setTimeout> | undefined
+ const stop = (error: FfmpegError) => {
+ if (closed || failure) return
+ failure = error
+ clearTimeout(timer)
try {
proc.kill('SIGTERM')
} catch {
- // ignore
+ // The child may already have exited; still wait for close.
}
- reject(
+ killTimer = setTimeout(() => {
+ try {
+ proc.kill('SIGKILL')
+ } catch {
+ // The child may already have exited.
+ }
+ }, SIGKILL_GRACE_MS)
+ }
+ const abort = () =>
+ stop(
+ new FfmpegError('plugin.ffmpeg.aborted', 'FFmpeg operation cancelled')
+ )
+ const timer = setTimeout(() => {
+ stop(
new FfmpegError(
'plugin.ffmpeg.probe_timeout',
'ffmpeg probe timed out'
@@ -479,17 +538,23 @@ export class FfmpegCapabilityHost {
})
proc.on('error', (err: Error) => {
- clearTimeout(timer)
- reject(
- new FfmpegError(
- 'plugin.ffmpeg.spawn_error',
- `ffmpeg spawn error: ${err.message}`
- )
+ // ChildProcess emits close after error, including spawn failure.
+ // Settling here would release the manual job while the child is alive.
+ failure ??= new FfmpegError(
+ 'plugin.ffmpeg.spawn_error',
+ `ffmpeg spawn error: ${err.message}`
)
})
proc.on('close', () => {
+ closed = true
clearTimeout(timer)
+ clearTimeout(killTimer)
+ input.signal?.removeEventListener('abort', abort)
+ if (failure) {
+ reject(failure)
+ return
+ }
// ffmpeg -i ... -f null - exits 1 for probe; we ignore the code.
const durationMatch = DURATION_RE.exec(stderrCapture)
const durationMs = durationMatch
@@ -518,6 +583,8 @@ export class FfmpegCapabilityHost {
resolve({ durationMs, format, streams })
})
+ input.signal?.addEventListener('abort', abort, { once: true })
+ if (input.signal?.aborted) abort()
})
}
@@ -598,14 +665,24 @@ export class FfmpegCapabilityHost {
videoInput: string
audioInput: string
output: string
+ expectedDurationMs?: number
+ localOnly?: boolean
timeoutMs?: number
signal?: AbortSignal
}): FfmpegOpHandle<{ outputPath: string }> {
+ const inputOptions = opts.localOnly ? LOCAL_MEDIA_INPUT_OPTIONS : []
const argv = [
+ '-nostdin',
+ ...inputOptions,
'-i',
opts.videoInput,
+ ...inputOptions,
'-i',
opts.audioInput,
+ '-map',
+ '0:v:0',
+ '-map',
+ '1:a:0',
'-c:v',
'copy',
'-c:a',
@@ -618,6 +695,7 @@ export class FfmpegCapabilityHost {
outputPath: opts.output,
timeoutMs: opts.timeoutMs,
signal: opts.signal,
+ expectedDurationMs: opts.expectedDurationMs,
})
}
diff --git a/src/core/plugin/commands/cross-plugin-invoker.ts b/src/core/plugin/commands/cross-plugin-invoker.ts
index de2ae078..a15c4a51 100644
--- a/src/core/plugin/commands/cross-plugin-invoker.ts
+++ b/src/core/plugin/commands/cross-plugin-invoker.ts
@@ -10,6 +10,7 @@
// and never reaches this invoker. We do not re-check that invariant here.
import { AppError, ErrorCode } from '@shared/errors'
+import { MEDIA_MERGE_COMMAND } from '@shared/schemas/manual-media-merge'
import type { CrossPluginInvoker } from '../capabilities/commands'
import {
currentPluginCallChain,
@@ -203,6 +204,12 @@ export class FullCrossPluginInvoker implements CrossPluginInvoker {
auditFail('plugin.command.not_public')
}
+ // Public is used for provider discovery, not permission to borrow the
+ // callee's FFmpeg access. Only the host can authorize a selected-file job.
+ if (commandId === `${calleePluginId}.${MEDIA_MERGE_COMMAND}`) {
+ auditFail('plugin.command.access_denied')
+ }
+
// 5d. caller_throttled
if (this.throttle.isBlocked(callerId)) {
auditFail('plugin.command.caller_throttled')
diff --git a/src/core/plugin/commands/integration.test.ts b/src/core/plugin/commands/integration.test.ts
index 794f8d94..5d4f35d9 100644
--- a/src/core/plugin/commands/integration.test.ts
+++ b/src/core/plugin/commands/integration.test.ts
@@ -236,6 +236,36 @@ describe('FullCrossPluginInvoker', () => {
await rm(tmp, { recursive: true, force: true })
})
+ it('rejects a declared public merger without activating the callee', async () => {
+ const commandId = 'motrix.media-merge.mergeStreams'
+ const registry = makeRegistry([
+ { id: 'test.caller', invokesCommands: [commandId] },
+ { id: 'motrix.media-merge', publicCommands: [{ id: commandId }] },
+ ])
+ let invoked = false
+ const host = makeHost({
+ activate: async () => {
+ invoked = true
+ },
+ invokeCommand: async () => {
+ invoked = true
+ },
+ })
+ const h = buildHarness({ registry, host, auditFile })
+ await expect(
+ h.invoker.execute('test.caller', commandId, {
+ videoInput: '/video.mp4',
+ audioInput: '/audio.m4a',
+ output: '/existing.mp4',
+ })
+ ).rejects.toThrow('plugin.command.access_denied')
+ expect(invoked).toBe(false)
+ await h.audit.drain()
+ expect(await readAuditEntries(auditFile)).toEqual([
+ expect.objectContaining({ errorCode: 'plugin.command.access_denied' }),
+ ])
+ })
+
it('rejects an A -> B -> A call cycle before the second enqueue', async () => {
const registry = makeRegistry([
{
diff --git a/src/core/plugin/commands/manual-media-merge.test.ts b/src/core/plugin/commands/manual-media-merge.test.ts
new file mode 100644
index 00000000..58065b97
--- /dev/null
+++ b/src/core/plugin/commands/manual-media-merge.test.ts
@@ -0,0 +1,444 @@
+// @vitest-environment node
+import {
+ link,
+ mkdir,
+ mkdtemp,
+ readdir,
+ readFile,
+ realpath,
+ rm,
+ symlink,
+ writeFile,
+} from 'node:fs/promises'
+import { tmpdir } from 'node:os'
+import path from 'node:path'
+import type { MediaMergeArgs } from '@shared/schemas/manual-media-merge'
+import { TaskStatus } from '@shared/types/task'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import type { TaskManager } from '../../task/task-manager'
+import { LogCapabilityHost } from '../capabilities/log'
+import type { ManualMergeContext } from '../host/capability-bridge'
+import type { PluginHost } from '../host/plugin-host'
+import type { PluginRegistry } from '../plugin-registry'
+import { ManualMediaMerge } from './manual-media-merge'
+
+const pluginId = 'test.merger'
+const command = {
+ id: `${pluginId}.mergeStreams`,
+ public: true,
+ argsSchema: {
+ type: 'object',
+ required: ['videoInput', 'audioInput', 'output'],
+ properties: {
+ videoInput: { type: 'string' },
+ audioInput: { type: 'string' },
+ output: { type: 'string' },
+ },
+ },
+ resultSchema: {
+ type: 'object',
+ required: ['outputPath'],
+ properties: { outputPath: { type: 'string' } },
+ },
+}
+
+describe('manual media merge', () => {
+ let dir: string
+ let args: MediaMergeArgs & { pluginId: string }
+ let service: ManualMediaMerge
+ let invoke: ReturnType<typeof vi.fn>
+ let enabled: boolean
+ let completion: Promise<unknown>
+ let tasks: Map<string, unknown>
+ let logDir: string
+ let logs: LogCapabilityHost
+ let createLog: ReturnType<typeof vi.fn<LogCapabilityHost['create']>>
+ beforeEach(async () => {
+ dir = await realpath(await mkdtemp(path.join(tmpdir(), 'manual-merge-')))
+ logDir = await mkdtemp(path.join(tmpdir(), 'manual-merge-logs-'))
+ logs = new LogCapabilityHost({ pluginLogsDir: logDir })
+ createLog = vi.fn((id: string) => logs.create(id))
+ args = {
+ pluginId,
+ videoInput: path.join(dir, 'video.mp4'),
+ audioInput: path.join(dir, 'audio.mp4'),
+ output: path.join(dir, 'merged.mp4'),
+ }
+ await Promise.all([
+ writeFile(args.videoInput, 'video'),
+ writeFile(args.audioInput, 'audio'),
+ ])
+ enabled = true
+ tasks = new Map()
+ invoke = vi.fn(
+ async (
+ _plugin: string,
+ _command: string,
+ values: MediaMergeArgs,
+ options: { mediaMerge: ManualMergeContext }
+ ) => {
+ options.mediaMerge.onProgress({ percent: 50, speed: '2x', timeMs: 500 })
+ await writeFile(values.output, 'video+audio')
+ return { outputPath: values.output }
+ }
+ )
+ service = new ManualMediaMerge({
+ createLog,
+ registry: {
+ list: () => [{ id: pluginId, name: 'Merger', enabled }],
+ get: (id: string) =>
+ id === pluginId
+ ? {
+ state: { enabled },
+ manifest: {
+ permissions: ['ffmpeg'],
+ contributes: { commands: [command] },
+ },
+ }
+ : undefined,
+ } as unknown as PluginRegistry,
+ host: {
+ activate: vi.fn(),
+ invokeCommand: invoke,
+ } as unknown as PluginHost,
+ tasks: {
+ getById: (id: string) => tasks.get(id),
+ } as unknown as TaskManager,
+ runWork: (work) => {
+ const result = work()
+ completion = result
+ return result
+ },
+ })
+ })
+ afterEach(async () => {
+ await logs.flush()
+ await rm(dir, { recursive: true, force: true })
+ await rm(logDir, { recursive: true, force: true })
+ })
+
+ it('publishes the finished output without changing either source', async () => {
+ const job = await service.start(args)
+ await completion
+ expect(service.get(job.id)).toMatchObject({
+ status: 'completed',
+ percent: 100,
+ output: args.output,
+ })
+ expect(await readFile(args.output, 'utf8')).toBe('video+audio')
+ expect(await readFile(args.videoInput, 'utf8')).toBe('video')
+ expect(await readFile(args.audioInput, 'utf8')).toBe('audio')
+ expect(
+ (await readdir(dir)).some((name) => name.startsWith('.motrix-merge-'))
+ ).toBe(false)
+ expect(service.state().job).toBeNull()
+ const entries = logs.getTail(pluginId, 100)
+ expect(entries.map((entry) => entry.event)).toEqual([
+ 'media-merge.started',
+ 'media-merge.completed',
+ ])
+ expect(entries[1]).toMatchObject({
+ level: 'info',
+ jobId: job.id,
+ stage: 'saving',
+ format: 'mp4',
+ durationMs: expect.any(Number),
+ files: {
+ video: { path: 'video.mp4' },
+ audio: { path: 'audio.mp4' },
+ output: { path: 'merged.mp4' },
+ },
+ })
+ expect(JSON.stringify(entries)).not.toContain(dir)
+ expect(JSON.stringify(entries)).not.toContain('.motrix-merge-')
+ await logs.flush()
+ const written = (
+ await readFile(path.join(logDir, pluginId, 'logs/current.ndjson'), 'utf8')
+ )
+ .trim()
+ .split('\n')
+ .map((line) => JSON.parse(line))
+ expect(written.map((entry) => entry.event)).toEqual(
+ entries.map((entry) => entry.event)
+ )
+ expect(logs.getTail('other.plugin', 100)).toEqual([])
+ })
+
+ it('refuses to overwrite existing outputs or inputs', async () => {
+ await writeFile(args.output, 'existing')
+ await expect(service.start(args)).rejects.toThrow('mediaMerge.outputExists')
+ await expect(
+ service.start({ ...args, output: args.videoInput })
+ ).rejects.toThrow('mediaMerge.outputExists')
+ expect(await readFile(args.output, 'utf8')).toBe('existing')
+ expect(invoke).not.toHaveBeenCalled()
+ })
+
+ it('does not overwrite a file created during the merge', async () => {
+ invoke.mockImplementation(async (_p, _c, values: MediaMergeArgs) => {
+ await writeFile(values.output, 'merged')
+ await writeFile(args.output, 'racing writer')
+ return { outputPath: values.output }
+ })
+ const job = await service.start(args)
+ await completion
+ expect(service.get(job.id).status).toBe('failed')
+ expect(await readFile(args.output, 'utf8')).toBe('racing writer')
+ expect(await readdir(dir)).toHaveLength(3)
+ expect(logs.getTail(pluginId, 1)[0]).toMatchObject({
+ event: 'media-merge.failed',
+ level: 'error',
+ stage: 'saving',
+ errorCode: 'EEXIST',
+ jobId: job.id,
+ })
+ expect(
+ logs
+ .getTail(pluginId, 100)
+ .some((entry) => entry.event === 'media-merge.completed')
+ ).toBe(false)
+ expect(JSON.stringify(logs.getTail(pluginId, 100))).not.toContain(dir)
+ })
+
+ it('cleans temporary data when the plugin fails', async () => {
+ invoke.mockImplementation(async (_p, _c, values: MediaMergeArgs) => {
+ await writeFile(values.output, 'partial')
+ throw new Error('unsupported codec')
+ })
+ const job = await service.start(args)
+ await completion
+ expect(service.get(job.id)).toMatchObject({
+ status: 'failed',
+ error: 'unsupported codec',
+ })
+ expect(logs.getTail(pluginId, 1)[0]).toMatchObject({
+ event: 'media-merge.failed',
+ level: 'error',
+ stage: 'running',
+ reason: 'unsupported codec',
+ jobId: job.id,
+ })
+ expect((await readdir(dir)).sort()).toEqual(['audio.mp4', 'video.mp4'])
+ })
+
+ it('cancels a running operation and blocks concurrent starts until drained', async () => {
+ invoke.mockImplementation(
+ async (
+ _p,
+ _c,
+ _values,
+ { mediaMerge }: { mediaMerge: ManualMergeContext }
+ ) => {
+ await new Promise<void>((resolve) =>
+ mediaMerge.signal.addEventListener('abort', () => resolve(), {
+ once: true,
+ })
+ )
+ throw new Error('aborted')
+ }
+ )
+ const job = await service.start(args)
+ await vi.waitFor(() => expect(invoke).toHaveBeenCalled())
+ await expect(service.start(args)).rejects.toThrow('mediaMerge.busy')
+ expect(service.cancel(job.id).status).toBe('cancelling')
+ service.cancel(job.id)
+ await completion
+ expect(service.get(job.id).status).toBe('cancelled')
+ expect(logs.getTail(pluginId, 100).map((entry) => entry.event)).toEqual([
+ 'media-merge.started',
+ 'media-merge.rejected',
+ 'media-merge.cancel-requested',
+ 'media-merge.cancelled',
+ ])
+ expect(logs.getTail(pluginId, 1)[0]).toMatchObject({
+ level: 'info',
+ jobId: job.id,
+ })
+ expect((await readdir(dir)).sort()).toEqual(['audio.mp4', 'video.mp4'])
+ })
+
+ it('only offers enabled plugins with the public merger command', async () => {
+ expect(service.providers()).toEqual([{ pluginId, title: 'Merger' }])
+ enabled = false
+ expect(service.providers()).toEqual([])
+ await expect(service.start(args)).rejects.toThrow(
+ 'mediaMerge.pluginUnavailable'
+ )
+ })
+
+ it('rejects missing, identical, relative, empty or unsupported inputs/outputs', async () => {
+ await expect(
+ service.start({ ...args, audioInput: args.videoInput })
+ ).rejects.toThrow('mediaMerge.sameInput')
+ await expect(
+ service.start({ ...args, videoInput: 'relative.mp4' })
+ ).rejects.toThrow('mediaMerge.absolutePaths')
+ await expect(
+ service.start({ ...args, output: path.join(dir, 'out.txt') })
+ ).rejects.toThrow('mediaMerge.outputFormat')
+ await writeFile(args.audioInput, '')
+ await expect(service.start(args)).rejects.toThrow('mediaMerge.invalidFiles')
+ expect(invoke).not.toHaveBeenCalled()
+ })
+
+ it.each(['videoInput', 'audioInput', 'output'] as const)(
+ 'rejects relative %s instead of resolving it against the process cwd',
+ async (field) => {
+ await expect(
+ service.start({ ...args, [field]: '../file.mp4' })
+ ).rejects.toThrow('mediaMerge.absolutePaths')
+ expect(invoke).not.toHaveBeenCalled()
+ }
+ )
+
+ it('rejects hard-linked inputs and dangling output symlinks', async () => {
+ await rm(args.audioInput)
+ await link(args.videoInput, args.audioInput)
+ await expect(service.start(args)).rejects.toThrow('mediaMerge.sameInput')
+ await rm(args.audioInput)
+ await writeFile(args.audioInput, 'audio')
+ await symlink(path.join(dir, 'missing.mp4'), args.output)
+ await expect(service.start(args)).rejects.toThrow('mediaMerge.outputExists')
+ expect(invoke).not.toHaveBeenCalled()
+ })
+
+ it('authorizes canonical inputs and output directories, not symlink spellings', async () => {
+ const allowed = path.join(dir, 'allowed')
+ await mkdir(allowed)
+ const videoLink = path.join(allowed, 'video.mp4')
+ const outputLink = path.join(allowed, 'out')
+ await symlink(args.videoInput, videoLink)
+ await symlink(dir, outputLink, 'junction')
+ const authorizePath = vi.fn(async (file: string) => {
+ if (!file.startsWith(`${allowed}${path.sep}`))
+ throw new Error('outside allowed directory')
+ })
+ // Retain all other dependencies so rejection exercises the normal start path.
+ const authorized = new ManualMediaMerge({
+ createLog,
+ registry: {
+ list: () => [{ id: pluginId, name: 'Merger', enabled: true }],
+ get: () => ({
+ state: { enabled: true },
+ manifest: {
+ permissions: ['ffmpeg'],
+ contributes: { commands: [command] },
+ },
+ }),
+ } as unknown as PluginRegistry,
+ host: {
+ activate: vi.fn(),
+ invokeCommand: invoke,
+ } as unknown as PluginHost,
+ tasks: {} as TaskManager,
+ authorizePath,
+ })
+ await expect(
+ authorized.start({ ...args, videoInput: videoLink })
+ ).rejects.toThrow('outside allowed directory')
+ expect(authorizePath).toHaveBeenCalledWith(args.videoInput)
+ const safeVideo = path.join(allowed, 'safe.mp4')
+ const safeAudio = path.join(allowed, 'safe.m4a')
+ await writeFile(safeVideo, 'video')
+ await writeFile(safeAudio, 'audio')
+ await expect(
+ authorized.start({
+ ...args,
+ videoInput: safeVideo,
+ audioInput: safeAudio,
+ output: path.join(outputLink, 'new.mp4'),
+ })
+ ).rejects.toThrow('outside allowed directory')
+ expect(authorizePath).toHaveBeenCalledWith(path.join(dir, 'new.mp4'))
+ expect(invoke).not.toHaveBeenCalled()
+ })
+
+ it('accepts two complete single-file downloads and rejects other selections', () => {
+ tasks.set('v', {
+ status: TaskStatus.Completed,
+ fileCount: 1,
+ finalPath: args.videoInput,
+ })
+ tasks.set('a', {
+ status: TaskStatus.Completed,
+ fileCount: 1,
+ finalPath: args.audioInput,
+ })
+ expect(service.selection(['v', 'a'])).toMatchObject({
+ videoInput: args.videoInput,
+ audioInput: args.audioInput,
+ })
+ expect(() => service.selection(['v', 'v'])).toThrow(
+ 'mediaMerge.invalidSelection'
+ )
+ tasks.set('a', {
+ status: TaskStatus.Downloading,
+ finalPath: args.audioInput,
+ })
+ expect(() => service.selection(['v', 'a'])).toThrow(
+ 'mediaMerge.invalidSelection'
+ )
+ })
+ it('logs a preparation failure without starting a job or leaking its missing path', async () => {
+ const missing = path.join(dir, 'missing.mp4')
+ await expect(
+ service.start({ ...args, videoInput: missing })
+ ).rejects.toThrow('ENOENT')
+ const entries = logs.getTail(pluginId, 100)
+ expect(entries).toHaveLength(1)
+ expect(entries[0]).toMatchObject({
+ event: 'media-merge.failed',
+ stage: 'preparing',
+ errorCode: 'ENOENT',
+ reason: expect.stringContaining('missing.mp4'),
+ })
+ expect(JSON.stringify(entries)).not.toContain(dir)
+ expect(invoke).not.toHaveBeenCalled()
+ expect(service.state().job).toBeNull()
+ })
+
+ it('does not create a log destination for an unknown plugin ID', async () => {
+ await expect(
+ service.start({ ...args, pluginId: '../../elsewhere' })
+ ).rejects.toThrow('mediaMerge.pluginUnavailable')
+ expect(createLog).not.toHaveBeenCalled()
+ })
+
+ it('keeps successful output and cleanup independent of logging failures', async () => {
+ createLog.mockImplementation(() => {
+ throw new Error('log unavailable')
+ })
+ const job = await service.start(args)
+ await completion
+ expect(service.get(job.id).status).toBe('completed')
+ expect(await readFile(args.output, 'utf8')).toBe('video+audio')
+ expect((await readdir(dir)).sort()).toEqual([
+ 'audio.mp4',
+ 'merged.mp4',
+ 'video.mp4',
+ ])
+ expect(service.state().job).toBeNull()
+ })
+
+ it('keeps explicit verbose paths and delivers log events to existing subscribers', async () => {
+ logs.setVerbose(pluginId, true)
+ const received = vi.fn()
+ const unsubscribe = logs.subscribe(received)
+ const job = await service.start(args)
+ await completion
+ expect(received).toHaveBeenCalledTimes(2)
+ expect(received).toHaveBeenLastCalledWith(
+ pluginId,
+ expect.objectContaining({
+ event: 'media-merge.completed',
+ jobId: job.id,
+ files: {
+ video: { path: args.videoInput },
+ audio: { path: args.audioInput },
+ output: { path: args.output },
+ },
+ })
+ )
+ unsubscribe()
+ })
+})
diff --git a/src/core/plugin/commands/manual-media-merge.ts b/src/core/plugin/commands/manual-media-merge.ts
new file mode 100644
index 00000000..56c36612
--- /dev/null
+++ b/src/core/plugin/commands/manual-media-merge.ts
@@ -0,0 +1,351 @@
+import { randomUUID } from 'node:crypto'
+import { link, lstat, mkdtemp, realpath, rm, stat } from 'node:fs/promises'
+import path from 'node:path'
+import { AppError, ErrorCode } from '@shared/errors'
+import {
+ MEDIA_MERGE_COMMAND,
+ type MediaMergeJob,
+ type MediaMergeProvider,
+ mediaMergeJobIdSchema,
+ mediaMergeSelectionSchema,
+ mediaMergeStartSchema,
+} from '@shared/schemas/manual-media-merge'
+import { TaskStatus } from '@shared/types/task'
+import type { TaskManager } from '../../task/task-manager'
+import type { PluginLogCapability } from '../capabilities/interface'
+import type { PluginHost } from '../host/plugin-host'
+import type { PluginRegistry } from '../plugin-registry'
+import { SchemaCache } from './schema-cache'
+
+interface Dependencies {
+ registry: PluginRegistry
+ host: PluginHost
+ tasks: TaskManager
+ createLog: (pluginId: string) => PluginLogCapability
+ authorizePath?: (file: string) => Promise<unknown>
+ /** Keep shutdown aware of the background operation. */
+ runWork?: <T>(work: () => Promise<T>) => Promise<T>
+}
+
+function fail(reason: string): never {
+ throw new AppError(ErrorCode.PluginRuntimeFault, `mediaMerge.${reason}`)
+}
+
+/** One bounded job per host; files are published only after the plugin succeeds. */
+export class ManualMediaMerge {
+ private jobs = new Map<string, MediaMergeJob>()
+ private active: { id: string; abort: AbortController } | undefined
+
+ constructor(private readonly deps: Dependencies) {}
+
+ private log(
+ pluginId: string,
+ level: 'info' | 'warn' | 'error',
+ message: string,
+ fields: Record<string, unknown>
+ ): void {
+ try {
+ this.deps.createLog(pluginId)[level](message, fields)
+ } catch {
+ // Log destinations must not change a merge result or prevent cleanup.
+ }
+ }
+
+ state() {
+ return {
+ providers: this.providers(),
+ job: this.active ? (this.jobs.get(this.active.id) ?? null) : null,
+ }
+ }
+
+ providers(): MediaMergeProvider[] {
+ return this.deps.registry.list().flatMap((entry) => {
+ const plugin = this.deps.registry.get(entry.id)
+ const command = plugin?.manifest.contributes.commands?.find(
+ (cmd) => cmd.id === `${entry.id}.${MEDIA_MERGE_COMMAND}` && cmd.public
+ )
+ return entry.enabled &&
+ command &&
+ plugin?.manifest.permissions.includes('ffmpeg')
+ ? [{ pluginId: entry.id, title: entry.name }]
+ : []
+ })
+ }
+
+ selection(value: unknown): {
+ videoInput: string
+ audioInput: string
+ output: string
+ } {
+ const ids = mediaMergeSelectionSchema.parse(value)
+ if (ids[0] === ids[1]) fail('invalidSelection')
+ const files = ids.map((id) => {
+ const task = this.deps.tasks.getById(id)
+ if (
+ !task ||
+ task.status !== TaskStatus.Completed ||
+ task.fileCount > 1 ||
+ !task.finalPath
+ )
+ fail('invalidSelection')
+ return task.finalPath
+ })
+ const videoInput = files[0]
+ const audioInput = files[1]
+ return {
+ videoInput,
+ audioInput,
+ output: path.join(
+ path.dirname(videoInput),
+ `${path.parse(videoInput).name}-merged.mp4`
+ ),
+ }
+ }
+
+ get(value: unknown): MediaMergeJob {
+ const job = this.jobs.get(mediaMergeJobIdSchema.parse(value))
+ if (!job) fail('jobMissing')
+ return { ...job }
+ }
+
+ cancel(value: unknown): MediaMergeJob {
+ const job = this.get(value)
+ if (this.active?.id === job.id && job.status === 'running') {
+ const stored = this.jobs.get(job.id)
+ if (stored) stored.status = 'cancelling'
+ this.log(job.pluginId, 'info', 'Media merge cancellation requested', {
+ event: 'media-merge.cancel-requested',
+ jobId: job.id,
+ })
+ this.active.abort.abort()
+ }
+ return this.get(job.id)
+ }
+
+ async start(value: unknown): Promise<MediaMergeJob> {
+ const request = mediaMergeStartSchema.parse(value)
+ const reject = (reason: string): never => {
+ // Never open a log destination for an unrecognized renderer-supplied ID.
+ if (this.deps.registry.get(request.pluginId))
+ this.log(request.pluginId, 'warn', 'Media merge could not start', {
+ event: 'media-merge.rejected',
+ reason: `mediaMerge.${reason}`,
+ })
+ return fail(reason)
+ }
+ if (this.active) reject('busy')
+ if (!this.providers().some((p) => p.pluginId === request.pluginId))
+ reject('pluginUnavailable')
+ const id = randomUUID()
+ const abort = new AbortController()
+ this.active = { id, abort }
+ let staging: string | undefined
+ const startedAt = performance.now()
+ let stage = 'preparing'
+ let terminalLogged = false
+ const files = {
+ video: { path: request.videoInput },
+ audio: { path: request.audioInput },
+ output: { path: request.output },
+ }
+ const failureDetails = (error: unknown) => {
+ let reason = error instanceof Error ? error.message : String(error)
+ // Keep file locations in structured path fields, where the existing
+ // plugin logger applies its normal/verbose path policy. OS errors can
+ // also embed the input or staging paths in their free-form message.
+ const locations = [
+ request.videoInput,
+ request.audioInput,
+ request.output,
+ ...Object.values(files).map((file) => file.path),
+ ...(staging ? [staging] : []),
+ ]
+ const paths = [
+ ...new Set(locations.flatMap((file) => [file, path.dirname(file)])),
+ ]
+ .filter(
+ (file) => path.isAbsolute(file) && file !== path.parse(file).root
+ )
+ .sort((a, b) => b.length - a.length)
+ for (const file of paths)
+ reason = reason.replaceAll(file, path.basename(file))
+ return {
+ reason,
+ ...(error &&
+ typeof error === 'object' &&
+ 'code' in error &&
+ typeof error.code === 'string'
+ ? { errorCode: error.code }
+ : {}),
+ }
+ }
+ const finishLog = (
+ status: 'completed' | 'cancelled' | 'failed',
+ error?: unknown
+ ) => {
+ if (terminalLogged) return
+ terminalLogged = true
+ this.log(
+ request.pluginId,
+ status === 'failed' ? 'error' : 'info',
+ `Media merge ${status}`,
+ {
+ event: `media-merge.${status}`,
+ jobId: id,
+ stage,
+ format: path.extname(files.output.path).slice(1).toLowerCase(),
+ files,
+ durationMs: Math.round(performance.now() - startedAt),
+ ...(error !== undefined && status === 'failed'
+ ? failureDetails(error)
+ : {}),
+ }
+ )
+ }
+ try {
+ if (
+ ![request.videoInput, request.audioInput, request.output].every(
+ path.isAbsolute
+ )
+ )
+ fail('absolutePaths')
+ const [videoInput, audioInput] = await Promise.all([
+ realpath(request.videoInput),
+ realpath(request.audioInput),
+ ])
+ files.video.path = videoInput
+ files.audio.path = audioInput
+ await this.deps.authorizePath?.(videoInput)
+ await this.deps.authorizePath?.(audioInput)
+ const [videoStat, audioStat] = await Promise.all([
+ stat(videoInput),
+ stat(audioInput),
+ ])
+ if (
+ !videoStat.isFile() ||
+ !audioStat.isFile() ||
+ !videoStat.size ||
+ !audioStat.size
+ )
+ fail('invalidFiles')
+ if (
+ videoInput === audioInput ||
+ (videoStat.dev === audioStat.dev && videoStat.ino === audioStat.ino)
+ )
+ fail('sameInput')
+ const outputDir = await realpath(path.dirname(request.output))
+ const output = path.join(outputDir, path.basename(request.output))
+ files.output.path = output
+ await this.deps.authorizePath?.(output)
+ if (!/\.(mp4|mkv)$/i.test(output)) fail('outputFormat')
+ try {
+ await lstat(output)
+ fail('outputExists')
+ } catch (error) {
+ if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error
+ }
+ staging = await mkdtemp(path.join(outputDir, '.motrix-merge-'))
+ const stagedOutput = path.join(staging, path.basename(output))
+ const job: MediaMergeJob = {
+ id,
+ pluginId: request.pluginId,
+ status: 'running',
+ percent: null,
+ output,
+ }
+ // Keep a bounded history so navigation/reconnect can retrieve recent results.
+ while (this.jobs.size >= 20)
+ this.jobs.delete(this.jobs.keys().next().value as string)
+ this.jobs.set(id, job)
+ this.log(request.pluginId, 'info', 'Media merge started', {
+ event: 'media-merge.started',
+ jobId: id,
+ files,
+ format: path.extname(output).slice(1).toLowerCase(),
+ })
+ const directory = staging
+ const work = async () => {
+ try {
+ stage = 'running'
+ const plugin = this.deps.registry.get(request.pluginId)
+ if (!plugin?.state.enabled) fail('pluginUnavailable')
+ const commandId = `${request.pluginId}.${MEDIA_MERGE_COMMAND}`
+ const schemas = new SchemaCache()
+ schemas.installCommandSchemas(
+ request.pluginId,
+ plugin.manifest.contributes.commands ?? []
+ )
+ const args = { videoInput, audioInput, output: stagedOutput }
+ schemas.validateArgs(request.pluginId, commandId, args)
+ await this.deps.host.activate(request.pluginId)
+ abort.signal.throwIfAborted()
+ const result = await this.deps.host.invokeCommand(
+ request.pluginId,
+ commandId,
+ args,
+ {
+ mediaMerge: {
+ ...args,
+ signal: abort.signal,
+ onProgress: (progress) => {
+ job.percent = Math.min(99, Math.max(0, progress.percent))
+ },
+ },
+ }
+ )
+ stage = 'saving'
+ schemas.validateResult(request.pluginId, commandId, result)
+ abort.signal.throwIfAborted()
+ if (
+ !(await lstat(stagedOutput)).isFile() ||
+ !(await stat(stagedOutput)).size
+ )
+ fail('invalidOutput')
+ // Same-filesystem hard-link publication is atomic and never replaces an
+ // existing file, including one created while FFmpeg was running.
+ await link(stagedOutput, output)
+ job.status = 'completed'
+ job.percent = 100
+ finishLog('completed')
+ } catch (error) {
+ job.status = abort.signal.aborted ? 'cancelled' : 'failed'
+ if (job.status === 'failed')
+ job.error = error instanceof Error ? error.message : String(error)
+ finishLog(job.status, error)
+ } finally {
+ await rm(directory, { recursive: true, force: true }).catch(
+ (error: unknown) => {
+ this.log(
+ request.pluginId,
+ 'warn',
+ 'Media merge temporary files could not be removed',
+ {
+ event: 'media-merge.cleanup-failed',
+ jobId: id,
+ ...failureDetails(error),
+ }
+ )
+ }
+ )
+ this.active = undefined
+ }
+ }
+ const running = this.deps.runWork ? this.deps.runWork(work) : work()
+ void running.catch((error: unknown) => {
+ job.status = 'failed'
+ job.error = error instanceof Error ? error.message : String(error)
+ finishLog('failed', error)
+ this.active = undefined
+ })
+ return { ...job }
+ } catch (error) {
+ finishLog('failed', error)
+ if (staging)
+ await rm(staging, { recursive: true, force: true }).catch(
+ () => undefined
+ )
+ this.active = undefined
+ throw error
+ }
+ }
+}
diff --git a/src/core/plugin/host/bridge-protocol.ts b/src/core/plugin/host/bridge-protocol.ts
index 0ceb26ad..f3fd02c6 100644
--- a/src/core/plugin/host/bridge-protocol.ts
+++ b/src/core/plugin/host/bridge-protocol.ts
@@ -40,6 +40,7 @@ export interface BridgeInitMessage {
pluginId: string
manifest: PluginManifest
bundleSource: string // raw text of dist/plugin.js
+ ffmpeg?: { available: boolean; version?: string }
app: {
version: string
platform: 'darwin' | 'win32' | 'linux'
diff --git a/src/core/plugin/host/capability-bridge.manual-merge.test.ts b/src/core/plugin/host/capability-bridge.manual-merge.test.ts
new file mode 100644
index 00000000..02a7d331
--- /dev/null
+++ b/src/core/plugin/host/capability-bridge.manual-merge.test.ts
@@ -0,0 +1,381 @@
+// @vitest-environment node
+import { execFileSync } from 'node:child_process'
+import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
+import { tmpdir } from 'node:os'
+import path from 'node:path'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import {
+ FfmpegCapabilityHost,
+ type FfmpegOpHandle,
+} from '../capabilities/ffmpeg'
+import type { CapabilityBridge, ManualMergeContext } from './capability-bridge'
+import { makeStubCapabilityHost, spawnTestBridge } from './test-helpers'
+
+const id = 'test.manual-merge'
+const commandId = `${id}.mergeStreams`
+const bundle = `import { commands, ffmpeg } from 'motrix:plugin-api';
+commands.register('${commandId}', async (args) => {
+ if (!ffmpeg.available) throw new Error('ffmpeg unavailable');
+ if (args.probe) return await ffmpeg.probe({path: args.probe});
+ if (args.transcode) return await (await ffmpeg.transcode({input: args.videoInput, output: args.output})).result;
+ if (args.parallel) {
+ const launches = await Promise.allSettled([ffmpeg.mergeStreams(args), ffmpeg.mergeStreams(args)]);
+ for (const launch of launches) if (launch.status === 'fulfilled') await launch.value.result;
+ return launches.map((launch) => launch.status);
+ }
+ await ffmpeg.probe({path: args.videoInput});
+ await (await ffmpeg.mergeStreams(args)).result;
+ return {outputPath: args.output};
+});`
+
+describe('manual merge through the real QuickJS worker', () => {
+ let dir: string
+ let bridge: CapabilityBridge | undefined
+ let controller: AbortController
+ let context: ManualMergeContext
+ beforeEach(async () => {
+ dir = await mkdtemp(path.join(tmpdir(), 'merge-guest-'))
+ controller = new AbortController()
+ context = {
+ videoInput: path.join(dir, 'video.mp4'),
+ audioInput: path.join(dir, 'audio.m4a'),
+ output: path.join(dir, 'merged.mp4'),
+ signal: controller.signal,
+ onProgress: vi.fn(),
+ }
+ await writeFile(
+ path.join(dir, 'motrix-plugin.json'),
+ JSON.stringify({
+ manifestVersion: 1,
+ id,
+ name: 'Merger',
+ version: '1.0.0',
+ description: '',
+ categories: ['post-action'],
+ engines: { motrix: '*' },
+ main: 'plugin.js',
+ permissions: ['ffmpeg'],
+ activationEvents: [`onCommand:${commandId}`],
+ contributes: { commands: [{ id: commandId, title: 'Merge' }] },
+ })
+ )
+ await writeFile(path.join(dir, 'plugin.js'), bundle)
+ })
+ afterEach(async () => {
+ await bridge?.dispose()
+ await rm(dir, { recursive: true, force: true })
+ })
+
+ async function start(ffmpeg: FfmpegCapabilityHost) {
+ const host = makeStubCapabilityHost()
+ host.ffmpeg = ffmpeg
+ const spawned = await spawnTestBridge(dir, { capabilityHost: host })
+ expect(spawned.errorCode).toBeUndefined()
+ bridge = spawned.bridge
+ return bridge
+ }
+ const fake = () => ({
+ available: true,
+ probe: vi.fn(async () => ({
+ streams: [{ type: 'video' }],
+ durationMs: 1000,
+ })),
+ mergeStreams: vi.fn(
+ (): FfmpegOpHandle<{ outputPath: string }> => ({
+ id: 'operation',
+ result: Promise.resolve({ outputPath: '/output' }),
+ abort: vi.fn(),
+ progress: {
+ async *[Symbol.asyncIterator]() {
+ yield { percent: 50, timeMs: 500, speed: '1x' }
+ },
+ },
+ })
+ ),
+ })
+
+ it('forwards selected inputs, staging output, duration and progress', async () => {
+ const ffmpeg = fake()
+ const guest = await start(ffmpeg as unknown as FfmpegCapabilityHost)
+ const args = {
+ videoInput: context.videoInput,
+ audioInput: context.audioInput,
+ output: context.output,
+ expectedDurationMs: 1000,
+ }
+ await expect(
+ guest.callMediaMerge(commandId, args, context)
+ ).resolves.toEqual({ outputPath: context.output })
+ expect(ffmpeg.mergeStreams).toHaveBeenCalledWith(
+ expect.objectContaining({
+ ...args,
+ localOnly: true,
+ signal: controller.signal,
+ })
+ )
+ expect(context.onProgress).toHaveBeenCalledWith(
+ expect.objectContaining({ percent: 50 })
+ )
+ })
+
+ it('rejects generic invocation of the merger before probing or writing', async () => {
+ const ffmpeg = fake()
+ const guest = await start(ffmpeg as unknown as FfmpegCapabilityHost)
+ await expect(
+ guest.callPlugin(commandId, {
+ videoInput: context.videoInput,
+ audioInput: context.audioInput,
+ output: context.output,
+ })
+ ).rejects.toMatchObject({ code: 'plugin.command.access_denied' })
+ expect(ffmpeg.probe).not.toHaveBeenCalled()
+ expect(ffmpeg.mergeStreams).not.toHaveBeenCalled()
+ })
+
+ it('admits only one launch even when the command attempts two concurrently', async () => {
+ const ffmpeg = fake()
+ const guest = await start(ffmpeg as unknown as FfmpegCapabilityHost)
+ await expect(
+ guest.callMediaMerge(
+ commandId,
+ {
+ videoInput: context.videoInput,
+ audioInput: context.audioInput,
+ output: context.output,
+ parallel: true,
+ },
+ context
+ )
+ ).resolves.toEqual(['fulfilled', 'rejected'])
+ expect(ffmpeg.mergeStreams).toHaveBeenCalledTimes(1)
+ })
+
+ it('drains a cancelled probe and rejects late capability calls', async () => {
+ const ffmpeg = fake()
+ let finishProbe: (() => void) | undefined
+ ffmpeg.probe.mockImplementation(
+ () =>
+ new Promise((resolve) => {
+ finishProbe = () =>
+ resolve({ streams: [{ type: 'video' }], durationMs: 1000 })
+ })
+ )
+ const guest = await start(ffmpeg as unknown as FfmpegCapabilityHost)
+ let settled = false
+ const result = guest
+ .callMediaMerge(
+ commandId,
+ {
+ videoInput: context.videoInput,
+ audioInput: context.audioInput,
+ output: context.output,
+ },
+ context
+ )
+ .catch((error: unknown) => {
+ settled = true
+ return error
+ })
+ await vi.waitFor(() => expect(ffmpeg.probe).toHaveBeenCalled())
+ controller.abort()
+ await new Promise<void>((resolve) => setImmediate(resolve))
+ expect(settled).toBe(false)
+ finishProbe?.()
+ expect(await result).toMatchObject({ message: 'mediaMerge.cancelled' })
+ await new Promise<void>((resolve) => setImmediate(resolve))
+ expect(ffmpeg.mergeStreams).not.toHaveBeenCalled()
+ expect(guest.operationState().ffmpegOperations).toBe(0)
+ })
+
+ it.each(['input', 'output', 'probe', 'transcode'])(
+ 'rejects an unauthorized %s before spawning',
+ async (kind) => {
+ const ffmpeg = fake()
+ const guest = await start(ffmpeg as unknown as FfmpegCapabilityHost)
+ const args: Record<string, unknown> = {
+ videoInput: context.videoInput,
+ audioInput: context.audioInput,
+ output: context.output,
+ }
+ if (kind === 'input') args.videoInput = '/unselected.mp4'
+ if (kind === 'output') args.output = '/unselected-output.mp4'
+ if (kind === 'probe') args.probe = '/unselected.mp4'
+ if (kind === 'transcode') args.transcode = true
+ await expect(
+ guest.callMediaMerge(commandId, args, context)
+ ).rejects.toThrow()
+ expect(ffmpeg.mergeStreams).not.toHaveBeenCalled()
+ }
+ )
+
+ it('aborts and drains the process before releasing a cancelled invocation', async () => {
+ const ffmpeg = fake()
+ const aborted = vi.fn()
+ let rejectResult: (error: Error) => void = () => {}
+ ffmpeg.mergeStreams.mockImplementation(() => ({
+ id: 'pending',
+ result: new Promise((_resolve, reject) => {
+ rejectResult = reject
+ }),
+ abort: () => {
+ aborted()
+ rejectResult(new Error('cancelled'))
+ },
+ progress: { async *[Symbol.asyncIterator]() {} },
+ }))
+ const guest = await start(ffmpeg as unknown as FfmpegCapabilityHost)
+ const result = guest.callMediaMerge(
+ commandId,
+ {
+ videoInput: context.videoInput,
+ audioInput: context.audioInput,
+ output: context.output,
+ },
+ context
+ )
+ const rejected = expect(result).rejects.toThrow('mediaMerge.cancelled')
+ await vi.waitFor(() => expect(ffmpeg.mergeStreams).toHaveBeenCalled())
+ controller.abort()
+ await rejected
+ expect(aborted).toHaveBeenCalled()
+ expect(guest.operationState().ffmpegOperations).toBe(0)
+ })
+
+ it.skipIf(!process.env.MOTRIX_TEST_FFMPEG)(
+ 'combines real video and audio tracks with FFmpeg',
+ async () => {
+ const binaryPath = process.env.MOTRIX_TEST_FFMPEG as string
+ execFileSync(binaryPath, [
+ '-loglevel',
+ 'error',
+ '-f',
+ 'lavfi',
+ '-i',
+ 'color=c=blue:s=32x32:r=5',
+ '-t',
+ '1',
+ '-an',
+ '-c:v',
+ 'libx264',
+ context.videoInput,
+ ])
+ execFileSync(binaryPath, [
+ '-loglevel',
+ 'error',
+ '-f',
+ 'lavfi',
+ '-i',
+ 'sine=frequency=440:sample_rate=44100',
+ '-t',
+ '1',
+ '-c:a',
+ 'aac',
+ context.audioInput,
+ ])
+ const originalVideo = await readFile(context.videoInput)
+ const originalAudio = await readFile(context.audioInput)
+ const ffmpeg = new FfmpegCapabilityHost({
+ detect: { available: true, binaryPath },
+ })
+ const guest = await start(ffmpeg)
+ await guest.callMediaMerge(
+ commandId,
+ {
+ videoInput: context.videoInput,
+ audioInput: context.audioInput,
+ output: context.output,
+ },
+ context
+ )
+ const info = await ffmpeg.probe({ path: context.output })
+ expect(info.streams.map((stream) => stream.type)).toEqual([
+ 'video',
+ 'audio',
+ ])
+ expect(info.streams.map((stream) => stream.codec)).toEqual([
+ 'h264',
+ 'aac',
+ ])
+ expect(await readFile(context.videoInput)).toEqual(originalVideo)
+ expect(await readFile(context.audioInput)).toEqual(originalAudio)
+ }
+ )
+})
+
+it.skipIf(
+ !process.env.MOTRIX_TEST_FFMPEG || !process.env.MOTRIX_TEST_MEDIA_MERGE_PLUGIN
+)(
+ 'runs the packaged media merge plugin with real reversed inputs',
+ async () => {
+ const fixtureDir = process.env.MOTRIX_TEST_MEDIA_MERGE_PLUGIN as string
+ const manifest = JSON.parse(
+ await readFile(path.join(fixtureDir, 'motrix-plugin.json'), 'utf8')
+ )
+ const binaryPath = process.env.MOTRIX_TEST_FFMPEG as string
+ const directory = await mkdtemp(path.join(tmpdir(), 'merge-package-'))
+ let bridge: CapabilityBridge | undefined
+ try {
+ const video = path.join(directory, 'video.mp4')
+ const audio = path.join(directory, 'audio.mp4')
+ const output = path.join(directory, 'output.mkv')
+ execFileSync(binaryPath, [
+ '-loglevel',
+ 'error',
+ '-f',
+ 'lavfi',
+ '-i',
+ 'color=c=blue:s=32x32:r=5',
+ '-t',
+ '1',
+ '-an',
+ '-c:v',
+ 'libx264',
+ video,
+ ])
+ execFileSync(binaryPath, [
+ '-loglevel',
+ 'error',
+ '-f',
+ 'lavfi',
+ '-i',
+ 'sine=frequency=440',
+ '-t',
+ '1',
+ '-c:a',
+ 'aac',
+ audio,
+ ])
+ const host = makeStubCapabilityHost()
+ host.ffmpeg = new FfmpegCapabilityHost({
+ detect: { available: true, binaryPath },
+ })
+ const spawned = await spawnTestBridge(fixtureDir, {
+ capabilityHost: host,
+ })
+ bridge = spawned.bridge
+ expect(spawned.errorCode).toBeUndefined()
+ const args = { videoInput: audio, audioInput: video, output }
+ await writeFile(output, 'existing output')
+ await expect(
+ bridge.callPlugin(`${manifest.id}.mergeStreams`, args)
+ ).rejects.toMatchObject({ code: 'plugin.command.access_denied' })
+ expect(await readFile(output, 'utf8')).toBe('existing output')
+ await rm(output)
+ await expect(
+ bridge.callMediaMerge(`${manifest.id}.mergeStreams`, args, {
+ ...args,
+ signal: new AbortController().signal,
+ onProgress: () => {},
+ })
+ ).resolves.toEqual({ outputPath: output })
+ expect(
+ (await host.ffmpeg.probe({ path: output })).streams.map(
+ (stream) => stream.type
+ )
+ ).toEqual(['video', 'audio'])
+ } finally {
+ await bridge?.dispose()
+ await rm(directory, { recursive: true, force: true })
+ }
+ }
+)
diff --git a/src/core/plugin/host/capability-bridge.ts b/src/core/plugin/host/capability-bridge.ts
index 0993377f..181745fb 100644
--- a/src/core/plugin/host/capability-bridge.ts
+++ b/src/core/plugin/host/capability-bridge.ts
@@ -16,6 +16,7 @@
import { randomUUID } from 'node:crypto'
import { Worker } from 'node:worker_threads'
import type { SupportedLocale } from '@shared/constants/locales'
+import { MEDIA_MERGE_COMMAND } from '@shared/schemas/manual-media-merge'
import {
CapabilityCallMessageSchema,
type CommandInvocationScopeV1,
@@ -313,6 +314,7 @@ const ffmpegMergeStreamsSchema = z.object({
videoInput: z.string(),
audioInput: z.string(),
output: z.string(),
+ expectedDurationMs: z.number().nonnegative().optional(),
timeoutMs: z.number().optional(),
})
@@ -365,6 +367,14 @@ export interface CapabilityBridgeOperationState {
// CapabilityBridge
// ---------------------------------------------------------------------------
+export interface ManualMergeContext {
+ videoInput: string
+ audioInput: string
+ output: string
+ signal: AbortSignal
+ onProgress: (progress: FfmpegProgress) => void
+}
+
export class CapabilityBridge {
private readonly worker: Worker
private readonly log: ReturnType<CapabilityHost['createLog']>
@@ -401,6 +411,14 @@ export class CapabilityBridge {
// ffmpeg running op registry
private readonly ffmpegOps = new Map<string, FfmpegOpEntry>()
+ private manualMerge:
+ | {
+ context: ManualMergeContext
+ invocationId: number
+ handles: Set<FfmpegOpHandle<{ outputPath: string }>>
+ probes: Set<Promise<unknown>>
+ }
+ | undefined
private readonly httpCalls = new Map<number, HttpCallEntry>()
private inFlightCapabilityCalls = 0
@@ -473,6 +491,12 @@ export class CapabilityBridge {
pluginId: this.opts.pluginId,
manifest: this.opts.manifest,
bundleSource: prepareBundle(this.opts.bundleSource),
+ ffmpeg: {
+ available:
+ this.permitted('ffmpeg') &&
+ (this.opts.capabilityHost.ffmpeg?.available ?? false),
+ version: this.opts.capabilityHost.ffmpeg?.version,
+ },
app: this.opts.capabilityHost.appSnapshot(),
i18n: this.opts.capabilityHost.i18nSnapshot(this.opts.pluginId),
limits: { heapMB: this.opts.heapMB, stackKB: 256 },
@@ -669,6 +693,15 @@ export class CapabilityBridge {
return
}
+ if (this.manualMerge && msg.capability === 'commands') {
+ this.sendError(
+ msg,
+ 'plugin.command.access_denied',
+ 'Nested commands are unavailable during a manual merge'
+ )
+ return
+ }
+
// Spec §I30 — runtime permission gate. Rejects capability calls whose
// permission isn't in `effectivePermissions`. Auto-injected capabilities
// (log/app/i18n/crypto/lifecycle/commands/config/ctx) bypass.
@@ -1302,6 +1335,10 @@ export class CapabilityBridge {
private registerFfmpegHandle(
handle: FfmpegOpHandle<{ outputPath: string }>
): string {
+ const manual = this.manualMerge
+ manual?.handles.add(handle)
+ // The command may fail before guest code awaits the operation result.
+ void handle.result.catch(() => undefined)
const opId = handle.id
const entry: FfmpegOpEntry = {
handle,
@@ -1319,6 +1356,7 @@ export class CapabilityBridge {
if (e) {
e.lastProgress = p
e.lastEmitTs = Date.now()
+ manual?.context.onProgress(p)
}
}
} catch {
@@ -1384,6 +1422,37 @@ export class CapabilityBridge {
private async dispatchFfmpeg(msg: BridgeCallMessage): Promise<unknown> {
const ffmpeg = this.opts.capabilityHost.ffmpeg
+ const manual = this.manualMerge
+ if (manual) {
+ const scope = commandScopeFromMessage(msg)
+ if (scope?.commandInvocationId !== manual.invocationId)
+ throw new PluginCodedError(
+ 'plugin.command.access_denied',
+ 'FFmpeg is reserved for the manual merge'
+ )
+ manual.context.signal.throwIfAborted()
+ if (
+ ![
+ 'probe',
+ 'mergeStreams',
+ 'op.result.await',
+ 'op.progress.pull',
+ 'op.abort',
+ ].includes(msg.method)
+ )
+ throw new PluginCodedError(
+ 'plugin.command.access_denied',
+ 'Only probing and merging selected files is allowed'
+ )
+ if (
+ msg.method.startsWith('op.') &&
+ ![...manual.handles].some((handle) => handle.id === msg.args[0])
+ )
+ throw new PluginCodedError(
+ 'plugin.command.access_denied',
+ 'Operation is outside the manual merge'
+ )
+ }
// ── op lifecycle methods ───────────────────────────────────────────────
if (msg.method === 'op.result.await') {
@@ -1451,6 +1520,24 @@ export class CapabilityBridge {
const [opts] = msg.args
const parsed = ffmpegProbeSchema.parse(opts)
// probe returns a Promise<MediaInfo> directly, not an op handle.
+ if (manual) {
+ if (
+ ![manual.context.videoInput, manual.context.audioInput].includes(
+ parsed.path
+ )
+ )
+ throw new PluginCodedError(
+ 'plugin.command.access_denied',
+ 'Input is outside the selected files'
+ )
+ const probe = ffmpeg.probe({
+ ...parsed,
+ signal: manual.context.signal,
+ localOnly: true,
+ })
+ manual.probes.add(probe)
+ return probe
+ }
return ffmpeg.probe(parsed)
}
@@ -1484,8 +1571,31 @@ export class CapabilityBridge {
if (msg.method === 'mergeStreams') {
const [opts] = msg.args
const parsed = ffmpegMergeStreamsSchema.parse(opts)
- parsed.output = await this.gateFfmpegOutput(parsed.output)
- const handle = ffmpeg.mergeStreams(parsed)
+ if (manual) {
+ const inputs = new Set([
+ manual.context.videoInput,
+ manual.context.audioInput,
+ ])
+ if (
+ !inputs.has(parsed.videoInput) ||
+ !inputs.has(parsed.audioInput) ||
+ parsed.videoInput === parsed.audioInput ||
+ parsed.output !== manual.context.output ||
+ manual.handles.size > 0
+ )
+ throw new PluginCodedError(
+ 'plugin.command.access_denied',
+ 'Merge must use the selected files and reserved output once'
+ )
+ }
+ // The manual output is already reserved by the host. Do not yield
+ // between checking the single-launch limit and registering its handle.
+ if (!manual) parsed.output = await this.gateFfmpegOutput(parsed.output)
+ const handle = ffmpeg.mergeStreams({
+ ...parsed,
+ signal: manual?.context.signal,
+ localOnly: !!manual,
+ })
const opId = this.registerFfmpegHandle(handle)
return { opId }
}
@@ -1779,6 +1889,46 @@ export class CapabilityBridge {
)
}
+ /** Run a user-selected merge in the existing FIFO lane with a bounded file scope. */
+ async callMediaMerge(
+ commandId: string,
+ args: unknown,
+ context: ManualMergeContext
+ ): Promise<unknown> {
+ context.signal.throwIfAborted()
+ if (this.manualMerge) throw new Error('A manual merge is already running')
+ const invocationId = this.nextCommandCallId
+ const scope = {
+ context,
+ invocationId,
+ handles: new Set<FfmpegOpHandle<{ outputPath: string }>>(),
+ probes: new Set<Promise<unknown>>(),
+ }
+ this.manualMerge = scope
+ const abort = () => {
+ const pending = this.pendingCommandCalls.get(invocationId)
+ this.pendingCommandCalls.delete(invocationId)
+ pending?.reject(new Error('mediaMerge.cancelled'))
+ for (const handle of scope.handles) handle.abort()
+ }
+ context.signal.addEventListener('abort', abort, { once: true })
+ try {
+ const result = await this.callPlugin(commandId, args, 60 * 60_000)
+ await Promise.all([...scope.handles].map((handle) => handle.result))
+ context.signal.throwIfAborted()
+ return result
+ } finally {
+ context.signal.removeEventListener('abort', abort)
+ for (const handle of scope.handles) handle.abort()
+ await Promise.allSettled(
+ [...scope.handles].map((handle) => handle.result)
+ )
+ await Promise.allSettled(scope.probes)
+ for (const handle of scope.handles) this.ffmpegOps.delete(handle.id)
+ this.manualMerge = undefined
+ }
+ }
+
/**
* Invoke a registered command inside the plugin VM and await its result.
* The command must have been registered during activation via commands.register().
@@ -1794,6 +1944,17 @@ export class CapabilityBridge {
timeoutMs = 10_000,
callChain?: PluginCallChain
): Promise<unknown> {
+ if (
+ commandId === `${this.opts.pluginId}.${MEDIA_MERGE_COMMAND}` &&
+ this.manualMerge?.invocationId !== this.nextCommandCallId
+ ) {
+ return Promise.reject(
+ new PluginCodedError(
+ 'plugin.command.access_denied',
+ 'Media merging requires a host-authorized selected-file job'
+ )
+ )
+ }
const id = this.nextCommandCallId++
const laneCallChain = callChain ?? currentPluginCallChain()
const commandScope: CommandInvocationScopeV1 = {
diff --git a/src/core/plugin/host/plugin-host.ts b/src/core/plugin/host/plugin-host.ts
index 9af0f6ed..5582af3f 100644
--- a/src/core/plugin/host/plugin-host.ts
+++ b/src/core/plugin/host/plugin-host.ts
@@ -15,7 +15,11 @@ import type { PluginRegistry } from '../plugin-registry'
import type { PluginStateStore } from '../state/plugin-state-store'
import { verifyBuiltinSignature } from '../update/signature'
import type { HookName } from './bridge-protocol'
-import { CapabilityBridge, type HookContextArgs } from './capability-bridge'
+import {
+ CapabilityBridge,
+ type HookContextArgs,
+ type ManualMergeContext,
+} from './capability-bridge'
import {
type PluginCallChain,
PluginLane,
@@ -255,7 +259,10 @@ export class PluginHost {
pluginId: string,
commandId: string,
args: unknown,
- options: { callChain?: PluginCallChain } = {}
+ options: {
+ callChain?: PluginCallChain
+ mediaMerge?: ManualMergeContext
+ } = {}
): Promise<unknown> {
return this.laneFor(pluginId).run(
() => {
@@ -267,6 +274,15 @@ export class PluginHost {
)
}
a.lastActivityAt = Date.now()
+ if (options.mediaMerge) {
+ return a.bridge.callMediaMerge(commandId, args, {
+ ...options.mediaMerge,
+ signal: AbortSignal.any([
+ options.mediaMerge.signal,
+ a.admissionAbort.signal,
+ ]),
+ })
+ }
return raceWithAdmissionAbort(
a.bridge.callPlugin(commandId, args),
a.admissionAbort.signal,
diff --git a/src/core/plugin/host/quick-js-worker.ts b/src/core/plugin/host/quick-js-worker.ts
index 2b0e676a..bd0286cb 100644
--- a/src/core/plugin/host/quick-js-worker.ts
+++ b/src/core/plugin/host/quick-js-worker.ts
@@ -1803,6 +1803,12 @@ function injectPluginApi(vm: QuickJSContext, init: BridgeInitMessage): void {
//
// probe: returns the result directly (not an op handle).
const ffmpeg = vm.newObject()
+ vm.setProp(ffmpeg, 'available', init.ffmpeg?.available ? vm.true : vm.false)
+ if (init.ffmpeg?.version) {
+ const version = vm.newString(init.ffmpeg.version)
+ vm.setProp(ffmpeg, 'version', version)
+ version.dispose()
+ }
function makeFfmpegHandle(opId: string): QuickJSHandle {
const handleObj = vm.newObject()
@@ -1832,11 +1838,13 @@ function injectPluginApi(vm: QuickJSContext, init: BridgeInitMessage): void {
vm.runtime.executePendingJobs()
}
)
- resultDeferred.settled.then(() => vm.runtime.executePendingJobs())
+ resultDeferred.settled.then(() => {
+ vm.runtime.executePendingJobs()
+ resultDeferred.dispose()
+ })
vm.setProp(handleObj, 'result', resultDeferred.handle)
- // setProp increments the QuickJS ref-count on resultDeferred.handle; the
- // JS-side wrapper can be disposed now without releasing the VM-side promise.
- resultDeferred.dispose()
+ // Retain the deferred's resolve/reject handles until settlement. The
+ // object's reference retains the promise, but cannot settle it by itself.
// pollProgress(): returns Promise<FfmpegProgress|null>
const pollFn = vm.newFunction('pollProgress', () => {
diff --git a/src/core/plugin/manifest/parse.test.ts b/src/core/plugin/manifest/parse.test.ts
index 3fc8891e..5b340866 100644
--- a/src/core/plugin/manifest/parse.test.ts
+++ b/src/core/plugin/manifest/parse.test.ts
@@ -1,6 +1,65 @@
import { describe, expect, it } from 'vitest'
import { PluginEngineVersionTooOld, PluginManifestInvalid } from './errors'
-import { parseManifest } from './parse'
+import { parseManifest, semverSatisfies } from './parse'
+
+describe('plugin engine version ranges', () => {
+ it.each([
+ ['2.0.0-beta.9', false],
+ ['2.0.0-beta.44', false],
+ ['2.0.0-beta.45', true],
+ ['2.0.0-beta.46', true],
+ ['2.0.0-beta.100', true],
+ ['2.0.0-alpha.99', false],
+ ['2.0.0-rc.1', true],
+ ['2.0.0', true],
+ ['2.0.1', true],
+ ['3.0.0', false],
+ ])('checks %s against a beta floor: %s', (version, expected) => {
+ expect(semverSatisfies(version, '>=2.0.0-beta.45 <3.0.0')).toBe(expected)
+ })
+
+ it.each([
+ ['2.0.0-beta.45', '>2.0.0-beta.45', false],
+ ['2.0.0-beta.46', '>2.0.0-beta.45', true],
+ ['2.0.0-beta.44', '<2.0.0-beta.45', true],
+ ['2.0.0-beta.45', '<2.0.0-beta.45', false],
+ ['2.0.0-beta.45', '<=2.0.0-beta.45', true],
+ ['2.0.0', '<=2.0.0-beta.45', false],
+ ['2.0.0-beta.45', '=2.0.0-beta.45', true],
+ ['2.0.0', '=2.0.0-beta.45', false],
+ ['2.0.0-beta.45+local.1', '2.0.0-beta.45+build.2', true],
+ ['2.0.0-beta.9', '^2.0.0-beta.10', false],
+ ['2.0.0', '^2.0.0-beta.45', true],
+ ['3.0.0', '^2.0.0-beta.45', false],
+ ['2.0.0-beta.44', '~2.0.0-beta.45', false],
+ ['2.0.1', '~2.0.0-beta.45', true],
+ ['2.1.0', '~2.0.0-beta.45', false],
+ ['2.0.0-beta.45', '>=2.0.0-beta.45 <2.0.0', true],
+ ['2.0.0', '>=2.0.0-beta.45 <2.0.0', false],
+ ['2.0.0-beta.45', '>=2.0.0 <=2.0.0-beta.46', false],
+ ])('%s satisfies %s: %s', (version, range, expected) => {
+ expect(semverSatisfies(version, range)).toBe(expected)
+ })
+
+ it('preserves the release-only API ranges used by existing builtin plugins', () => {
+ expect(semverSatisfies('2.0.0-beta.45', '>=2.0.0 <3.0.0')).toBe(true)
+ expect(semverSatisfies('2.0.0-beta.45', '>=2.0.1 <3.0.0')).toBe(false)
+ expect(semverSatisfies('3.0.0-beta.1', '>=2.0.0 <3.0.0')).toBe(false)
+ expect(semverSatisfies('2.0.0-beta.45', '*')).toBe(true)
+ })
+
+ it.each(['2.0', '2.0.0-beta.', '2.0.0-beta.045', '2.0.0.45', '2.0.0+'])(
+ 'rejects malformed version %s instead of ignoring its suffix',
+ (version) => {
+ expect(() => semverSatisfies(version, '>=2.0.0-beta.45')).toThrow(
+ PluginManifestInvalid
+ )
+ expect(() => semverSatisfies('2.0.0-beta.45', `>=${version}`)).toThrow(
+ PluginManifestInvalid
+ )
+ }
+ )
+})
const VALID_JSON = JSON.stringify({
manifestVersion: 1,
@@ -28,6 +87,22 @@ describe('parseManifest', () => {
)
})
+ it('enforces a beta minimum during manifest loading and accepts the final release', () => {
+ const manifest = JSON.stringify({
+ ...JSON.parse(VALID_JSON),
+ engines: { motrix: '>=2.0.0-beta.45' },
+ })
+ expect(() =>
+ parseManifest(manifest, { hostVersion: '2.0.0-beta.44' })
+ ).toThrow(PluginEngineVersionTooOld)
+ expect(
+ parseManifest(manifest, { hostVersion: '2.0.0-beta.45' }).manifest.id
+ ).toBe('alice.demo')
+ expect(parseManifest(manifest, { hostVersion: '2.0.0' }).manifest.id).toBe(
+ 'alice.demo'
+ )
+ })
+
it('throws PluginManifestInvalid for syntactic JSON error', () => {
expect(() => parseManifest('{ not json', { hostVersion: '2.5.0' })).toThrow(
PluginManifestInvalid
diff --git a/src/core/plugin/manifest/parse.ts b/src/core/plugin/manifest/parse.ts
index cd0367c3..a2e08d5a 100644
--- a/src/core/plugin/manifest/parse.ts
+++ b/src/core/plugin/manifest/parse.ts
@@ -1,5 +1,6 @@
// src/core/plugin/manifest/parse.ts
+import { compareSemver } from '@shared/semver'
import { PluginEngineVersionTooOld, PluginManifestInvalid } from './errors'
import {
type HookRole,
@@ -47,64 +48,84 @@ export interface ParseResult {
warnings: ManifestWarning[]
}
-export function semverSatisfies(version: string, range: string): boolean {
- if (range.trim() === '*') return true
- const v = parseVer(version)
- const clauses = range.trim().split(/\s+/)
- for (const c of clauses) {
- if (!testClause(v, c)) return false
- }
- return true
+const STRICT_SEMVER_PATTERN =
+ /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/
+
+interface EngineVersion {
+ value: string
+ core: [number, number, number]
+ prerelease: boolean
}
-function parseVer(s: string): [number, number, number] {
- const m = /^(\d+)\.(\d+)\.(\d+)/.exec(s)
- if (!m)
- throw new PluginManifestInvalid(
- 'plugin.manifest.host_version_unparseable',
- `unparseable host version: ${s}`
- )
- return [Number(m[1]), Number(m[2]), Number(m[3])]
+export function semverSatisfies(version: string, range: string): boolean {
+ if (range.trim() === '*') return true
+ const host = parseVer(version, 'host_version_unparseable')
+ const clauses = range
+ .trim()
+ .split(/\s+/)
+ .map((clause) => {
+ const match = /^(>=|<=|>|<|=|\^|~)?(.+)$/.exec(clause)
+ if (!match) {
+ throw new PluginManifestInvalid(
+ 'plugin.manifest.engines_unparseable',
+ `unparseable range clause: ${clause}`
+ )
+ }
+ return {
+ op: match[1] ?? '=',
+ target: parseVer(match[2], 'engines_unparseable'),
+ }
+ })
+ // Existing plugins, including signed builtin seeds, use release-only ranges
+ // to describe the host API line (e.g. >=2.0.0 <3.0.0 during the 2.0 beta).
+ // Preserve that contract. An explicit prerelease in any clause opts the whole
+ // range into full SemVer precedence, so a beta floor cannot be bypassed.
+ const comparedVersion = clauses.some(({ target }) => target.prerelease)
+ ? host.value
+ : host.core.join('.')
+ return clauses.every(({ op, target }) => {
+ const cmp = compareSemver(comparedVersion, target.value)
+ switch (op) {
+ case '>=':
+ return cmp >= 0
+ case '<=':
+ return cmp <= 0
+ case '>':
+ return cmp > 0
+ case '<':
+ return cmp < 0
+ case '=':
+ return cmp === 0
+ case '^':
+ return host.core[0] === target.core[0] && cmp >= 0
+ case '~':
+ return (
+ host.core[0] === target.core[0] &&
+ host.core[1] === target.core[1] &&
+ cmp >= 0
+ )
+ default:
+ return false
+ }
+ })
}
-function testClause(v: [number, number, number], clause: string): boolean {
- const m = /^(>=|<=|>|<|=|\^|~)?(\d+)\.(\d+)\.(\d+)/.exec(clause)
- if (!m)
+function parseVer(
+ value: string,
+ code: 'host_version_unparseable' | 'engines_unparseable'
+): EngineVersion {
+ const match = STRICT_SEMVER_PATTERN.exec(value)
+ if (!match) {
throw new PluginManifestInvalid(
- 'plugin.manifest.engines_unparseable',
- `unparseable range clause: ${clause}`
+ `plugin.manifest.${code}`,
+ `unparseable version: ${value}`
)
- const op = m[1] ?? '='
- const r: [number, number, number] = [Number(m[2]), Number(m[3]), Number(m[4])]
- const cmp = cmpVer(v, r)
- switch (op) {
- case '>=':
- return cmp >= 0
- case '<=':
- return cmp <= 0
- case '>':
- return cmp > 0
- case '<':
- return cmp < 0
- case '=':
- return cmp === 0
- case '^':
- return v[0] === r[0] && cmp >= 0
- case '~':
- return v[0] === r[0] && v[1] === r[1] && cmp >= 0
- default:
- return false
}
-}
-
-function cmpVer(
- a: [number, number, number],
- b: [number, number, number]
-): number {
- for (let i = 0; i < 3; i++) {
- if (a[i] !== b[i]) return a[i] < b[i] ? -1 : 1
+ return {
+ value,
+ core: [Number(match[1]), Number(match[2]), Number(match[3])],
+ prerelease: match[4] !== undefined,
}
- return 0
}
function levenshtein(a: string, b: string): number {
diff --git a/src/core/plugin/queries.test.ts b/src/core/plugin/queries.test.ts
index 2002f11e..6dac3bb0 100644
--- a/src/core/plugin/queries.test.ts
+++ b/src/core/plugin/queries.test.ts
@@ -46,6 +46,16 @@ function fakeIndexed(over: Partial<IndexedPluginLike>): IndexedPluginLike {
// ---------------------------------------------------------------------------
describe('checkPluginCompatibility', () => {
+ it('uses the same beta floor for the pre-install compatibility query', () => {
+ const manifest = fakeManifest({ engines: { motrix: '>=2.0.0-beta.45' } })
+ expect(checkPluginCompatibility(manifest, '2.0.0-beta.44')).toMatchObject({
+ ok: false,
+ code: 'plugin.manifest.engine_version_too_old',
+ })
+ expect(checkPluginCompatibility(manifest, '2.0.0-beta.45').ok).toBe(true)
+ expect(checkPluginCompatibility(manifest, '2.0.0').ok).toBe(true)
+ })
+
it('returns ok when engines.motrix is satisfied', () => {
const m = fakeManifest({ engines: { motrix: '>=2.0.0 <3.0.0' } })
const r = checkPluginCompatibility(m, '2.5.0')
diff --git a/src/core/plugin/registry/registry-client.test.ts b/src/core/plugin/registry/registry-client.test.ts
index c2b0ac6c..fb61b5c0 100644
--- a/src/core/plugin/registry/registry-client.test.ts
+++ b/src/core/plugin/registry/registry-client.test.ts
@@ -429,4 +429,19 @@ describe('RegistryClient', () => {
).toBe(true)
expect(await client.get('example.unknown', '2.2.0')).toBeNull()
})
+
+ it('marks a beta-gated listing incompatible on an earlier beta and compatible on stable', async () => {
+ const catalog = structuredClone(fixture)
+ const entry = catalog.plugins.find(
+ (plugin) => plugin.id === 'example.minimal'
+ )!
+ entry.engines.motrix = '>=2.0.0-beta.45 <3.0.0'
+ const { impl } = makeFetch([{ status: 200, body: catalog }])
+ const client = makeClient(impl)
+ expect((await client.get(entry.id, '2.0.0-beta.44'))?.compatible).toBe(
+ false
+ )
+ expect((await client.get(entry.id, '2.0.0-beta.45'))?.compatible).toBe(true)
+ expect((await client.get(entry.id, '2.0.0'))?.compatible).toBe(true)
+ })
})
diff --git a/src/main/core/update-manager.test.ts b/src/main/core/update-manager.test.ts
index 3d98d144..e6fbc215 100644
--- a/src/main/core/update-manager.test.ts
+++ b/src/main/core/update-manager.test.ts
@@ -441,6 +441,29 @@ describe('UpdateManager', () => {
expect(betaUpdater.allowDowngrade).toBe(false)
})
+ it.each(['beta', 'stable'] as const)(
+ 'allows a beta installation to accept the final release on the %s channel',
+ async (channel) => {
+ const backend = createFakeUpdater()
+ const betaManager = new UpdateManager({
+ eventBus: new EventBus(),
+ updater: backend,
+ currentVersion: '2.0.0-beta.45',
+ channel,
+ })
+ await expect(
+ backend.isUpdateSupported(supportInfo('2.0.0'))
+ ).resolves.toBe(true)
+ backend.fire('update-available', supportInfo('2.0.0'))
+ expect(betaManager.getState()).toMatchObject({
+ phase: 'available',
+ currentVersion: '2.0.0-beta.45',
+ availableVersion: '2.0.0',
+ })
+ expect(backend.allowDowngrade).toBe(false)
+ }
+ )
+
it('reconfigures and clears a prior-channel available snapshot', () => {
updater.fire('update-available', { version: '2.1.0' })
expect(manager.getState().phase).toBe('available')
diff --git a/src/main/ipc/commands.test.ts b/src/main/ipc/commands.test.ts
index e1d28971..148f1a8b 100644
--- a/src/main/ipc/commands.test.ts
+++ b/src/main/ipc/commands.test.ts
@@ -73,6 +73,7 @@ const ipcHandleMock = vi.fn()
const ipcRemoveHandlerMock = vi.fn()
const openExternalMock = vi.fn()
const showOpenDialogMock = vi.fn()
+const showSaveDialogMock = vi.fn()
vi.mock('electron', () => ({
BrowserWindow: {
fromWebContents: (...args: unknown[]) => fromWebContentsMock(...args),
@@ -83,6 +84,7 @@ vi.mock('electron', () => ({
},
dialog: {
showMessageBox: vi.fn(),
+ showSaveDialog: (...args: unknown[]) => showSaveDialogMock(...args),
showOpenDialog: (...args: unknown[]) => showOpenDialogMock(...args),
},
shell: {
@@ -1072,6 +1074,51 @@ describe('buildCommandHandlers', () => {
expect(ctx.contextStore.merge).not.toHaveBeenCalled()
})
+ it('uses parented native file dialogs and validates generic picker options', async () => {
+ showOpenDialogMock.mockReset()
+ showSaveDialogMock.mockReset()
+ const sender = {} as never
+ const parent = { isDestroyed: () => false }
+ fromWebContentsMock.mockReturnValue(parent)
+ showOpenDialogMock.mockResolvedValueOnce({
+ canceled: false,
+ filePaths: ['/media/video.mp4'],
+ })
+ showSaveDialogMock
+ .mockResolvedValueOnce({ canceled: false, filePath: '/media/merged.mkv' })
+ .mockResolvedValueOnce({ canceled: true })
+ // @ts-expect-error partial ctx
+ const handlers = buildCommandHandlers(fakeCtx())
+ await expect(
+ handlers[Commands.PickFile]?.(sender, { kind: 'open' })
+ ).resolves.toBe('/media/video.mp4')
+ expect(showOpenDialogMock).toHaveBeenCalledWith(
+ parent,
+ expect.objectContaining({ properties: ['openFile'] })
+ )
+ await expect(
+ handlers[Commands.PickFile]?.(sender, {
+ kind: 'save',
+ extensions: ['mp4', 'mkv'],
+ })
+ ).resolves.toBe('/media/merged.mkv')
+ expect(showSaveDialogMock).toHaveBeenCalledWith(
+ parent,
+ expect.objectContaining({
+ filters: [{ name: expect.any(String), extensions: ['mp4', 'mkv'] }],
+ })
+ )
+ await expect(
+ handlers[Commands.PickFile]?.(sender, { kind: 'save' })
+ ).resolves.toBeNull()
+ await expect(
+ handlers[Commands.PickFile]?.(sender, {
+ kind: 'open',
+ extensions: ['../invalid'],
+ })
+ ).rejects.toThrow()
+ })
+
it('returns a picked save directory and handles cancellation', async () => {
showOpenDialogMock.mockReset()
fromWebContentsMock.mockReset()
@@ -2877,3 +2924,44 @@ describe('host-owned task directory history', () => {
finish({ ok: true, value: { favorites: [], recent: [] } })
})
})
+
+describe('manual media merge logging', () => {
+ it('uses the existing plugin log capability for preparation failures', async () => {
+ const ctx = fakeCtx()
+ const error = vi.fn()
+ const createLog = vi.fn(() => ({ info: vi.fn(), warn: vi.fn(), error }))
+ const pluginId = 'test.merger'
+ const handlers = buildCommandHandlers({
+ ...ctx,
+ pluginRegistry: {
+ list: () => [{ id: pluginId, name: 'Merger', enabled: true }],
+ get: () => ({
+ manifest: {
+ permissions: ['ffmpeg'],
+ contributes: {
+ commands: [{ id: `${pluginId}.mergeStreams`, public: true }],
+ },
+ },
+ }),
+ },
+ capabilityHost: { createLog },
+ } as unknown as CommandContext)
+ await expect(
+ handlers[Commands.StartMediaMerge]?.({
+ pluginId,
+ videoInput: 'relative.mp4',
+ audioInput: '/media/audio.mp4',
+ output: '/media/merged.mp4',
+ })
+ ).rejects.toThrow('mediaMerge.absolutePaths')
+ expect(createLog).toHaveBeenCalledWith(pluginId)
+ expect(error).toHaveBeenCalledWith(
+ 'Media merge failed',
+ expect.objectContaining({
+ event: 'media-merge.failed',
+ stage: 'preparing',
+ reason: 'mediaMerge.absolutePaths',
+ })
+ )
+ })
+})
diff --git a/src/main/ipc/commands.ts b/src/main/ipc/commands.ts
index 58f51b3e..449eccd4 100644
--- a/src/main/ipc/commands.ts
+++ b/src/main/ipc/commands.ts
@@ -14,6 +14,7 @@ import { getLogger } from '@core/logger'
import { publishEngineRestartRequired } from '@core/notifications/engine-restart-required'
import type { NotificationCenter } from '@core/notifications/notification-center'
import type { CapabilityHost } from '@core/plugin/capabilities/interface'
+import { ManualMediaMerge } from '@core/plugin/commands/manual-media-merge'
import type { GrantsManager } from '@core/plugin/grants/grants-manager'
import type { HookAuditLog } from '@core/plugin/hooks/audit-log'
import type { HookOrchestrator } from '@core/plugin/hooks/hook-orchestrator'
@@ -109,6 +110,7 @@ import {
taskIdsPayloadSchema,
} from '@shared/schemas/bulk-task-command'
import { closeCurrentWindowSchema } from '@shared/schemas/close-current-window'
+import { filePickerOptionsSchema } from '@shared/schemas/file-picker'
import { moveTasksPayloadSchema } from '@shared/schemas/move-tasks'
import { checkPluginUpdatesPayloadSchema } from '@shared/schemas/plugin-update'
import { REGISTRY_PLUGIN_ID_RE } from '@shared/schemas/registry'
@@ -652,7 +654,69 @@ export function buildCommandHandlers(ctx: CommandContext): CommandHandlerMap {
runWork: ctx.trackAsyncWork,
})
+ const manualMediaMerge = new ManualMediaMerge({
+ createLog: (pluginId) => capabilityHost.createLog(pluginId),
+ registry: pluginRegistry,
+ host: pluginHost,
+ tasks: taskManager,
+ runWork: ctx.trackAsyncWork,
+ })
+
return {
+ [Commands.GetMediaMergeState]: async () => manualMediaMerge.state(),
+ [Commands.GetMediaMergeSelection]: async (value: unknown) =>
+ manualMediaMerge.selection(value),
+ [Commands.StartMediaMerge]: async (value: unknown) =>
+ manualMediaMerge.start(value),
+ [Commands.GetMediaMergeJob]: async (value: unknown) =>
+ manualMediaMerge.get(value),
+ [Commands.CancelMediaMerge]: async (value: unknown) =>
+ manualMediaMerge.cancel(value),
+ [Commands.PickFile]: async (sender: WebContents, value: unknown) => {
+ const params = filePickerOptionsSchema.parse(value)
+ if (saveDirPickersInFlight.has(sender)) return null
+ saveDirPickersInFlight.add(sender)
+ try {
+ const parent = BrowserWindow.fromWebContents(sender)
+ if (params.kind === 'save') {
+ const options = {
+ defaultPath: params.defaultPath,
+ filters: params.extensions?.length
+ ? [
+ {
+ name: i18n.t('directoryPicker.files'),
+ extensions: params.extensions,
+ },
+ ]
+ : undefined,
+ }
+ const result =
+ parent && !parent.isDestroyed()
+ ? await dialog.showSaveDialog(parent, options)
+ : await dialog.showSaveDialog(options)
+ return result.canceled ? null : (result.filePath ?? null)
+ }
+ const options: OpenDialogOptions = {
+ properties: ['openFile'],
+ defaultPath: params.defaultPath,
+ filters: params.extensions?.length
+ ? [
+ {
+ name: i18n.t('directoryPicker.files'),
+ extensions: params.extensions,
+ },
+ ]
+ : undefined,
+ }
+ const result =
+ parent && !parent.isDestroyed()
+ ? await dialog.showOpenDialog(parent, options)
+ : await dialog.showOpenDialog(options)
+ return result.canceled ? null : (result.filePaths[0] ?? null)
+ } finally {
+ saveDirPickersInFlight.delete(sender)
+ }
+ },
[Commands.InstallCliTool]: async (payload: unknown) =>
cliToolService.install(
cliInstallRequestSchema.parse(payload) as CliInstallRequest
@@ -1483,6 +1547,7 @@ export function buildCommandHandlers(ctx: CommandContext): CommandHandlerMap {
[Commands.RevealInFolder]: createRevealInFolderHandler({
shell,
getTask: (taskId) => taskManager.getById(taskId),
+ getMediaMergeJob: (jobId) => manualMediaMerge.get(jobId),
}),
[Commands.OpenTaskFile]: createOpenTaskFileHandler({
shell,
@@ -1888,6 +1953,7 @@ export function registerCommandHandlers(ctx: CommandContext): () => void {
channel === Commands.MinimizeCurrentWindow ||
channel === Commands.ToggleMaximizeCurrentWindow ||
channel === Commands.PickSaveDir ||
+ channel === Commands.PickFile ||
channel === Commands.ResizeWindow ||
channel === Commands.UpdateMenuContext
) {
diff --git a/src/main/ipc/commands/reveal-in-folder.test.ts b/src/main/ipc/commands/reveal-in-folder.test.ts
index 3d90dd97..a0244c16 100644
--- a/src/main/ipc/commands/reveal-in-folder.test.ts
+++ b/src/main/ipc/commands/reveal-in-folder.test.ts
@@ -3,6 +3,7 @@
import { mkdir, mkdtemp, rm, stat, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import path from 'node:path'
+import type { MediaMergeJob } from '@shared/schemas/manual-media-merge'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { createRevealInFolderHandler } from './reveal-in-folder'
@@ -26,6 +27,85 @@ beforeEach(() => {
})
describe('revealInFolder', () => {
+ const mediaMergeJobId = '04f56840-f5af-4960-884e-72b7cd15781a'
+ const completedMerge: MediaMergeJob = {
+ id: mediaMergeJobId,
+ pluginId: 'community.media-merge',
+ status: 'completed',
+ percent: 100,
+ output: '/downloads/merged.mp4',
+ }
+
+ it('reveals the completed merge output from host state, ignoring a supplied path', async () => {
+ const shell = { showItemInFolder: vi.fn(), openPath: vi.fn(async () => '') }
+ const getTask = vi.fn()
+ const getMediaMergeJob = vi.fn(() => completedMerge)
+ const handler = createRevealInFolderHandler({
+ shell,
+ getTask,
+ getMediaMergeJob,
+ })
+ const payload = { mediaMergeJobId, output: '/untrusted/output.mp4' }
+
+ await handler(payload)
+
+ expect(getMediaMergeJob).toHaveBeenCalledExactlyOnceWith(mediaMergeJobId)
+ expect(getTask).not.toHaveBeenCalled()
+ expect(shell.showItemInFolder).toHaveBeenCalledExactlyOnceWith(
+ completedMerge.output
+ )
+ })
+
+ it('opens the parent if the completed merge output was moved or deleted', async () => {
+ statMock
+ .mockRejectedValueOnce(missingPath())
+ .mockResolvedValueOnce(directoryStat)
+ const shell = { showItemInFolder: vi.fn(), openPath: vi.fn(async () => '') }
+ const handler = createRevealInFolderHandler({
+ shell,
+ getTask: () => undefined,
+ getMediaMergeJob: () => completedMerge,
+ })
+ await handler({ mediaMergeJobId })
+ expect(shell.openPath).toHaveBeenCalledExactlyOnceWith('/downloads')
+ expect(shell.showItemInFolder).not.toHaveBeenCalled()
+ })
+
+ it.each(['running', 'cancelling', 'cancelled', 'failed', 'missing'] as const)(
+ 'rejects a %s merge without opening a folder',
+ async (status) => {
+ const shell = {
+ showItemInFolder: vi.fn(),
+ openPath: vi.fn(async () => ''),
+ }
+ const handler = createRevealInFolderHandler({
+ shell,
+ getTask: () => undefined,
+ getMediaMergeJob: () =>
+ status === 'missing' ? undefined : { ...completedMerge, status },
+ })
+ await expect(handler({ mediaMergeJobId })).rejects.toThrow(/not ready/)
+ expect(shell.showItemInFolder).not.toHaveBeenCalled()
+ expect(shell.openPath).not.toHaveBeenCalled()
+ }
+ )
+
+ it('rejects an invalid merge id before looking it up', async () => {
+ const shell = { showItemInFolder: vi.fn(), openPath: vi.fn(async () => '') }
+ const getMediaMergeJob = vi.fn(() => completedMerge)
+ const handler = createRevealInFolderHandler({
+ shell,
+ getTask: () => undefined,
+ getMediaMergeJob,
+ })
+ await expect(
+ handler({ mediaMergeJobId: '/downloads/merged.mp4' })
+ ).rejects.toThrow()
+ expect(getMediaMergeJob).not.toHaveBeenCalled()
+ expect(shell.showItemInFolder).not.toHaveBeenCalled()
+ expect(shell.openPath).not.toHaveBeenCalled()
+ })
+
it('reveals the current path owned by the requested task', async () => {
const shell = { showItemInFolder: vi.fn(), openPath: vi.fn(async () => '') }
const handler = createRevealInFolderHandler({
diff --git a/src/main/ipc/commands/reveal-in-folder.ts b/src/main/ipc/commands/reveal-in-folder.ts
index 091d325a..bf9d6371 100644
--- a/src/main/ipc/commands/reveal-in-folder.ts
+++ b/src/main/ipc/commands/reveal-in-folder.ts
@@ -1,6 +1,10 @@
import { stat } from 'node:fs/promises'
import path from 'node:path'
import { AppError, ErrorCode } from '@shared/errors'
+import {
+ type MediaMergeJob,
+ mediaMergeJobIdSchema,
+} from '@shared/schemas/manual-media-merge'
import type { DownloadTask } from '@shared/types/task'
export interface RevealInFolderDeps {
@@ -11,11 +15,12 @@ export interface RevealInFolderDeps {
getTask: (
taskId: string
) => Pick<DownloadTask, 'diskPath' | 'finalPath'> | undefined
+ getMediaMergeJob?: (jobId: string) => MediaMergeJob | undefined
}
-export interface RevealInFolderPayload {
- taskId: string
-}
+export type RevealInFolderPayload =
+ | { taskId: string }
+ | { mediaMergeJobId: string }
function isWindowsDeviceNamespace(value: string): boolean {
const normalized = value.replaceAll('\\', '/')
@@ -27,27 +32,45 @@ function isWindowsDeviceNamespace(value: string): boolean {
)
}
-export function createRevealInFolderHandler(deps: RevealInFolderDeps) {
- return async (payload: RevealInFolderPayload): Promise<void> => {
- const taskId = payload?.taskId
- if (typeof taskId !== 'string' || taskId.trim() === '') {
+function resolveOutputPath(
+ deps: RevealInFolderDeps,
+ payload: RevealInFolderPayload
+): string {
+ if (payload && 'mediaMergeJobId' in payload) {
+ const jobId = mediaMergeJobIdSchema.parse(payload.mediaMergeJobId)
+ const job = deps.getMediaMergeJob?.(jobId)
+ if (job?.status !== 'completed') {
throw new AppError(
ErrorCode.IpcInvalidPayload,
- 'revealInFolder: invalid task id'
+ 'revealInFolder: merge output is not ready'
)
}
+ return job.output
+ }
+ const taskId = payload?.taskId
+ if (typeof taskId !== 'string' || taskId.trim() === '') {
+ throw new AppError(
+ ErrorCode.IpcInvalidPayload,
+ 'revealInFolder: invalid task id'
+ )
+ }
- const task = deps.getTask(taskId)
- if (!task) {
- throw new AppError(ErrorCode.TaskNotFound, `Task not found: ${taskId}`)
- }
+ const task = deps.getTask(taskId)
+ if (!task) {
+ throw new AppError(ErrorCode.TaskNotFound, `Task not found: ${taskId}`)
+ }
+
+ // Indexed BT downloads intentionally live in an internal
+ // `.motrix/<workspace>/p` staging tree until finalization. Revealing that
+ // path leaks an implementation identifier and disagrees with the target
+ // path shown by the Inspector, so user-facing navigation follows the
+ // stable final destination whenever one is known.
+ return task.finalPath || task.diskPath
+}
- // Indexed BT downloads intentionally live in an internal
- // `.motrix/<workspace>/p` staging tree until finalization. Revealing that
- // path leaks an implementation identifier and disagrees with the target
- // path shown by the Inspector, so user-facing navigation follows the
- // stable final destination whenever one is known.
- const taskPath = task.finalPath || task.diskPath
+export function createRevealInFolderHandler(deps: RevealInFolderDeps) {
+ return async (payload: RevealInFolderPayload): Promise<void> => {
+ const taskPath = resolveOutputPath(deps, payload)
if (
typeof taskPath !== 'string' ||
taskPath.trim() === '' ||
diff --git a/src/renderer/components/desktop-kit/directory-picker.test.tsx b/src/renderer/components/desktop-kit/directory-picker.test.tsx
index bc04be15..6eeaddfd 100644
--- a/src/renderer/components/desktop-kit/directory-picker.test.tsx
+++ b/src/renderer/components/desktop-kit/directory-picker.test.tsx
@@ -4,9 +4,12 @@ import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { FormProvider, useForm } from 'react-hook-form'
import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { DirectoryPicker } from './directory-picker'
+import { DirectoryPicker, type DirectoryPickerProps } from './directory-picker'
const pickSaveDirMock = vi.fn()
+const pickFileMock = vi.fn()
+const getPathForFileMock = vi.fn()
+let localDrop = true
const recordRecentMock = vi.fn().mockResolvedValue(undefined)
vi.mock('@renderer/lib/directory-preferences', () => ({
recordRecentDirectory: (...args: unknown[]) => recordRecentMock(...args),
@@ -23,7 +26,11 @@ vi.mock('./directory-history-menu', () => ({
),
}))
vi.mock('@renderer/platform/services', () => ({
- usePlatformServices: () => ({ pickSaveDir: pickSaveDirMock }),
+ usePlatformServices: () => ({
+ pickSaveDir: pickSaveDirMock,
+ pickFile: pickFileMock,
+ getPathForFile: localDrop ? getPathForFileMock : undefined,
+ }),
}))
interface FormShape {
@@ -32,7 +39,8 @@ interface FormShape {
function Wrapper(props: {
initial: string
- variant: 'compact' | 'input'
+ variant: 'compact' | 'input' | 'file'
+ options?: Partial<DirectoryPickerProps<FormShape>>
showHistory?: boolean
recordRecent?: boolean
onPickingChange?: (picking: boolean) => void
@@ -41,6 +49,7 @@ function Wrapper(props: {
return (
<FormProvider {...form}>
<DirectoryPicker
+ {...props.options}
name="dir"
variant={props.variant}
showHistory={props.showHistory}
@@ -58,6 +67,9 @@ function Wrapper(props: {
describe('<DirectoryPicker>', () => {
beforeEach(() => {
pickSaveDirMock.mockReset()
+ pickFileMock.mockReset()
+ getPathForFileMock.mockReset()
+ localDrop = true
recordRecentMock.mockClear()
})
@@ -173,4 +185,141 @@ describe('<DirectoryPicker>', () => {
expect(screen.getByTestId('value').textContent).toBe('/picked ')
expect(browse).toBeEnabled()
})
+ it('file card selects through the existing picker and keeps the full path', async () => {
+ pickFileMock
+ .mockResolvedValueOnce('/media/new.mp4')
+ .mockResolvedValueOnce(null)
+ render(
+ <Wrapper
+ initial="/media/old.mp4"
+ variant="file"
+ options={{ file: { kind: 'open' }, prefixLabel: 'Video' }}
+ />
+ )
+ const card = screen.getByRole('button', { name: 'Video' })
+ await userEvent.setup().click(card)
+ expect(pickFileMock).toHaveBeenCalledWith({
+ kind: 'open',
+ defaultPath: '/media/old.mp4',
+ })
+ expect(card).toHaveAttribute('title', '/media/new.mp4')
+ expect(screen.getByText('new.mp4')).toBeVisible()
+ expect(screen.getByTestId('dirty')).toHaveTextContent('true')
+ await userEvent.setup().click(card)
+ expect(card).toHaveAttribute('title', '/media/new.mp4')
+ expect(recordRecentMock).not.toHaveBeenCalled()
+ })
+
+ it('resolves a dropped file through the host and stops the global torrent drop handler', () => {
+ const dropped = new File(['clip'], 'clip.MP4')
+ getPathForFileMock.mockReturnValue('/media/clip.MP4')
+ const globalDrop = vi.fn()
+ window.addEventListener('drop', globalDrop)
+ try {
+ render(
+ <Wrapper
+ initial=""
+ variant="file"
+ options={{
+ file: { kind: 'open', extensions: ['mp4'] },
+ allowDrop: true,
+ prefixLabel: 'Video',
+ }}
+ />
+ )
+ fireEvent.drop(screen.getByRole('button', { name: 'Video' }), {
+ dataTransfer: { files: [dropped] },
+ })
+ expect(getPathForFileMock).toHaveBeenCalledWith(dropped)
+ expect(screen.getByTestId('value')).toHaveTextContent('/media/clip.MP4')
+ expect(screen.getByTestId('dirty')).toHaveTextContent('true')
+ expect(globalDrop).not.toHaveBeenCalled()
+ expect(pickFileMock).not.toHaveBeenCalled()
+ expect(recordRecentMock).not.toHaveBeenCalled()
+ } finally {
+ window.removeEventListener('drop', globalDrop)
+ }
+ })
+
+ it.each([
+ ['multiple files', [new File(['a'], 'a.mp4'), new File(['b'], 'b.mp4')]],
+ ['unsupported extension', [new File(['a'], 'a.txt')]],
+ ])('keeps the selection when dropping %s', (_label, files) => {
+ const onPickError = vi.fn()
+ render(
+ <Wrapper
+ initial="/media/keep.mp4"
+ variant="file"
+ options={{
+ file: { kind: 'open', extensions: ['mp4'] },
+ allowDrop: true,
+ prefixLabel: 'Video',
+ onPickError,
+ }}
+ />
+ )
+ fireEvent.drop(screen.getByRole('button', { name: 'Video' }), {
+ dataTransfer: { files },
+ })
+ expect(onPickError).toHaveBeenCalledWith(expect.any(Error))
+ expect(getPathForFileMock).not.toHaveBeenCalled()
+ expect(screen.getByTestId('value')).toHaveTextContent('/media/keep.mp4')
+ })
+
+ it('does not treat a browser file as a server path and still offers server selection', async () => {
+ localDrop = false
+ const onPickError = vi.fn()
+ pickFileMock.mockResolvedValue('/server/clip.mp4')
+ render(
+ <Wrapper
+ initial=""
+ variant="file"
+ options={{
+ file: { kind: 'open' },
+ allowDrop: true,
+ prefixLabel: 'Video',
+ onPickError,
+ }}
+ />
+ )
+ const card = screen.getByRole('button', { name: 'Video' })
+ expect(screen.queryByText(/Drop a file/)).not.toBeInTheDocument()
+ fireEvent.drop(card, {
+ dataTransfer: { files: [new File(['clip'], 'clip.mp4')] },
+ })
+ expect(onPickError).toHaveBeenCalledWith(
+ new Error('Choose a file on the server using this picker.')
+ )
+ expect(screen.getByTestId('value')).toBeEmptyDOMElement()
+ await userEvent.setup().click(card)
+ expect(screen.getByTestId('value')).toHaveTextContent('/server/clip.mp4')
+ })
+
+ it('ignores a disabled drop and reports a missing host path without erasing the selection', () => {
+ const onPickError = vi.fn()
+ const options = {
+ file: { kind: 'open' as const },
+ allowDrop: true,
+ prefixLabel: 'Video',
+ onPickError,
+ }
+ const view = render(
+ <Wrapper
+ initial="/keep.mp4"
+ variant="file"
+ options={{ ...options, disabled: true }}
+ />
+ )
+ const card = screen.getByRole('button', { name: 'Video' })
+ const event = { dataTransfer: { files: [new File(['clip'], 'clip.mp4')] } }
+ fireEvent.drop(card, event)
+ expect(getPathForFileMock).not.toHaveBeenCalled()
+ view.rerender(
+ <Wrapper initial="/keep.mp4" variant="file" options={options} />
+ )
+ getPathForFileMock.mockReturnValue(null)
+ fireEvent.drop(card, event)
+ expect(onPickError).toHaveBeenCalledWith(expect.any(Error))
+ expect(screen.getByTestId('value')).toHaveTextContent('/keep.mp4')
+ })
})
diff --git a/src/renderer/components/desktop-kit/directory-picker.tsx b/src/renderer/components/desktop-kit/directory-picker.tsx
index c3ee8107..6284c881 100644
--- a/src/renderer/components/desktop-kit/directory-picker.tsx
+++ b/src/renderer/components/desktop-kit/directory-picker.tsx
@@ -1,9 +1,24 @@
-import { FolderIcon } from '@renderer/components/icons'
+import {
+ CheckIcon,
+ ChevronRightIcon,
+ FolderIcon,
+ ImportFileIcon,
+} from '@renderer/components/icons'
import { Button } from '@renderer/components/ui/button'
import { Input } from '@renderer/components/ui/input'
+import { useDragDepth } from '@renderer/hooks/use-drag-depth'
import { recordRecentDirectory } from '@renderer/lib/directory-preferences'
+import { cn } from '@renderer/lib/utils'
import { usePlatformServices } from '@renderer/platform/services'
-import { type ComponentProps, useEffect, useRef, useState } from 'react'
+import type { FilePickerOptions } from '@shared/schemas/file-picker'
+import {
+ type ComponentProps,
+ type DragEvent,
+ type ReactNode,
+ useEffect,
+ useRef,
+ useState,
+} from 'react'
import {
type FieldPath,
type FieldValues,
@@ -15,7 +30,7 @@ import { DirectoryHistoryMenu } from './directory-history-menu'
export interface DirectoryPickerProps<TFields extends FieldValues> {
name: FieldPath<TFields>
- variant?: 'compact' | 'input'
+ variant?: 'compact' | 'input' | 'file'
prefixLabel?: string
placeholder?: string
disabled?: boolean
@@ -24,6 +39,14 @@ export interface DirectoryPickerProps<TFields extends FieldValues> {
recordRecent?: boolean
onPickingChange?: (picking: boolean) => void
allowFavoriteEditing?: boolean
+ file?: Omit<FilePickerOptions, 'defaultPath'>
+ browseLabel?: string
+ onPicked?: (path: string) => void
+ onPickError?: (error: unknown) => void
+ allowDrop?: boolean
+ fileIcon?: ReactNode
+ fileIconClassName?: string
+ fileHint?: string
}
export function DirectoryPicker<TFields extends FieldValues>({
@@ -37,9 +60,18 @@ export function DirectoryPicker<TFields extends FieldValues>({
recordRecent = true,
onPickingChange,
allowFavoriteEditing = true,
+ file,
+ browseLabel,
+ onPicked,
+ onPickError,
+ allowDrop = false,
+ fileIcon,
+ fileIconClassName,
+ fileHint,
}: DirectoryPickerProps<TFields>) {
const { t } = useTranslation()
- const { pickSaveDir } = usePlatformServices()
+ const { pickSaveDir, pickFile, getPathForFile, notify } =
+ usePlatformServices()
const mounted = useRef(true)
useEffect(() => {
mounted.current = true
@@ -51,7 +83,47 @@ export function DirectoryPicker<TFields extends FieldValues>({
const current = (useWatch({ control, name }) ?? '') as string
const pickInFlight = useRef(false)
const [isPicking, setIsPicking] = useState(false)
- const pickerDisabled = disabled || isPicking
+ const pickerDisabled = disabled || isPicking || (!!file && !pickFile)
+
+ const reportError = (error: unknown) => {
+ if (onPickError) onPickError(error)
+ else notify('error', 'directoryPicker.errors.unavailable')
+ }
+ const updatePath = (picked: string) => {
+ setValue(name, picked as never, { shouldValidate: true, shouldDirty: true })
+ onPicked?.(picked)
+ if (recordRecent && !file) void recordRecentDirectory(picked)
+ }
+ const canDrop = allowDrop && file?.kind === 'open' && !!getPathForFile
+ const { isDragging, dragHandlers } = useDragDepth<HTMLButtonElement>(
+ (files) => {
+ if (pickerDisabled || pickInFlight.current) return
+ if (!canDrop || !getPathForFile) {
+ reportError(new Error(t('directoryPicker.file.chooseOnServer')))
+ return
+ }
+ try {
+ if (files.length !== 1)
+ throw new Error(t('directoryPicker.file.singleFile'))
+ const selected = files[0]
+ const extension = selected.name.split('.').pop()?.toLowerCase()
+ if (
+ file?.extensions?.length &&
+ !file.extensions.some((ext) => ext.toLowerCase() === extension)
+ )
+ throw new Error(
+ t('directoryPicker.file.wrongType', {
+ extensions: file.extensions.join(', '),
+ })
+ )
+ const picked = getPathForFile(selected)
+ if (!picked) throw new Error(t('directoryPicker.file.pathUnavailable'))
+ updatePath(picked)
+ } catch (error) {
+ reportError(error)
+ }
+ }
+ )
const handlePick = async () => {
if (disabled || pickInFlight.current) return
@@ -60,18 +132,20 @@ export function DirectoryPicker<TFields extends FieldValues>({
setIsPicking(true)
onPickingChange?.(true)
try {
- const picked = allowFavoriteEditing
- ? await pickSaveDir(current || undefined)
- : await pickSaveDir(current || undefined, {
- allowFavoriteEditing: false,
- })
+ const picked = file
+ ? await pickFile?.({ ...file, defaultPath: current || undefined })
+ : allowFavoriteEditing
+ ? await pickSaveDir(current || undefined)
+ : await pickSaveDir(current || undefined, {
+ allowFavoriteEditing: false,
+ })
if (!mounted.current) return
if (picked) {
- setValue(name, picked as never, {
- shouldValidate: true,
- shouldDirty: true,
- })
- if (recordRecent) void recordRecentDirectory(picked)
+ updatePath(picked)
+ }
+ } catch (error) {
+ if (mounted.current) {
+ reportError(error)
}
} finally {
pickInFlight.current = false
@@ -82,18 +156,119 @@ export function DirectoryPicker<TFields extends FieldValues>({
}
}
- const history = showHistory ? (
- <DirectoryHistoryMenu
- currentPath={current}
- disabled={pickerDisabled}
- onSelect={(path) => {
- setValue(name, path as never, {
- shouldValidate: true,
- shouldDirty: true,
- })
- }}
- />
- ) : null
+ const history =
+ showHistory && !file ? (
+ <DirectoryHistoryMenu
+ currentPath={current}
+ disabled={pickerDisabled}
+ onSelect={(path) => {
+ setValue(name, path as never, {
+ shouldValidate: true,
+ shouldDirty: true,
+ })
+ }}
+ />
+ ) : null
+
+ if (variant === 'file') {
+ const divider = Math.max(
+ current.lastIndexOf('/'),
+ current.lastIndexOf('\\')
+ )
+ const filename = current.slice(divider + 1)
+ const directory = current.slice(0, divider + 1)
+ const save = file?.kind === 'save'
+ return (
+ <button
+ type="button"
+ id={inputProps?.id}
+ aria-label={browseLabel ?? prefixLabel}
+ aria-invalid={inputProps?.['aria-invalid']}
+ aria-describedby={inputProps?.['aria-describedby']}
+ title={current || undefined}
+ disabled={pickerDisabled}
+ onClick={handlePick}
+ {...(allowDrop && !save
+ ? {
+ ...dragHandlers,
+ onDrop: (event: DragEvent<HTMLButtonElement>) => {
+ event.stopPropagation()
+ dragHandlers.onDrop(event)
+ },
+ }
+ : {})}
+ className={cn(
+ 'group relative flex w-full min-w-0 gap-2.5 rounded-xl border bg-card p-3 text-start outline-none transition-colors duration-150 hover:border-foreground/25 hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none',
+ save ? 'items-center' : 'min-h-36 flex-col',
+ isDragging &&
+ canDrop &&
+ !pickerDisabled &&
+ 'border-foreground/50 bg-muted ring-2 ring-ring/20',
+ inputProps?.['aria-invalid'] && 'border-destructive'
+ )}
+ >
+ <span className={cn('flex items-center gap-2.5', save && 'shrink-0')}>
+ <span
+ className={cn(
+ 'flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/70 text-muted-foreground [&_svg]:size-5',
+ fileIconClassName
+ )}
+ >
+ {fileIcon ?? <ImportFileIcon aria-hidden />}
+ </span>
+ {!save && (
+ <span className="text-xs font-medium text-muted-foreground">
+ {prefixLabel}
+ </span>
+ )}
+ {!save && current && (
+ <CheckIcon aria-hidden className="ms-auto size-4 text-foreground" />
+ )}
+ </span>
+ <span className="min-w-0 flex-1 space-y-1">
+ {save && (
+ <span className="block text-xs font-medium text-muted-foreground">
+ {prefixLabel}
+ </span>
+ )}
+ <span
+ dir={current ? 'ltr' : undefined}
+ className="block truncate text-sm font-medium"
+ >
+ {filename || placeholder || t('directoryPicker.file.choose')}
+ </span>
+ <span
+ dir={current ? 'ltr' : undefined}
+ className="block truncate text-xs leading-5 text-muted-foreground"
+ >
+ {directory ||
+ fileHint ||
+ t(
+ canDrop
+ ? 'directoryPicker.file.dropHint'
+ : 'directoryPicker.file.browseHint'
+ )}
+ </span>
+ </span>
+ {save ? (
+ <ChevronRightIcon
+ aria-hidden
+ className="size-4 shrink-0 text-muted-foreground"
+ />
+ ) : (
+ <span className="text-xs font-medium text-foreground">
+ {t(
+ current
+ ? 'directoryPicker.file.change'
+ : canDrop
+ ? 'directoryPicker.file.dropHint'
+ : 'directoryPicker.file.choose'
+ )}
+ </span>
+ )}
+ </button>
+ )
+ }
if (variant === 'compact') {
return (
@@ -101,7 +276,7 @@ export function DirectoryPicker<TFields extends FieldValues>({
<button
type="button"
onClick={handlePick}
- aria-label={t('settings.common.changeDirectory')}
+ aria-label={browseLabel ?? t('settings.common.changeDirectory')}
title={current || undefined}
disabled={pickerDisabled}
className="group flex min-w-0 flex-1 items-center gap-2.5 rounded-md border border-border bg-background px-3 py-2 text-start text-sm transition-colors hover:border-ring hover:bg-accent/30 disabled:opacity-50"
@@ -152,6 +327,7 @@ export function DirectoryPicker<TFields extends FieldValues>({
size="sm"
onClick={handlePick}
disabled={pickerDisabled}
+ aria-label={browseLabel}
>
<FolderIcon className="me-1 h-3 w-3" />
{t('settings.common.browse')}
diff --git a/src/renderer/features/media-merge/media-merge-dialog.test.tsx b/src/renderer/features/media-merge/media-merge-dialog.test.tsx
new file mode 100644
index 00000000..42ce5964
--- /dev/null
+++ b/src/renderer/features/media-merge/media-merge-dialog.test.tsx
@@ -0,0 +1,415 @@
+import '@testing-library/jest-dom/vitest'
+import '@renderer/lib/i18n'
+import { transport } from '@renderer/lib/transport'
+import { electronServices } from '@renderer/platform/electron-services'
+import { PlatformServicesProvider } from '@renderer/platform/services'
+import { Commands } from '@shared/protocol/commands'
+import {
+ act,
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@testing-library/react'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { MediaMergeDialogHost } from './media-merge-dialog'
+import { MediaMergeForm } from './media-merge-form'
+import { useMediaMergeDialog, useMediaMergeSessions } from './media-merge-store'
+
+vi.mock('@renderer/lib/transport', () => ({ transport: { invoke: vi.fn() } }))
+const invoke = vi.mocked(transport.invoke)
+const pluginId = 'community.media-merge'
+const inputs = {
+ videoInput: '/downloads/video.mp4',
+ audioInput: '/downloads/audio.mp4',
+ output: '/downloads/merged.mp4',
+}
+const job = {
+ pluginId,
+ id: '04f56840-f5af-4960-884e-72b7cd15781a',
+ status: 'running',
+ percent: 0,
+ output: inputs.output,
+}
+
+describe('manual media merge dialog', () => {
+ beforeEach(() => {
+ useMediaMergeSessions.setState({ sessions: {} })
+ useMediaMergeDialog.setState({ open: false, request: {} })
+ invoke.mockReset().mockImplementation(async (command) => {
+ if (command === Commands.GetMediaMergeState)
+ return { providers: [{ pluginId, title: 'Media Merge' }], job: null }
+ if (command === Commands.GetMediaMergeSelection) return inputs
+ if (command === Commands.StartMediaMerge) return job
+ if (command === Commands.GetMediaMergeJob)
+ return { ...job, status: 'completed', percent: 100 }
+ if (command === Commands.CancelMediaMerge)
+ return { ...job, status: 'cancelled' }
+ return null
+ })
+ })
+ afterEach(() => {
+ vi.unstubAllGlobals()
+ cleanup()
+ useMediaMergeSessions.setState({ sessions: {} })
+ useMediaMergeDialog.setState({ open: false, request: {} })
+ })
+
+ it('pre-fills completed downloads, runs once, and shows the output', async () => {
+ render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeDialogHost />
+ </PlatformServicesProvider>
+ )
+ act(() =>
+ useMediaMergeDialog.getState().openWith({ taskIds: ['video', 'audio'] })
+ )
+ await waitFor(() =>
+ expect(
+ screen.getByRole('button', { name: 'Browse Video file' })
+ ).toHaveAttribute('title', inputs.videoInput)
+ )
+ fireEvent.click(screen.getByRole('button', { name: 'Merge' }))
+ await screen.findByText('Merged successfully')
+ expect(invoke).toHaveBeenCalledWith(Commands.GetMediaMergeSelection, [
+ 'video',
+ 'audio',
+ ])
+ expect(invoke).toHaveBeenCalledWith(Commands.StartMediaMerge, {
+ ...inputs,
+ pluginId,
+ })
+ expect(screen.getByText(inputs.output)).toBeVisible()
+ fireEvent.click(screen.getByRole('button', { name: 'Open folder' }))
+ await waitFor(() =>
+ expect(invoke).toHaveBeenCalledWith(Commands.RevealInFolder, {
+ mediaMergeJobId: job.id,
+ })
+ )
+ expect(
+ screen.getByRole('button', { name: 'Merge another file' })
+ ).toBeEnabled()
+ })
+
+ it('selects local files and suggests a new output filename', async () => {
+ const base = invoke.getMockImplementation()!
+ invoke.mockImplementation(async (command, ...args) =>
+ command === Commands.PickFile ? inputs.videoInput : base(command, ...args)
+ )
+ render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeDialogHost />
+ </PlatformServicesProvider>
+ )
+ act(() => useMediaMergeDialog.getState().openWith({ pluginId }))
+ const browse = await screen.findByRole('button', {
+ name: 'Browse Video file',
+ })
+ await waitFor(() => expect(browse).toBeEnabled())
+ fireEvent.click(browse)
+ await waitFor(() =>
+ expect(
+ screen.getByRole('button', { name: 'Browse Video file' })
+ ).toHaveAttribute('title', inputs.videoInput)
+ )
+ expect(
+ screen.getByRole('button', { name: 'Browse Output file' })
+ ).toHaveAttribute('title', '/downloads/video-merged.mp4')
+ })
+
+ it('allows cancellation and reports the terminal cancelled state', async () => {
+ const base = invoke.getMockImplementation()!
+ invoke.mockImplementation(async (command, ...args) =>
+ command === Commands.GetMediaMergeJob ? job : base(command, ...args)
+ )
+ render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeDialogHost />
+ </PlatformServicesProvider>
+ )
+ act(() =>
+ useMediaMergeDialog.getState().openWith({ taskIds: ['video', 'audio'] })
+ )
+ await waitFor(() =>
+ expect(
+ screen.getByRole('button', { name: 'Browse Video file' })
+ ).toHaveAttribute('title', inputs.videoInput)
+ )
+ fireEvent.click(screen.getByRole('button', { name: 'Merge' }))
+ expect(screen.queryByRole('button', { name: 'Open folder' })).toBeNull()
+ fireEvent.click(await screen.findByRole('button', { name: 'Cancel' }))
+ await screen.findByText('Merge cancelled')
+ expect(invoke).toHaveBeenCalledWith(Commands.CancelMediaMerge, job.id)
+ })
+
+ it('explains the missing plugin and prevents submission', async () => {
+ invoke.mockResolvedValue({ providers: [], job: null })
+ render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeDialogHost />
+ </PlatformServicesProvider>
+ )
+ act(() => useMediaMergeDialog.getState().openWith())
+ await screen.findByText(/Install and enable a media merge plugin/)
+ expect(screen.getByRole('button', { name: 'Merge' })).toBeDisabled()
+ })
+ it('keeps a completed output visible and reports a folder-opening failure', async () => {
+ useMediaMergeSessions.getState().save(pluginId, {
+ values: { ...inputs, pluginId },
+ job: { ...job, status: 'completed' },
+ })
+ const base = invoke.getMockImplementation()!
+ invoke.mockImplementation(async (command, ...args) => {
+ if (command === Commands.RevealInFolder)
+ throw new Error('Folder is unavailable')
+ return base(command, ...args)
+ })
+ render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeForm pluginId={pluginId} />
+ </PlatformServicesProvider>
+ )
+ fireEvent.click(await screen.findByRole('button', { name: 'Open folder' }))
+ expect(await screen.findByRole('alert')).toHaveTextContent(
+ 'Folder is unavailable'
+ )
+ expect(screen.getByText(inputs.output)).toBeVisible()
+ expect(screen.getByRole('button', { name: 'Open folder' })).toBeEnabled()
+ })
+
+ it('does not offer a local folder action for a Server output', async () => {
+ vi.stubGlobal('__MOTRIX_TARGET__', 'web')
+ useMediaMergeSessions.getState().save(pluginId, {
+ values: { ...inputs, pluginId },
+ job: { ...job, status: 'completed' },
+ })
+ render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeForm pluginId={pluginId} />
+ </PlatformServicesProvider>
+ )
+ await screen.findByText('Merged successfully')
+ expect(screen.getByText(inputs.output)).toBeVisible()
+ expect(screen.queryByRole('button', { name: 'Open folder' })).toBeNull()
+ expect(invoke).not.toHaveBeenCalledWith(
+ Commands.RevealInFolder,
+ expect.anything()
+ )
+ })
+ it('restores an operation draft and retrieves its completed job after leaving the page', async () => {
+ useMediaMergeSessions.getState().save(pluginId, {
+ values: { ...inputs, pluginId },
+ job: { ...job, status: 'running' },
+ })
+ render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeForm pluginId={pluginId} />
+ </PlatformServicesProvider>
+ )
+ await screen.findByText('Merged successfully')
+ expect(
+ screen.getByRole('button', { name: 'Browse Video file' })
+ ).toHaveAttribute('title', inputs.videoInput)
+ expect(invoke).toHaveBeenCalledWith(Commands.GetMediaMergeJob, job.id)
+ fireEvent.click(screen.getByRole('button', { name: 'Merge another file' }))
+ expect(
+ screen.getByRole('button', { name: 'Browse Output file' })
+ ).not.toHaveAttribute('title')
+ expect(
+ screen.getByRole('button', { name: 'Browse Audio file' })
+ ).toHaveAttribute('title', inputs.audioInput)
+ expect(screen.getByRole('button', { name: 'Merge' })).toBeVisible()
+ expect(useMediaMergeSessions.getState().sessions[pluginId].job).toBeNull()
+ })
+
+ it('does not show another plugin’s job as its own or allow cancellation of it', async () => {
+ const otherJob = { ...job, pluginId: 'other.merger' }
+ invoke.mockImplementation(async (command) => {
+ if (command === Commands.GetMediaMergeState)
+ return {
+ providers: [{ pluginId, title: 'Media Merge' }],
+ job: otherJob,
+ }
+ if (command === Commands.GetMediaMergeJob) return otherJob
+ return null
+ })
+ render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeForm pluginId={pluginId} />
+ </PlatformServicesProvider>
+ )
+ await screen.findByText('Another merge is already running.')
+ expect(screen.queryByRole('button', { name: 'Cancel' })).toBeNull()
+ expect(screen.getByRole('button', { name: 'Merge' })).toBeDisabled()
+ })
+
+ it('refreshes availability when the plugin is enabled without losing chosen inputs', async () => {
+ useMediaMergeSessions
+ .getState()
+ .save(pluginId, { values: { ...inputs, pluginId } })
+ const view = render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeForm pluginId={pluginId} enabled={false} />
+ </PlatformServicesProvider>
+ )
+ await screen.findByText('Enable this plugin to merge files.')
+ view.rerender(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeForm pluginId={pluginId} enabled />
+ </PlatformServicesProvider>
+ )
+ await waitFor(() =>
+ expect(screen.getByRole('button', { name: 'Merge' })).toBeEnabled()
+ )
+ expect(
+ screen.getByRole('button', { name: 'Browse Video file' })
+ ).toHaveAttribute('title', inputs.videoInput)
+ })
+ it('keeps the job handle when navigation happens while starting the merge', async () => {
+ useMediaMergeSessions
+ .getState()
+ .save(pluginId, { values: { ...inputs, pluginId } })
+ let finish!: (value: typeof job) => void
+ const pending = new Promise<typeof job>((resolve) => {
+ finish = resolve
+ })
+ const base = invoke.getMockImplementation()!
+ invoke.mockImplementation((command, ...args) =>
+ command === Commands.StartMediaMerge ? pending : base(command, ...args)
+ )
+ const view = render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeForm pluginId={pluginId} />
+ </PlatformServicesProvider>
+ )
+ await waitFor(() =>
+ expect(screen.getByRole('button', { name: 'Merge' })).toBeEnabled()
+ )
+ fireEvent.click(screen.getByRole('button', { name: 'Merge' }))
+ await waitFor(() =>
+ expect(invoke).toHaveBeenCalledWith(Commands.StartMediaMerge, {
+ ...inputs,
+ pluginId,
+ })
+ )
+ view.unmount()
+ await act(async () => {
+ finish(job)
+ await pending
+ })
+ expect(useMediaMergeSessions.getState().sessions[pluginId].job?.id).toBe(
+ job.id
+ )
+ })
+ it('changes only the output extension and submits the chosen format', async () => {
+ useMediaMergeSessions.getState().save(pluginId, {
+ values: {
+ ...inputs,
+ output: '/downloads/my.movie.final.MP4',
+ pluginId,
+ },
+ })
+ render(
+ <PlatformServicesProvider services={electronServices}>
+ <MediaMergeForm pluginId={pluginId} />
+ </PlatformServicesProvider>
+ )
+ const mkv = screen.getByRole('button', { name: 'MKV' })
+ await waitFor(() => expect(mkv).toBeEnabled())
+ expect(screen.getByRole('button', { name: 'MP4' })).toHaveAttribute(
+ 'aria-pressed',
+ 'true'
+ )
+ fireEvent.click(mkv)
+ expect(mkv).toHaveAttribute('aria-pressed', 'true')
+ expect(
+ screen.getByRole('button', { name: 'Browse Output file' })
+ ).toHaveAttribute('title', '/downloads/my.movie.final.mkv')
+ fireEvent.click(mkv)
+ expect(mkv).toHaveAttribute('aria-pressed', 'true')
+ fireEvent.click(screen.getByRole('button', { name: 'Merge' }))
+ await screen.findByText('Merged successfully')
+ expect(invoke).toHaveBeenCalledWith(Commands.StartMediaMerge, {
+ ...inputs,
+ output: '/downloads/my.movie.final.mkv',
+ pluginId,
+ })
+ expect(mkv).toBeDisabled()
+ })
+
+ it('remembers a format chosen before files and uses it for dropped video and the save picker', async () => {
+ const services = {
+ ...electronServices,
+ getPathForFile: vi.fn(() => '/downloads/clip.mp4'),
+ pickFile: vi.fn(async () => null),
+ }
+ const view = render(
+ <PlatformServicesProvider services={services}>
+ <MediaMergeForm pluginId={pluginId} />
+ </PlatformServicesProvider>
+ )
+ const mkv = screen.getByRole('button', { name: 'MKV' })
+ await waitFor(() => expect(mkv).toBeEnabled())
+ fireEvent.click(mkv)
+ view.unmount()
+ render(
+ <PlatformServicesProvider services={services}>
+ <MediaMergeForm pluginId={pluginId} />
+ </PlatformServicesProvider>
+ )
+ const video = screen.getByRole('button', { name: 'Browse Video file' })
+ await waitFor(() => expect(video).toBeEnabled())
+ expect(screen.getByRole('button', { name: 'MKV' })).toHaveAttribute(
+ 'aria-pressed',
+ 'true'
+ )
+ const file = new File(['video'], 'clip.mp4')
+ fireEvent.drop(video, { dataTransfer: { files: [file] } })
+ expect(services.getPathForFile).toHaveBeenCalledWith(file)
+ expect(video).toHaveAttribute('title', '/downloads/clip.mp4')
+ const output = screen.getByRole('button', { name: 'Browse Output file' })
+ expect(output).toHaveAttribute('title', '/downloads/clip-merged.mkv')
+ fireEvent.click(output)
+ await waitFor(() =>
+ expect(services.pickFile).toHaveBeenCalledWith({
+ kind: 'save',
+ defaultPath: '/downloads/clip-merged.mkv',
+ extensions: ['mkv'],
+ })
+ )
+ expect(invoke).not.toHaveBeenCalledWith(
+ Commands.StartMediaMerge,
+ expect.anything()
+ )
+ })
+
+ it('restores the format from a saved output path and synchronizes with a newly selected filename', async () => {
+ useMediaMergeSessions.getState().save(pluginId, {
+ values: { ...inputs, output: '/downloads/old.mkv', pluginId },
+ })
+ const services = {
+ ...electronServices,
+ pickFile: vi.fn(async () => '/downloads/new.mp4'),
+ }
+ render(
+ <PlatformServicesProvider services={services}>
+ <MediaMergeForm pluginId={pluginId} />
+ </PlatformServicesProvider>
+ )
+ const output = screen.getByRole('button', { name: 'Browse Output file' })
+ await waitFor(() => expect(output).toBeEnabled())
+ expect(screen.getByRole('button', { name: 'MKV' })).toHaveAttribute(
+ 'aria-pressed',
+ 'true'
+ )
+ fireEvent.click(output)
+ await waitFor(() =>
+ expect(screen.getByRole('button', { name: 'MP4' })).toHaveAttribute(
+ 'aria-pressed',
+ 'true'
+ )
+ )
+ expect(output).toHaveAttribute('title', '/downloads/new.mp4')
+ })
+})
diff --git a/src/renderer/features/media-merge/media-merge-dialog.tsx b/src/renderer/features/media-merge/media-merge-dialog.tsx
new file mode 100644
index 00000000..60157272
--- /dev/null
+++ b/src/renderer/features/media-merge/media-merge-dialog.tsx
@@ -0,0 +1,38 @@
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+} from '@renderer/components/ui/dialog'
+import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { MediaMergeForm } from './media-merge-form'
+import { useMediaMergeDialog } from './media-merge-store'
+
+export function MediaMergeDialogHost() {
+ const { open, request, close } = useMediaMergeDialog()
+ const { t } = useTranslation()
+ const [busy, setBusy] = useState(false)
+ return (
+ <Dialog
+ open={open}
+ onOpenChange={(next) => {
+ if (!next && !busy) close()
+ }}
+ >
+ <DialogContent
+ className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-xl"
+ showCloseButton={!busy}
+ >
+ <DialogHeader>
+ <DialogTitle>{t('mediaMerge.title')}</DialogTitle>
+ <DialogDescription>{t('mediaMerge.description')}</DialogDescription>
+ </DialogHeader>
+ {open && (
+ <MediaMergeForm {...request} onClose={close} onBusyChange={setBusy} />
+ )}
+ </DialogContent>
+ </Dialog>
+ )
+}
diff --git a/src/renderer/features/media-merge/media-merge-form.tsx b/src/renderer/features/media-merge/media-merge-form.tsx
new file mode 100644
index 00000000..1af1561c
--- /dev/null
+++ b/src/renderer/features/media-merge/media-merge-form.tsx
@@ -0,0 +1,496 @@
+import { zodResolver } from '@hookform/resolvers/zod'
+import { DirectoryPicker } from '@renderer/components/desktop-kit/directory-picker'
+import {
+ AudioIcon,
+ CheckIcon,
+ FolderIcon,
+ RevealFolderIcon,
+ VideoIcon,
+} from '@renderer/components/icons'
+import { Button } from '@renderer/components/ui/button'
+import { Label } from '@renderer/components/ui/label'
+import { Progress } from '@renderer/components/ui/progress'
+import {
+ ToggleGroup,
+ ToggleGroupItem,
+} from '@renderer/components/ui/toggle-group'
+import { transport } from '@renderer/lib/transport'
+import { Commands } from '@shared/protocol/commands'
+import {
+ type MediaMergeArgs,
+ type MediaMergeJob,
+ type MediaMergeProvider,
+ type MediaMergeStart,
+ mediaMergeStartSchema,
+} from '@shared/schemas/manual-media-merge'
+import { useEffect, useId, useState } from 'react'
+import { FormProvider, useForm } from 'react-hook-form'
+import { useTranslation } from 'react-i18next'
+import { useMediaMergeSessions } from './media-merge-store'
+
+interface Props {
+ pluginId?: string
+ taskIds?: string[]
+ enabled?: boolean
+ onClose?: () => void
+ onBusyChange?: (busy: boolean) => void
+}
+
+export function MediaMergeForm({
+ pluginId,
+ taskIds,
+ enabled = true,
+ onClose,
+ onBusyChange,
+}: Props) {
+ const id = useId()
+ const sessionKey = pluginId ?? 'download-selection'
+ const [initial] = useState(
+ () => useMediaMergeSessions.getState().sessions[sessionKey]
+ )
+ const { t } = useTranslation()
+ const [providers, setProviders] = useState<MediaMergeProvider[]>([])
+ const [job, setJob] = useState<MediaMergeJob | null>(null)
+ const [loading, setLoading] = useState(true)
+ const [picking, setPicking] = useState(false)
+ const [revealing, setRevealing] = useState(false)
+ const [error, setError] = useState('')
+ const [preferredFormat, setPreferredFormat] = useState<'mp4' | 'mkv'>(
+ initial?.format ?? 'mp4'
+ )
+ const form = useForm<MediaMergeStart>({
+ resolver: zodResolver(mediaMergeStartSchema),
+ defaultValues: initial?.values ?? {
+ pluginId: pluginId ?? '',
+ videoInput: '',
+ audioInput: '',
+ output: '',
+ },
+ })
+ const running = job?.status === 'running' || job?.status === 'cancelling'
+ const busy = loading || form.formState.isSubmitting || picking || running
+ const selectedPlugin = form.watch('pluginId')
+ const ready =
+ !!form.watch('videoInput') &&
+ !!form.watch('audioInput') &&
+ !!form.watch('output')
+ const outputPath = form.watch('output')
+ const format = /\.mkv$/i.test(outputPath)
+ ? 'mkv'
+ : /\.mp4$/i.test(outputPath)
+ ? 'mp4'
+ : preferredFormat
+ useEffect(() => {
+ useMediaMergeSessions.getState().save(sessionKey, { format })
+ }, [format, sessionKey])
+ const foreignJob = !!pluginId && !!job && job.pluginId !== pluginId
+ const available =
+ enabled &&
+ providers.some((provider) => provider.pluginId === selectedPlugin)
+
+ useEffect(() => onBusyChange?.(busy), [busy, onBusyChange])
+ useEffect(() => {
+ const subscription = form.watch(() => {
+ useMediaMergeSessions
+ .getState()
+ .save(sessionKey, { values: form.getValues() })
+ })
+ return () => subscription.unsubscribe()
+ }, [form, sessionKey])
+ useEffect(() => {
+ if (job && !foreignJob)
+ useMediaMergeSessions.getState().save(sessionKey, { job })
+ }, [job, foreignJob, sessionKey])
+
+ useEffect(() => {
+ let stale = false
+ setLoading(true)
+ setError('')
+ setJob(null)
+ const saved = useMediaMergeSessions.getState().sessions[sessionKey]
+ void Promise.all([
+ transport.invoke(Commands.GetMediaMergeState) as Promise<{
+ providers: MediaMergeProvider[]
+ job: MediaMergeJob | null
+ }>,
+ taskIds
+ ? (transport.invoke(
+ Commands.GetMediaMergeSelection,
+ taskIds
+ ) as Promise<MediaMergeArgs>)
+ : Promise.resolve(
+ saved?.values ?? { videoInput: '', audioInput: '', output: '' }
+ ),
+ saved?.job && !taskIds
+ ? (transport
+ .invoke(Commands.GetMediaMergeJob, saved.job.id)
+ .catch(() => null) as Promise<MediaMergeJob | null>)
+ : Promise.resolve(null),
+ ])
+ .then(([state, inputs, previousJob]) => {
+ if (stale) return
+ setProviders(enabled ? state.providers : [])
+ setJob(state.job ?? previousJob)
+ form.reset({
+ ...inputs,
+ pluginId:
+ pluginId ??
+ (state.providers.some(
+ (provider) => provider.pluginId === saved?.values?.pluginId
+ )
+ ? saved?.values?.pluginId
+ : state.providers[0]?.pluginId) ??
+ '',
+ })
+ })
+ .catch((cause: unknown) => {
+ if (!stale)
+ setError(cause instanceof Error ? cause.message : String(cause))
+ })
+ .finally(() => {
+ if (!stale) setLoading(false)
+ })
+ return () => {
+ stale = true
+ }
+ }, [pluginId, taskIds, enabled, form, sessionKey])
+
+ const jobId = job?.id
+ useEffect(() => {
+ if (!jobId || !running) return
+ let stale = false
+ let timer: ReturnType<typeof setTimeout>
+ const poll = async () => {
+ try {
+ const next = (await transport.invoke(
+ Commands.GetMediaMergeJob,
+ jobId
+ )) as MediaMergeJob
+ if (!stale) {
+ setJob(next)
+ setError('')
+ }
+ } catch (cause) {
+ if (!stale)
+ setError(cause instanceof Error ? cause.message : String(cause))
+ } finally {
+ if (!stale) timer = setTimeout(poll, 500)
+ }
+ }
+ void poll()
+ return () => {
+ stale = true
+ clearTimeout(timer)
+ }
+ }, [jobId, running])
+
+ const submit = form.handleSubmit(async (values) => {
+ if (!available || busy) return
+ setError('')
+ try {
+ const next = (await transport.invoke(
+ Commands.StartMediaMerge,
+ values
+ )) as MediaMergeJob
+ // Navigation can unmount the form before this reply. Keep the handle
+ // immediately so a later visit can still retrieve the completed result.
+ useMediaMergeSessions.getState().save(sessionKey, { values, job: next })
+ setJob(next)
+ } catch (cause) {
+ setError(cause instanceof Error ? cause.message : String(cause))
+ }
+ })
+ const cancel = async () => {
+ if (!job) return
+ try {
+ setJob(
+ (await transport.invoke(
+ Commands.CancelMediaMerge,
+ job.id
+ )) as MediaMergeJob
+ )
+ } catch (cause) {
+ setError(cause instanceof Error ? cause.message : String(cause))
+ }
+ }
+ const message = error || (foreignJob ? undefined : job?.error)
+ const errorKey = message?.match(/^mediaMerge\.(\w+)$/)?.[1]
+
+ return (
+ <FormProvider {...form}>
+ <form onSubmit={submit} className="space-y-3">
+ {!loading && !available && (
+ <p role="status" className="text-sm">
+ {t(!enabled ? 'mediaMerge.pluginDisabled' : 'mediaMerge.noPlugin')}
+ </p>
+ )}
+ {!pluginId && providers.length > 1 && (
+ <div className="space-y-2">
+ <Label htmlFor={`${id}-provider`}>{t('mediaMerge.provider')}</Label>
+ <select
+ id={`${id}-provider`}
+ {...form.register('pluginId')}
+ disabled={busy || !enabled}
+ className="h-8 w-full rounded-md border bg-background px-2 text-sm"
+ >
+ {providers.map((provider) => (
+ <option key={provider.pluginId} value={provider.pluginId}>
+ {provider.title}
+ </option>
+ ))}
+ </select>
+ </div>
+ )}
+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ {(['videoInput', 'audioInput', 'output'] as const).map((field) => {
+ const output = field === 'output'
+ return (
+ <div
+ key={field}
+ className={
+ output
+ ? 'space-y-2 sm:col-span-2 sm:mt-1'
+ : 'min-w-0 space-y-2'
+ }
+ >
+ {output && (
+ <div className="flex items-center justify-between gap-3 px-1">
+ <span
+ id={`${id}-format-label`}
+ className="text-xs font-medium text-muted-foreground"
+ >
+ {t('mediaMerge.format')}
+ </span>
+ <ToggleGroup
+ aria-labelledby={`${id}-format-label`}
+ value={[format]}
+ disabled={
+ busy ||
+ !available ||
+ (job?.status === 'completed' && !foreignJob)
+ }
+ onValueChange={(values) => {
+ const next = values[0]
+ if (next !== 'mp4' && next !== 'mkv') return
+ setPreferredFormat(next)
+ setError('')
+ if (outputPath)
+ form.setValue(
+ 'output',
+ `${outputPath.replace(/\.[^./\\]+$/, '')}.${next}`,
+ { shouldDirty: true, shouldValidate: true }
+ )
+ }}
+ >
+ <ToggleGroupItem type="button" value="mp4">
+ MP4
+ </ToggleGroupItem>
+ <ToggleGroupItem type="button" value="mkv">
+ MKV
+ </ToggleGroupItem>
+ </ToggleGroup>
+ </div>
+ )}
+ <DirectoryPicker
+ name={field}
+ variant="file"
+ file={{
+ kind: output ? 'save' : 'open',
+ ...(output ? { extensions: [format] } : {}),
+ }}
+ allowDrop={!output}
+ onPickError={(cause) =>
+ setError(
+ cause instanceof Error ? cause.message : String(cause)
+ )
+ }
+ prefixLabel={t(`mediaMerge.${field}`)}
+ placeholder={t(`mediaMerge.choose.${field}`)}
+ fileHint={t(`mediaMerge.hint.${field}`)}
+ fileIconClassName={
+ output
+ ? 'bg-amber-50 text-amber-600 dark:bg-amber-500/10 dark:text-amber-400'
+ : field === 'videoInput'
+ ? 'bg-blue-50 text-blue-600 dark:bg-blue-500/10 dark:text-blue-400'
+ : 'bg-violet-50 text-violet-600 dark:bg-violet-500/10 dark:text-violet-400'
+ }
+ fileIcon={
+ output ? (
+ <FolderIcon aria-hidden />
+ ) : field === 'videoInput' ? (
+ <VideoIcon aria-hidden />
+ ) : (
+ <AudioIcon aria-hidden />
+ )
+ }
+ inputProps={{
+ id: `${id}-${field}`,
+ 'aria-invalid': !!form.formState.errors[field],
+ 'aria-describedby': form.formState.errors[field]
+ ? `${id}-${field}-error`
+ : undefined,
+ }}
+ browseLabel={t('mediaMerge.browseField', {
+ field: t(`mediaMerge.${field}`),
+ })}
+ disabled={
+ busy ||
+ !available ||
+ (job?.status === 'completed' && !foreignJob)
+ }
+ onPickingChange={setPicking}
+ onPicked={(picked) => {
+ setError('')
+ if (field === 'videoInput' && !form.getValues('output'))
+ form.setValue(
+ 'output',
+ `${picked.replace(/\.[^./\\]+$/, '')}-merged.${format}`,
+ { shouldDirty: true }
+ )
+ }}
+ />
+ {form.formState.errors[field] && (
+ <p
+ id={`${id}-${field}-error`}
+ className="text-xs text-destructive"
+ >
+ {t('mediaMerge.required')}
+ </p>
+ )}
+ </div>
+ )
+ })}
+ </div>
+ <p className="px-1 text-xs leading-5 text-muted-foreground">
+ {t(
+ __MOTRIX_TARGET__ === 'web'
+ ? 'mediaMerge.serverPaths'
+ : 'mediaMerge.outputHint'
+ )}
+ </p>
+ {job && !foreignJob && (
+ <div
+ className="space-y-3 rounded-xl border bg-card p-4"
+ role="status"
+ >
+ <div className="flex items-center gap-2">
+ {job.status === 'completed' && (
+ <CheckIcon
+ aria-hidden
+ className="size-4 text-green-600 dark:text-green-400"
+ />
+ )}
+ <p className="text-sm font-medium">
+ {t(`mediaMerge.${job.status}`)}
+ </p>
+ {running && job.percent != null && (
+ <span className="ms-auto text-xs tabular-nums text-muted-foreground">
+ {Math.round(job.percent)}%
+ </span>
+ )}
+ </div>
+ {running && (
+ <Progress
+ value={job.percent ?? undefined}
+ aria-label={t('mediaMerge.running')}
+ />
+ )}
+ {job.status === 'completed' && (
+ <div className="flex flex-wrap items-center gap-2">
+ <p className="min-w-0 break-all text-xs text-muted-foreground">
+ {job.output}
+ </p>
+ {__MOTRIX_TARGET__ === 'electron' && (
+ <Button
+ type="button"
+ size="xs"
+ variant="outline"
+ disabled={revealing}
+ onClick={async () => {
+ setRevealing(true)
+ setError('')
+ try {
+ await transport.invoke(Commands.RevealInFolder, {
+ mediaMergeJobId: job.id,
+ })
+ } catch (cause) {
+ setError(
+ cause instanceof Error ? cause.message : String(cause)
+ )
+ } finally {
+ setRevealing(false)
+ }
+ }}
+ >
+ <RevealFolderIcon />
+ {t('panel.downloads.action.openFolder')}
+ </Button>
+ )}
+ </div>
+ )}
+ </div>
+ )}
+ {foreignJob && running && (
+ <p role="status" className="text-sm">
+ {t('mediaMerge.busy')}
+ </p>
+ )}
+ {message && (
+ <p role="alert" className="break-words text-sm text-destructive">
+ {errorKey ? t(`mediaMerge.${errorKey}`) : message}
+ </p>
+ )}
+ <div className="flex flex-wrap items-center justify-end gap-2 pt-1">
+ <p className="me-auto text-xs text-muted-foreground">
+ {t('mediaMerge.preserveOriginals')}
+ </p>
+ {running && !foreignJob ? (
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ onClick={() => void cancel()}
+ disabled={job?.status === 'cancelling'}
+ >
+ {t('common.cancel')}
+ </Button>
+ ) : onClose ? (
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ onClick={onClose}
+ disabled={busy}
+ >
+ {t('common.close')}
+ </Button>
+ ) : null}
+ {job?.status === 'completed' && !foreignJob ? (
+ <Button
+ type="button"
+ size="sm"
+ disabled={busy || !available}
+ onClick={() => {
+ setJob(null)
+ setError('')
+ setPreferredFormat(format)
+ form.setValue('output', '', { shouldDirty: true })
+ useMediaMergeSessions.getState().save(sessionKey, { job: null })
+ }}
+ >
+ {t('mediaMerge.again')}
+ </Button>
+ ) : (
+ <Button
+ type="submit"
+ size="sm"
+ disabled={busy || !available || !ready}
+ >
+ {t('mediaMerge.start')}
+ </Button>
+ )}
+ </div>
+ </form>
+ </FormProvider>
+ )
+}
diff --git a/src/renderer/features/media-merge/media-merge-store.ts b/src/renderer/features/media-merge/media-merge-store.ts
new file mode 100644
index 00000000..61e48ddb
--- /dev/null
+++ b/src/renderer/features/media-merge/media-merge-store.ts
@@ -0,0 +1,40 @@
+import type {
+ MediaMergeJob,
+ MediaMergeStart,
+} from '@shared/schemas/manual-media-merge'
+import { create } from 'zustand'
+
+interface MediaMergeDialogState {
+ open: boolean
+ request: { pluginId?: string; taskIds?: string[] }
+ openWith(request?: MediaMergeDialogState['request']): void
+ close(): void
+}
+
+export const useMediaMergeDialog = create<MediaMergeDialogState>((set) => ({
+ open: false,
+ request: {},
+ openWith: (request = {}) => set({ open: true, request }),
+ close: () => set({ open: false }),
+}))
+
+interface Session {
+ format?: 'mp4' | 'mkv'
+ values?: MediaMergeStart
+ job?: MediaMergeJob | null
+}
+
+/** Drafts are local to this renderer; job status is refreshed from the host. */
+export const useMediaMergeSessions = create<{
+ sessions: Record<string, Session>
+ save(key: string, patch: Session): void
+}>((set) => ({
+ sessions: {},
+ save: (key, patch) =>
+ set((state) => ({
+ sessions: {
+ ...state.sessions,
+ [key]: { ...state.sessions[key], ...patch },
+ },
+ })),
+}))
diff --git a/src/renderer/features/web-directory-picker/directory-picker-controller.test.ts b/src/renderer/features/web-directory-picker/directory-picker-controller.test.ts
index a859a051..5c58125f 100644
--- a/src/renderer/features/web-directory-picker/directory-picker-controller.test.ts
+++ b/src/renderer/features/web-directory-picker/directory-picker-controller.test.ts
@@ -3,6 +3,7 @@ import type { Transport } from '@renderer/lib/transport/types'
import { Commands } from '@shared/protocol/commands'
import { Events } from '@shared/protocol/events'
import { Queries } from '@shared/protocol/queries'
+import type { FilePickerOptions } from '@shared/schemas/file-picker'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import {
DIRECTORY_OPERATION_TIMEOUT,
@@ -41,7 +42,10 @@ const failure = (code: string) => ({ ok: false, error: { code } })
const flush = () => vi.advanceTimersByTimeAsync(0)
const controllers: DirectoryPickerController[] = []
-function harness(defaultPath: string | undefined = '/downloads') {
+function harness(
+ defaultPath: string | undefined = '/downloads',
+ file?: FilePickerOptions
+) {
const eventListeners = new Map<string, (payload: unknown) => void>()
const preferences = {
mutate: vi.fn<DirectoryPreferencesStore['mutate']>(async () => true),
@@ -95,7 +99,8 @@ function harness(defaultPath: string | undefined = '/downloads') {
defaultPath,
finish,
preferences,
- new DirectorySortPreferences(() => ({ getItem: () => null, setItem() {} }))
+ new DirectorySortPreferences(() => ({ getItem: () => null, setItem() {} })),
+ file
)
controllers.push(controller)
return {
@@ -967,3 +972,78 @@ describe('DirectoryPickerController', () => {
expect(current.finish).toHaveBeenCalledExactlyOnceWith('/downloads/Music')
})
})
+
+describe('file modes of the directory controller', () => {
+ it('opens a selected file, revalidates it, and never confirms a directory as an input', async () => {
+ const h = harness('/downloads/video.mp4', { kind: 'open' })
+ h.queue(
+ Queries.ListServerDirectories,
+ success({
+ ...listing(),
+ initialName: 'video.mp4',
+ entries: [
+ { name: 'video.mp4', path: '/downloads/video.mp4', kind: 'file' },
+ { name: 'folder', path: '/downloads/folder', kind: 'directory' },
+ ],
+ })
+ )
+ await h.controller.start()
+ expect(h.invoke).toHaveBeenCalledWith(Queries.ListServerDirectories, {
+ path: '/downloads/video.mp4',
+ showHidden: false,
+ includeFiles: true,
+ initialFile: true,
+ })
+ expect(h.controller.target).toBe('/downloads/video.mp4')
+ h.controller.select('/downloads/folder')
+ expect(h.controller.target).toBeNull()
+ h.queue(Queries.ValidateServerFile, failure('notFound'))
+ h.controller.openEntry('/downloads/video.mp4')
+ await flush()
+ expect(h.finish).not.toHaveBeenCalled()
+ expect(h.controller.getSnapshot().error).toBe('notFound')
+ h.queue(
+ Queries.ValidateServerFile,
+ success({ path: '/downloads/video.mp4' })
+ )
+ await h.controller.confirm()
+ expect(h.finish).toHaveBeenCalledWith('/downloads/video.mp4')
+ })
+
+ it('uses server-provided path syntax and preserves the save filename while navigating', async () => {
+ const h = harness('D:\\Media\\merged.mp4', {
+ kind: 'save',
+ extensions: ['mp4', 'mkv'],
+ })
+ h.queue(
+ Queries.ListServerDirectories,
+ success({
+ ...listing('D:\\Media', []),
+ separator: '\\',
+ initialName: 'merged.mp4',
+ })
+ )
+ await h.controller.start()
+ expect(h.controller.target).toBe('D:\\Media\\merged.mp4')
+ h.queue(
+ Queries.ListServerDirectories,
+ success({ ...listing('D:\\Other', []), separator: '\\' })
+ )
+ h.controller.navigate('D:\\Other')
+ await flush()
+ expect(h.controller.target).toBe('D:\\Other\\merged.mp4')
+ h.queue(Queries.ValidateServerFile, failure('alreadyExists'))
+ await h.controller.confirm()
+ expect(h.finish).not.toHaveBeenCalled()
+ h.controller.setFileName('new.mkv')
+ h.queue(Queries.ValidateServerFile, success({ path: 'D:\\Other\\new.mkv' }))
+ await h.controller.confirm()
+ expect(h.invoke).toHaveBeenCalledWith(Queries.ValidateServerFile, {
+ kind: 'save',
+ parentPath: 'D:\\Other',
+ name: 'new.mkv',
+ extensions: ['mp4', 'mkv'],
+ })
+ expect(h.finish).toHaveBeenCalledWith('D:\\Other\\new.mkv')
+ })
+})
diff --git a/src/renderer/features/web-directory-picker/directory-picker-controller.ts b/src/renderer/features/web-directory-picker/directory-picker-controller.ts
index 9750ce3e..ad784d5d 100644
--- a/src/renderer/features/web-directory-picker/directory-picker-controller.ts
+++ b/src/renderer/features/web-directory-picker/directory-picker-controller.ts
@@ -10,6 +10,7 @@ import type {
DirectoryPreferences,
DirectoryPreferencesErrorCode,
} from '@shared/schemas/directory-preferences'
+import type { FilePickerOptions } from '@shared/schemas/file-picker'
import {
type AllowedSaveDirs,
AllowedSaveDirsSchema,
@@ -19,6 +20,7 @@ import {
ListServerDirectoriesResultSchema,
type ServerDirectoryLocations,
ValidateServerDirectoryResultSchema,
+ ValidateServerFileResultSchema,
} from '@shared/schemas/server-directory'
import type { z } from 'zod'
import {
@@ -46,6 +48,7 @@ type Editor = {
error: DirectoryErrorCode | null
}
export type PickerState = {
+ fileName: string
locations: ServerDirectoryLocations | null
locationsLoading: boolean
locationsError: DirectoryErrorCode | null
@@ -85,6 +88,7 @@ type NavigateOptions = {
/** One instance owns one bus request. Disposing invalidates every async continuation. */
export class DirectoryPickerController {
private state: PickerState = {
+ fileName: '',
locations: null,
locationsLoading: false,
locationsError: null,
@@ -122,7 +126,8 @@ export class DirectoryPickerController {
DirectoryPreferencesStore,
'mutate' | 'getSnapshot'
> = directoryPreferences,
- private readonly sortPreferences: DirectorySortPreferences = directorySortPreferences
+ private readonly sortPreferences: DirectorySortPreferences = directorySortPreferences,
+ readonly file?: FilePickerOptions
) {
this.state.sort = sortPreferences.get()
this.locationsStore = new ServerDirectoryLocationsStore(transport, {
@@ -199,11 +204,20 @@ export class DirectoryPickerController {
private errorCode(error: unknown): DirectoryErrorCode {
return error instanceof DirectoryRequestError ? error.code : 'unavailable'
}
- private async list(path: string, showHidden: boolean) {
+ private async list(path: string, showHidden: boolean, initialFile = false) {
const result = await this.request(
Queries.ListServerDirectories,
ListServerDirectoriesResultSchema,
- { path, showHidden }
+ {
+ path,
+ showHidden,
+ ...(this.file
+ ? {
+ includeFiles: true,
+ ...(initialFile ? { initialFile: true } : {}),
+ }
+ : {}),
+ }
)
if (!result.ok) throw new DirectoryRequestError(result.error.code)
return result.value
@@ -242,9 +256,19 @@ export class DirectoryPickerController {
let lastError: DirectoryErrorCode = 'invalidPath'
for (let index = 0; index < candidates.length; index++) {
try {
- const listing = await this.list(candidates[index], false)
+ const initialFile =
+ !!this.file && candidates[index] === this.defaultPath
+ const listing = await this.list(candidates[index], false, initialFile)
if (!this.current(generation)) return
- this.commitListing(listing, {}, false)
+ const selected = initialFile
+ ? listing.entries.find(
+ (entry) =>
+ entry.name === listing.initialName && entry.kind === 'file'
+ )?.path
+ : undefined
+ this.commitListing(listing, { selected }, false)
+ if (this.file?.kind === 'save' && listing.initialName)
+ this.update({ fileName: listing.initialName })
if (index > 0) this.update({ notice: 'fallback' })
return
} catch (error) {
@@ -263,8 +287,36 @@ export class DirectoryPickerController {
return this.state.busy !== null || this.state.editor !== null
}
get target() {
+ if (this.file?.kind === 'open')
+ return (
+ this.state.listing?.entries.find(
+ (entry) => entry.path === this.state.selected && entry.kind === 'file'
+ )?.path ?? null
+ )
+ if (this.file?.kind === 'save') {
+ const directory = this.state.listing
+ if (!directory || !this.state.fileName) return null
+ const separator = directory.separator ?? '/'
+ return `${directory.path}${directory.path.endsWith(separator) ? '' : separator}${this.state.fileName}`
+ }
return this.state.selected ?? this.state.listing?.path ?? null
}
+ setFileName(fileName: string) {
+ if (!this.live || this.locked) return
+ this.update({ fileName, error: null })
+ }
+ openEntry(path: string) {
+ if (!this.live || this.locked) return
+ const entry = this.state.listing?.entries.find(
+ (entry) => entry.path === path
+ )
+ if (!entry) return
+ if (entry.kind !== 'file') this.navigate(path)
+ else {
+ this.select(path)
+ if (this.file?.kind === 'open') void this.confirm()
+ }
+ }
get currentFavorite() {
const path = this.state.listing?.path
return this.state.locations?.favorites.find(
@@ -322,6 +374,12 @@ export class DirectoryPickerController {
)
return
this.update({ selected: path })
+ if (this.file?.kind === 'save') {
+ const entry = this.state.listing?.entries.find(
+ (entry) => entry.path === path && entry.kind === 'file'
+ )
+ if (entry) this.update({ fileName: entry.name, error: null })
+ }
}
private commitListing(
listing: DirectoryListing,
@@ -623,11 +681,24 @@ export class DirectoryPickerController {
const generation = ++this.generation
this.update({ busy: 'validate', error: null })
try {
- const result = await this.request(
- Queries.ValidateServerDirectory,
- ValidateServerDirectoryResultSchema,
- { path: target }
- )
+ const result = this.file
+ ? await this.request(
+ Queries.ValidateServerFile,
+ ValidateServerFileResultSchema,
+ this.file.kind === 'open'
+ ? { kind: 'open', path: target, extensions: this.file.extensions }
+ : {
+ kind: 'save',
+ parentPath: this.state.listing?.path,
+ name: this.state.fileName,
+ extensions: this.file.extensions,
+ }
+ )
+ : await this.request(
+ Queries.ValidateServerDirectory,
+ ValidateServerDirectoryResultSchema,
+ { path: target }
+ )
if (!this.current(generation) || this.target !== target) return
if (!result.ok) throw new DirectoryRequestError(result.error.code)
this.dispose()
diff --git a/src/renderer/features/web-directory-picker/directory-sort.ts b/src/renderer/features/web-directory-picker/directory-sort.ts
index 04747ee7..8286d44a 100644
--- a/src/renderer/features/web-directory-picker/directory-sort.ts
+++ b/src/renderer/features/web-directory-picker/directory-sort.ts
@@ -79,6 +79,8 @@ export function sortDirectoryEntries(
): Entry[] {
const direction = sort.direction === 'asc' ? 1 : -1
return [...entries].sort((a, b) => {
+ const kindOrder = Number(a.kind === 'file') - Number(b.kind === 'file')
+ if (kindOrder) return kindOrder
if (sort.by === 'name') return direction * compareName(a, b)
const aTime = a.modifiedAt
const bTime = b.modifiedAt
diff --git a/src/renderer/features/web-directory-picker/web-directory-picker-dialog.test.tsx b/src/renderer/features/web-directory-picker/web-directory-picker-dialog.test.tsx
index 1818b950..2a768860 100644
--- a/src/renderer/features/web-directory-picker/web-directory-picker-dialog.test.tsx
+++ b/src/renderer/features/web-directory-picker/web-directory-picker-dialog.test.tsx
@@ -11,6 +11,7 @@ import { __webPathPickerBus } from '@renderer/platform/web-services'
import { Commands } from '@shared/protocol/commands'
import { Events } from '@shared/protocol/events'
import { Queries } from '@shared/protocol/queries'
+import type { FilePickerOptions } from '@shared/schemas/file-picker'
import {
act,
cleanup,
@@ -89,7 +90,13 @@ const directories = (path = '/downloads', names = ['Alpha', 'Beta']) => ({
},
})
-function Harness({ strict = false }: { strict?: boolean }) {
+function Harness({
+ strict = false,
+ file,
+}: {
+ strict?: boolean
+ file?: FilePickerOptions
+}) {
const [pending, setPending] = useState(false)
const [value, setValue] = useState('/downloads')
const tree = (
@@ -104,6 +111,7 @@ function Harness({ strict = false }: { strict?: boolean }) {
setPending(true)
const path = await __webPathPickerBus.request({
defaultPath: value,
+ file,
})
if (path) setValue(path)
setPending(false)
@@ -708,3 +716,79 @@ describe('WebDirectoryPickerDialog', () => {
expect(screen.queryByTestId('web-directory-picker')).not.toBeInTheDocument()
})
})
+
+describe('file selection in the existing server browser', () => {
+ function withFiles() {
+ const base = vi.mocked(transport.invoke).getMockImplementation()!
+ vi.mocked(transport.invoke).mockImplementation(async (channel, ...args) => {
+ if (channel === Queries.ListServerDirectories)
+ return {
+ ...directories(),
+ value: {
+ ...directories().value,
+ separator: '/',
+ entries: [
+ { name: 'Folder', path: '/downloads/Folder', kind: 'directory' },
+ { name: 'video.mp4', path: '/downloads/video.mp4', kind: 'file' },
+ ],
+ },
+ }
+ if (channel === Queries.ValidateServerFile) {
+ const request = args[0] as { kind: string; path: string; name: string }
+ if (request.kind === 'save' && request.name === 'video.mp4')
+ return { ok: false, error: { code: 'alreadyExists' } }
+ return {
+ ok: true,
+ value: {
+ path:
+ request.kind === 'open'
+ ? request.path
+ : `/downloads/${request.name}`,
+ },
+ }
+ }
+ return base(channel, ...args)
+ })
+ }
+
+ it('navigates folders and confirms files by double-click without choosing a folder as an input', async () => {
+ withFiles()
+ render(<Harness file={{ kind: 'open' }} />)
+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))
+ const folder = await screen.findByRole('option', { name: 'Folder' })
+ fireEvent.click(folder)
+ expect(screen.getByRole('button', { name: 'Select file' })).toBeDisabled()
+ fireEvent.doubleClick(screen.getByRole('option', { name: 'video.mp4' }))
+ await waitFor(() =>
+ expect(
+ screen.queryByTestId('web-directory-picker')
+ ).not.toBeInTheDocument()
+ )
+ expect(screen.getByTestId('value')).toHaveTextContent(
+ '/downloads/video.mp4'
+ )
+ })
+
+ it('keeps the save dialog open on a collision and submits the revised filename', async () => {
+ withFiles()
+ render(<Harness file={{ kind: 'save', extensions: ['mp4', 'mkv'] }} />)
+ fireEvent.click(screen.getByRole('button', { name: 'Browse' }))
+ fireEvent.click(await screen.findByRole('option', { name: 'video.mp4' }))
+ expect(screen.getByLabelText('File name')).toHaveValue('video.mp4')
+ fireEvent.click(screen.getByRole('button', { name: 'Use this filename' }))
+ await screen.findByRole('alert')
+ expect(screen.getByTestId('web-directory-picker')).toBeInTheDocument()
+ fireEvent.change(screen.getByLabelText('File name'), {
+ target: { value: 'merged.mkv' },
+ })
+ fireEvent.keyDown(screen.getByLabelText('File name'), { key: 'Enter' })
+ await waitFor(() =>
+ expect(
+ screen.queryByTestId('web-directory-picker')
+ ).not.toBeInTheDocument()
+ )
+ expect(screen.getByTestId('value')).toHaveTextContent(
+ '/downloads/merged.mkv'
+ )
+ })
+})
diff --git a/src/renderer/features/web-directory-picker/web-directory-picker-dialog.tsx b/src/renderer/features/web-directory-picker/web-directory-picker-dialog.tsx
index 93bf6098..451ab8ea 100644
--- a/src/renderer/features/web-directory-picker/web-directory-picker-dialog.tsx
+++ b/src/renderer/features/web-directory-picker/web-directory-picker-dialog.tsx
@@ -5,6 +5,7 @@ import {
ChevronLeftIcon,
ChevronRightIcon,
CloseIcon,
+ DocumentIcon,
EditIcon,
FavoriteIcon,
FolderIcon,
@@ -109,7 +110,10 @@ export function WebDirectoryPickerDialog() {
setSession(null)
__webPathPickerBus.resolve(request.id, value)
restoreOpener(request)
- }
+ },
+ undefined,
+ undefined,
+ request.file
)
current.current = { request, controller }
setSession(current.current)
@@ -157,7 +161,11 @@ function PickerSession({ request, controller }: Session) {
)
const locked = state.busy !== null || state.editor !== null
const creating = state.busy === 'create'
- const target = state.selected ?? state.listing?.path
+ const target = controller.target
+ const errorText = (code: string) =>
+ t(
+ `directoryPicker.${request.file && !state.editor && ['invalidPath', 'outsideRoots', 'notFound', 'permissionDenied', 'invalidName', 'tooLarge'].includes(code) ? 'fileErrors' : 'errors'}.${code}`
+ )
const unknown =
!!state.listing && state.unknownParents.includes(state.listing.path)
const groups = useMemo(() => {
@@ -391,7 +399,7 @@ function PickerSession({ request, controller }: Session) {
(!mac && plain && event.key === 'Enter')
) {
event.preventDefault()
- if (!event.repeat && state.selected) controller.navigate(state.selected)
+ if (!event.repeat && state.selected) controller.openEntry(state.selected)
} else if (mac && plain && event.key === 'Enter') {
event.preventDefault()
if (!event.repeat) void controller.confirm()
@@ -539,10 +547,20 @@ function PickerSession({ request, controller }: Session) {
>
<div className="relative shrink-0 space-y-0.5 px-3 pt-3 pb-2 pe-11">
<DialogTitle className="text-[13px]">
- {t('directoryPicker.title')}
+ {t(
+ request.file
+ ? request.file.kind === 'open'
+ ? 'directoryPicker.openFileTitle'
+ : 'directoryPicker.saveFileTitle'
+ : 'directoryPicker.title'
+ )}
</DialogTitle>
<DialogDescription className="sr-only">
- {t('directoryPicker.description')}
+ {t(
+ request.file
+ ? 'directoryPicker.fileDescription'
+ : 'directoryPicker.description'
+ )}
</DialogDescription>
<DialogClose
render={
@@ -1014,9 +1032,7 @@ function PickerSession({ request, controller }: Session) {
role="alert"
className="flex shrink-0 items-center gap-2 px-3 py-2 text-xs text-destructive"
>
- <p className="flex-1">
- {t(`directoryPicker.errors.${state.error}`)}
- </p>
+ <p className="flex-1">{errorText(state.error)}</p>
<Button
variant="outline"
size="sm"
@@ -1059,6 +1075,36 @@ function PickerSession({ request, controller }: Session) {
</ScrollAreaViewport>
<ScrollBar />
</ScrollArea>
+ {request.file?.kind === 'save' && (
+ <label
+ htmlFor={`${id}-file-name`}
+ className="flex shrink-0 items-center gap-2 border-t px-3 py-2 text-xs"
+ >
+ {t('directoryPicker.fileName')}
+ <Input
+ id={`${id}-file-name`}
+ value={state.fileName}
+ disabled={locked}
+ maxLength={255}
+ onChange={(event) => controller.setFileName(event.target.value)}
+ onKeyDown={(event) => {
+ if (
+ event.key === 'Enter' &&
+ !event.nativeEvent.isComposing &&
+ !event.repeat &&
+ !event.ctrlKey &&
+ !event.metaKey &&
+ !event.altKey
+ ) {
+ event.preventDefault()
+ void controller.confirm()
+ }
+ }}
+ dir="ltr"
+ className="h-8 min-w-0 flex-1"
+ />
+ </label>
+ )}
<div className="flex min-w-0 shrink-0 items-start border-t px-3 pt-2 text-[11px]">
<ScrollArea className="directory-picker-target min-w-0 flex-1">
<ScrollAreaViewport
@@ -1067,7 +1113,11 @@ function PickerSession({ request, controller }: Session) {
>
<ScrollAreaContent>
<output
- aria-label={t('directoryPicker.selectedPath')}
+ aria-label={t(
+ request.file
+ ? 'directoryPicker.selectedFilePath'
+ : 'directoryPicker.selectedPath'
+ )}
dir="ltr"
className="block break-all whitespace-pre-wrap"
data-testid="directory-picker-target"
@@ -1105,7 +1155,13 @@ function PickerSession({ request, controller }: Session) {
disabled={locked || !target}
onClick={() => void controller.confirm()}
>
- {t('directoryPicker.selectFolder')}
+ {t(
+ request.file
+ ? request.file.kind === 'open'
+ ? 'directoryPicker.selectFile'
+ : 'directoryPicker.saveFile'
+ : 'directoryPicker.selectFolder'
+ )}
</Button>
</div>
</div>
@@ -1153,7 +1209,9 @@ const DirectoryEntries = memo(function DirectoryEntries({
containerProps={{
role: 'listbox',
tabIndex: 0,
- 'aria-label': t('directoryPicker.folders'),
+ 'aria-label': t(
+ controller.file ? 'directoryPicker.files' : 'directoryPicker.folders'
+ ),
'aria-activedescendant':
activeIndex >= 0 ? `${id}-option-${activeIndex}` : undefined,
'aria-busy': !!busy,
@@ -1170,7 +1228,11 @@ const DirectoryEntries = memo(function DirectoryEntries({
{busy
? t('directoryPicker.loading')
: hasListing
- ? t('directoryPicker.empty')
+ ? t(
+ controller.file
+ ? 'directoryPicker.emptyFiles'
+ : 'directoryPicker.empty'
+ )
: ''}
</p>
)}
@@ -1198,12 +1260,19 @@ const DirectoryEntries = memo(function DirectoryEntries({
listRef.current?.focus({ preventScroll: true })
}}
onClick={() => controller.select(item.path)}
- onDoubleClick={() => controller.navigate(item.path)}
+ onDoubleClick={() => controller.openEntry(item.path)}
>
- <FolderIcon
- aria-hidden
- className="size-4 shrink-0 text-muted-foreground"
- />
+ {item.kind === 'file' ? (
+ <DocumentIcon
+ aria-hidden
+ className="size-4 shrink-0 text-muted-foreground"
+ />
+ ) : (
+ <FolderIcon
+ aria-hidden
+ className="size-4 shrink-0 text-muted-foreground"
+ />
+ )}
<span dir="ltr" className="truncate whitespace-pre">
{item.name}
</span>
diff --git a/src/renderer/layouts/app-layout.tsx b/src/renderer/layouts/app-layout.tsx
index 5f441046..3b243e6f 100644
--- a/src/renderer/layouts/app-layout.tsx
+++ b/src/renderer/layouts/app-layout.tsx
@@ -11,6 +11,7 @@ import { WindowChrome } from '@renderer/components/window-chrome/window-chrome'
import { DesktopMenuActions } from '@renderer/features/application-menu/desktop-menu-actions'
import { MenuNavigationFocus } from '@renderer/features/application-menu/navigation-focus'
import { EngineDiagnosticsDialogHost } from '@renderer/features/engine-diagnostics/engine-diagnostics-dialog'
+import { MediaMergeDialogHost } from '@renderer/features/media-merge/media-merge-dialog'
import { useEngineRestartRequiredToast } from '@renderer/hooks/use-engine-restart-required-toast'
import { useIpcEvent } from '@renderer/hooks/use-ipc-event'
import { useMenuContextSync } from '@renderer/hooks/use-menu-context-sync'
@@ -116,6 +117,7 @@ export function AppLayout() {
{__MOTRIX_TARGET__ === 'electron' && <DesktopMenuContext />}
<MenuNavigationFocus />
<RemoveTasksDialogHost />
+ <MediaMergeDialogHost />
<EngineDiagnosticsDialogHost />
{__MOTRIX_TARGET__ === 'web' && <AddTaskDialogHost />}
</PlatformServicesProvider>
diff --git a/src/renderer/platform/electron-services.test.ts b/src/renderer/platform/electron-services.test.ts
index e5cc1b04..3505d730 100644
--- a/src/renderer/platform/electron-services.test.ts
+++ b/src/renderer/platform/electron-services.test.ts
@@ -19,6 +19,14 @@ describe('electronServices', () => {
} as never
})
+ it('resolves dropped files through preload and rejects files without a host path', () => {
+ const file = new File(['clip'], 'clip.mp4')
+ expect(electronServices.getPathForFile?.(file)).toBe('/host/plugin.moext')
+ expect(window.motrix?.getPathForFile).toHaveBeenCalledWith(file)
+ vi.mocked(window.motrix!.getPathForFile).mockReturnValue('')
+ expect(electronServices.getPathForFile?.(file)).toBeNull()
+ })
+
it('converts a selected file through the Electron host capability', async () => {
const file = new File(['plugin'], 'plugin.moext')
await expect(
@@ -32,6 +40,20 @@ describe('electronServices', () => {
expect(sha256File).toHaveBeenCalledWith(file)
})
+ it('uses the generic native file picker with save filters and cancellation', async () => {
+ vi.mocked(transport.invoke)
+ .mockResolvedValueOnce('/media/new.mkv')
+ .mockResolvedValueOnce(null)
+ const options = {
+ kind: 'save' as const,
+ defaultPath: '/media/new.mkv',
+ extensions: ['mp4', 'mkv'],
+ }
+ expect(await electronServices.pickFile?.(options)).toBe('/media/new.mkv')
+ expect(transport.invoke).toHaveBeenCalledWith(Commands.PickFile, options)
+ expect(await electronServices.pickFile?.({ kind: 'open' })).toBeNull()
+ })
+
it('pickSaveDir returns path on user confirm', async () => {
vi.mocked(transport.invoke).mockResolvedValueOnce({ path: '/u/a/d' })
const result = await electronServices.pickSaveDir('/prev')
diff --git a/src/renderer/platform/electron-services.ts b/src/renderer/platform/electron-services.ts
index e5702c2b..e7282643 100644
--- a/src/renderer/platform/electron-services.ts
+++ b/src/renderer/platform/electron-services.ts
@@ -8,6 +8,10 @@ import type { PlatformServices } from './services'
export const electronServices: PlatformServices = {
kind: 'electron',
+ getPathForFile(file) {
+ return window.motrix?.getPathForFile?.(file) || null
+ },
+
pluginInstallFile: {
mode: 'local-path',
async prepare(file) {
@@ -23,6 +27,10 @@ export const electronServices: PlatformServices = {
},
},
+ async pickFile(options) {
+ return (await transport.invoke(Commands.PickFile, options)) as string | null
+ },
+
async pickSaveDir(defaultPath) {
const res = await transport.invoke(Commands.PickSaveDir, { defaultPath })
if (res && typeof res === 'object' && 'path' in res) {
diff --git a/src/renderer/platform/services.tsx b/src/renderer/platform/services.tsx
index 7896388e..ac165f63 100644
--- a/src/renderer/platform/services.tsx
+++ b/src/renderer/platform/services.tsx
@@ -1,3 +1,4 @@
+import type { FilePickerOptions } from '@shared/schemas/file-picker'
import { createContext, type ReactNode, useContext } from 'react'
export type PluginInstallFileReference =
@@ -12,6 +13,9 @@ export interface PluginInstallFileCapability {
export interface PlatformServices {
readonly kind: 'electron' | 'web'
readonly pluginInstallFile?: PluginInstallFileCapability
+ pickFile?(options: FilePickerOptions): Promise<string | null>
+ /** Resolve a user-dropped file on this host; absent for remote web sessions. */
+ getPathForFile?(file: File): string | null
pickSaveDir(
defaultPath?: string,
options?: {
diff --git a/src/renderer/platform/web-services.test.ts b/src/renderer/platform/web-services.test.ts
index 8f241fcc..e313eb25 100644
--- a/src/renderer/platform/web-services.test.ts
+++ b/src/renderer/platform/web-services.test.ts
@@ -16,6 +16,29 @@ describe('createWebServices', () => {
expect(services.kind).toBe('web')
})
+ it('routes file selection and save options through the existing browser picker bus', async () => {
+ const listener = vi.fn()
+ const unsubscribe = __webPathPickerBus.subscribe(listener)
+ const options = {
+ kind: 'save' as const,
+ defaultPath: '/downloads/new.mp4',
+ extensions: ['mp4', 'mkv'],
+ }
+ const pending = services.pickFile?.(options)
+ expect(listener).toHaveBeenCalledWith(
+ expect.objectContaining({
+ defaultPath: options.defaultPath,
+ file: options,
+ })
+ )
+ __webPathPickerBus.resolve(
+ listener.mock.calls[0][0].id,
+ '/downloads/new.mp4'
+ )
+ await expect(pending).resolves.toBe('/downloads/new.mp4')
+ unsubscribe()
+ })
+
it('pickSaveDir emits on bus and resolves on response', async () => {
const spy = vi.fn()
const unsubscribe = __webPathPickerBus.subscribe(spy)
diff --git a/src/renderer/platform/web-services.ts b/src/renderer/platform/web-services.ts
index b8792f26..e9726173 100644
--- a/src/renderer/platform/web-services.ts
+++ b/src/renderer/platform/web-services.ts
@@ -1,5 +1,6 @@
import { toast } from '@renderer/components/ui/toast'
import { i18n } from '@renderer/lib/i18n'
+import type { FilePickerOptions } from '@shared/schemas/file-picker'
import type { PlatformServices } from './services'
const SHA256_RE = /^[0-9a-f]{64}$/
@@ -8,6 +9,7 @@ export type PickRequest = {
id: number
defaultPath?: string
allowFavoriteEditing?: boolean
+ file?: FilePickerOptions
opener: HTMLElement | null
}
type PickListener = (req: PickRequest) => void
@@ -30,6 +32,7 @@ export class PathPickerBus {
request(req: {
defaultPath?: string
allowFavoriteEditing?: boolean
+ file?: FilePickerOptions
}): Promise<string | null> {
const id = ++this.latestId
const opener =
@@ -121,6 +124,10 @@ export function createWebServices(
},
},
+ pickFile(file) {
+ return __webPathPickerBus.request({ defaultPath: file.defaultPath, file })
+ },
+
pickSaveDir(defaultPath, options) {
return __webPathPickerBus.request({ defaultPath, ...options })
},
diff --git a/src/renderer/routes/downloads/task-actions-menu.tsx b/src/renderer/routes/downloads/task-actions-menu.tsx
index 09d2702b..4ce9907e 100644
--- a/src/renderer/routes/downloads/task-actions-menu.tsx
+++ b/src/renderer/routes/downloads/task-actions-menu.tsx
@@ -22,6 +22,7 @@ import {
menuActionEnabled,
subscribeMenuContext,
} from '@renderer/features/application-menu/task-context'
+import { useMediaMergeDialog } from '@renderer/features/media-merge/media-merge-store'
import { openAddTaskDialog } from '@renderer/lib/open-add-task-dialog'
import { openMagnetFileSelection } from '@renderer/lib/open-magnet-file-selection'
import { transport } from '@renderer/lib/transport'
@@ -294,6 +295,23 @@ export function TaskActionsMenu({
{t('panel.downloads.action.openFolder')}
</DropdownMenuItem>
)}
+ {selected.length === 2 &&
+ selected.every(
+ (task) =>
+ task.status === TaskStatus.Completed &&
+ task.fileCount <= 1 &&
+ task.finalPath
+ ) && (
+ <DropdownMenuItem
+ onClick={() =>
+ useMediaMergeDialog
+ .getState()
+ .openWith({ taskIds: selected.map((task) => task.id) })
+ }
+ >
+ {t('mediaMerge.title')}
+ </DropdownMenuItem>
+ )}
<InspectorMenuItem
visible={inspectorVisible}
disabled={!inspectorVisible && selected.length === 0}
diff --git a/src/renderer/routes/plugins/components/overview-section.tsx b/src/renderer/routes/plugins/components/overview-section.tsx
index e35b4389..13588f2d 100644
--- a/src/renderer/routes/plugins/components/overview-section.tsx
+++ b/src/renderer/routes/plugins/components/overview-section.tsx
@@ -1,4 +1,5 @@
import { Alert } from '@renderer/components/ui/alert'
+import { Badge } from '@renderer/components/ui/badge'
import { Button } from '@renderer/components/ui/button'
import type { PluginListDTO, PluginManifestDTO } from '@shared/types/plugin'
import { useTranslation } from 'react-i18next'
@@ -22,7 +23,7 @@ function MiniCard({ strong, value }: { strong: string; value: string }) {
<strong className="text-[11px] font-medium uppercase text-muted-foreground">
{strong}
</strong>
- <p className="mt-1 text-sm leading-5">{value}</p>
+ <p className="mt-1 text-xs leading-5">{value}</p>
</div>
)
}
@@ -39,14 +40,21 @@ export function OverviewSection({ plugin, manifest, onJumpToLogs }: Props) {
return (
<div className="w-full space-y-4">
<div className="rounded-lg border bg-card p-4 shadow-none space-y-2">
- <div className="grid grid-cols-[54px_1fr] items-start gap-3">
- <PluginAvatar plugin={manifest} size={54} />
- <div>
- <h3 className="text-base font-semibold">{manifest.name}</h3>
- <p className="mt-0.5 text-xs text-muted-foreground">
- v{manifest.version} · {manifest.id}
- </p>
+ <div className="flex items-start justify-between gap-3">
+ <div className="grid min-w-0 grid-cols-[54px_minmax(0,1fr)] items-start gap-3">
+ <PluginAvatar plugin={manifest} size={54} />
+ <div>
+ <h3 className="break-words text-base font-semibold">
+ {manifest.name}
+ </h3>
+ <p className="mt-0.5 break-all text-xs text-muted-foreground">
+ v{manifest.version} · {manifest.id}
+ </p>
+ </div>
</div>
+ <Badge variant="outline" className="shrink-0">
+ {audience.heroHeadline}
+ </Badge>
</div>
<p className="text-sm">{manifest.description}</p>
{manifest.author && (
@@ -72,9 +80,6 @@ export function OverviewSection({ plugin, manifest, onJumpToLogs }: Props) {
</a>
</div>
)}
- <h3 className="mt-6 text-base font-medium tracking-tight">
- {audience.heroHeadline}
- </h3>
<p className="text-sm leading-none text-muted-foreground">
{audience.plain}
</p>
diff --git a/src/renderer/routes/plugins/components/permission-row.test.tsx b/src/renderer/routes/plugins/components/permission-row.test.tsx
index e52b7ec5..db1f178a 100644
--- a/src/renderer/routes/plugins/components/permission-row.test.tsx
+++ b/src/renderer/routes/plugins/components/permission-row.test.tsx
@@ -1,10 +1,35 @@
import '@testing-library/jest-dom/vitest'
import '@renderer/lib/i18n'
import { fireEvent, render, screen } from '@testing-library/react'
+import { MemoryRouter, Route, Routes } from 'react-router'
import { describe, expect, it, vi } from 'vitest'
import { PermissionRow } from './permission-row'
describe('PermissionRow', () => {
+ it('explains the FFmpeg requirement and links to integration settings', async () => {
+ render(
+ <MemoryRouter initialEntries={['/plugins/media-merge']}>
+ <Routes>
+ <Route
+ path="/plugins/media-merge"
+ element={<PermissionRow permission="ffmpeg" granted={true} />}
+ />
+ <Route
+ path="/settings/integration"
+ element={<h1>Integration settings</h1>}
+ />
+ </Routes>
+ </MemoryRouter>
+ )
+ expect(screen.getByText(/Processes audio or video. First,/)).toBeVisible()
+ fireEvent.click(
+ screen.getByRole('link', { name: 'install or select FFmpeg in Settings' })
+ )
+ expect(
+ await screen.findByRole('heading', { name: 'Integration settings' })
+ ).toBeVisible()
+ })
+
it('renders strong + plain for storage permission', () => {
render(<PermissionRow permission="storage" granted={true} />)
expect(screen.getByText('Save settings')).toBeInTheDocument()
diff --git a/src/renderer/routes/plugins/components/permission-row.tsx b/src/renderer/routes/plugins/components/permission-row.tsx
index 3e67d034..1cedabf4 100644
--- a/src/renderer/routes/plugins/components/permission-row.tsx
+++ b/src/renderer/routes/plugins/components/permission-row.tsx
@@ -1,7 +1,8 @@
import { Badge } from '@renderer/components/ui/badge'
import { Switch } from '@renderer/components/ui/switch'
import { cn } from '@renderer/lib/utils'
-import { useTranslation } from 'react-i18next'
+import { Trans, useTranslation } from 'react-i18next'
+import { Link } from 'react-router'
import { getAudienceTone, permissionAudience } from '../lib/audience'
interface Props {
@@ -21,7 +22,21 @@ export function PermissionRow({ permission, granted, onToggle }: Props) {
{audience.strong}
</strong>
<p className="text-xs leading-5 text-muted-foreground">
- {audience.plain}
+ {permission === 'ffmpeg' ? (
+ <Trans
+ i18nKey="plugins.permission.ffmpeg.requirement"
+ components={{
+ settings: (
+ <Link
+ to="/settings/integration"
+ className="text-primary underline underline-offset-4"
+ />
+ ),
+ }}
+ />
+ ) : (
+ audience.plain
+ )}
</p>
</div>
<div className="flex shrink-0 items-center gap-2">
diff --git a/src/renderer/routes/plugins/components/plugin-operations.tsx b/src/renderer/routes/plugins/components/plugin-operations.tsx
new file mode 100644
index 00000000..4d2da2de
--- /dev/null
+++ b/src/renderer/routes/plugins/components/plugin-operations.tsx
@@ -0,0 +1,84 @@
+import { Button } from '@renderer/components/ui/button'
+import { MediaMergeForm } from '@renderer/features/media-merge/media-merge-form'
+import { MEDIA_MERGE_COMMAND } from '@shared/schemas/manual-media-merge'
+import type { PluginManifestDTO } from '@shared/types/plugin'
+import { Component, type ReactNode } from 'react'
+import { useTranslation } from 'react-i18next'
+
+/** Host-rendered operation panels opt in through a supported public command. */
+export function hasPluginOperations(manifest: PluginManifestDTO): boolean {
+ return (
+ manifest.permissions.includes('ffmpeg') &&
+ !!manifest.contributes.commands?.some(
+ (command) =>
+ command.public && command.id === `${manifest.id}.${MEDIA_MERGE_COMMAND}`
+ )
+ )
+}
+
+class OperationsBoundary extends Component<
+ {
+ children: ReactNode
+ message: string
+ retry: string
+ },
+ { failed: boolean }
+> {
+ state = { failed: false }
+
+ static getDerivedStateFromError() {
+ return { failed: true }
+ }
+
+ render() {
+ if (this.state.failed)
+ return (
+ <div role="alert" className="space-y-3 rounded-lg border p-4 text-sm">
+ <p>{this.props.message}</p>
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => this.setState({ failed: false })}
+ >
+ {this.props.retry}
+ </Button>
+ </div>
+ )
+ return this.props.children
+ }
+}
+
+export function PluginOperations({
+ pluginId,
+ enabled,
+}: {
+ pluginId: string
+ enabled: boolean
+}) {
+ const { t } = useTranslation()
+ return (
+ <OperationsBoundary
+ key={pluginId}
+ message={t('plugins.detail.operationsFailed')}
+ retry={t('common.retry')}
+ >
+ <section className="mx-auto w-full max-w-2xl py-2">
+ <div className="space-y-4">
+ <div className="space-y-1.5">
+ <h2 className="text-lg font-semibold tracking-tight">
+ {t('mediaMerge.title')}
+ </h2>
+ <p className="text-xs leading-5 text-muted-foreground">
+ {t('mediaMerge.description')}
+ </p>
+ </div>
+ <MediaMergeForm
+ key={pluginId}
+ pluginId={pluginId}
+ enabled={enabled}
+ />
+ </div>
+ </section>
+ </OperationsBoundary>
+ )
+}
diff --git a/src/renderer/routes/plugins/components/plugin-status-dot.tsx b/src/renderer/routes/plugins/components/plugin-status-dot.tsx
index 23ee344c..3fabd146 100644
--- a/src/renderer/routes/plugins/components/plugin-status-dot.tsx
+++ b/src/renderer/routes/plugins/components/plugin-status-dot.tsx
@@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next'
const DOT_COLOR: Record<PluginStatus, string> = {
active: 'bg-emerald-500',
- inactive: 'bg-amber-500',
+ inactive: 'bg-blue-500',
disabled: 'bg-muted-foreground/60',
error: 'bg-destructive',
}
diff --git a/src/renderer/routes/plugins/plugin-detail-page.test.tsx b/src/renderer/routes/plugins/plugin-detail-page.test.tsx
index ec8d984e..13ec4e00 100644
--- a/src/renderer/routes/plugins/plugin-detail-page.test.tsx
+++ b/src/renderer/routes/plugins/plugin-detail-page.test.tsx
@@ -2,6 +2,7 @@ import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import '@renderer/lib/i18n'
import { TooltipProvider } from '@renderer/components/ui/tooltip'
+import { useMediaMergeSessions } from '@renderer/features/media-merge/media-merge-store'
import {
type PlatformServices,
PlatformServicesProvider,
@@ -158,7 +159,10 @@ describe('PluginDetailPage', () => {
beforeEach(() => {
mockApplyStatus.mockClear()
mockClearUpdate.mockClear()
- mockInvoke.mockClear()
+ mockInvoke.mockReset().mockResolvedValue(undefined)
+ mockDetail.manifest.contributes = {}
+ mockDetail.manifest.permissions = ['storage']
+ useMediaMergeSessions.setState({ sessions: {} })
mockSetRegistry.mockClear()
mockSetUpdates.mockClear()
toastAddMock.mockClear()
@@ -183,6 +187,94 @@ describe('PluginDetailPage', () => {
expect(screen.queryByRole('button', { name: /Advanced/ })).toBeNull()
})
+ function enableOperations() {
+ mockDetail.manifest.permissions = ['ffmpeg']
+ mockDetail.manifest.contributes = {
+ commands: [{ id: 'test.demo.mergeStreams', public: true }],
+ }
+ mockInvoke.mockImplementation(async (command: string) =>
+ command === Commands.GetMediaMergeState
+ ? { providers: [{ pluginId: 'test.demo', title: 'Demo' }], job: null }
+ : undefined
+ )
+ }
+
+ it.each(['electron', 'web'] as const)(
+ 'opens the operation form by default on %s and retains the draft across tabs',
+ async (kind) => {
+ enableOperations()
+ useMediaMergeSessions.getState().save('test.demo', {
+ values: {
+ pluginId: 'test.demo',
+ videoInput: '/video.mp4',
+ audioInput: '/audio.m4a',
+ output: '/merged.mp4',
+ },
+ })
+ const user = userEvent.setup()
+ renderAt('/plugins/test.demo', kind)
+ expect(screen.getByRole('tab', { name: 'Operations' })).toHaveAttribute(
+ 'aria-selected',
+ 'true'
+ )
+ await waitFor(() =>
+ expect(
+ screen.getByRole('button', { name: 'Browse Video file' })
+ ).toHaveAttribute('title', '/video.mp4')
+ )
+ expect(
+ screen.queryByRole('button', { name: 'Merge audio and video' })
+ ).toBeNull()
+ await user.click(screen.getByRole('tab', { name: 'Overview' }))
+ await waitFor(() =>
+ expect(screen.getByTitle('/video.mp4')).not.toBeVisible()
+ )
+ await user.click(screen.getByRole('tab', { name: 'Access' }))
+ await user.click(screen.getByRole('tab', { name: 'Operations' }))
+ expect(
+ screen.getByRole('button', { name: 'Browse Video file' })
+ ).toHaveAttribute('title', '/video.mp4')
+ expect(
+ screen.getByRole('button', { name: 'Browse Output file' })
+ ).toHaveAttribute('title', '/merged.mp4')
+ expect(
+ mockInvoke.mock.calls.filter(
+ ([channel]) => channel === Commands.GetMediaMergeState
+ )
+ ).toHaveLength(1)
+ }
+ )
+
+ it('honors an explicit Overview link for an operation plugin', () => {
+ enableOperations()
+ renderAt('/plugins/test.demo?tab=overview')
+ expect(screen.getByRole('tab', { name: 'Overview' })).toHaveAttribute(
+ 'aria-selected',
+ 'true'
+ )
+ })
+
+ it('keeps the operation visible but unavailable for a disabled plugin', async () => {
+ enableOperations()
+ mockStore.list[0].enabled = false
+ renderAt('/plugins/test.demo')
+ await screen.findByText('Enable this plugin to merge files.')
+ expect(screen.getByRole('button', { name: 'Merge' })).toBeDisabled()
+ })
+
+ it('does not offer an operations tab for unsupported or private commands', () => {
+ mockDetail.manifest.permissions = ['ffmpeg']
+ mockDetail.manifest.contributes = {
+ commands: [{ id: 'test.demo.mergeStreams', public: false }],
+ }
+ renderAt('/plugins/test.demo?tab=operations')
+ expect(screen.queryByRole('tab', { name: 'Operations' })).toBeNull()
+ expect(screen.getByRole('tab', { name: 'Overview' })).toHaveAttribute(
+ 'aria-selected',
+ 'true'
+ )
+ })
+
it('Logs icon button switches to Logs content', async () => {
const user = userEvent.setup()
renderAt('/plugins/test.demo')
diff --git a/src/renderer/routes/plugins/plugin-detail-page.tsx b/src/renderer/routes/plugins/plugin-detail-page.tsx
index eaec510f..6e64e15e 100644
--- a/src/renderer/routes/plugins/plugin-detail-page.tsx
+++ b/src/renderer/routes/plugins/plugin-detail-page.tsx
@@ -41,6 +41,10 @@ import { AccessSection } from './components/access-section'
import { BuiltinUpdateDialog } from './components/builtin-update-dialog'
import { OverviewSection } from './components/overview-section'
import { PluginLogTab } from './components/plugin-log-tab'
+import {
+ hasPluginOperations,
+ PluginOperations,
+} from './components/plugin-operations'
import { PluginSettingsForm } from './components/plugin-settings-form'
import { PluginStatusDot } from './components/plugin-status-dot'
import { RegistryDetailPanel } from './components/registry-detail-panel'
@@ -51,7 +55,7 @@ import { useRegistryEntry, useRegistryUpdates } from './hooks/use-registry'
import { PluginInstallDialog } from './plugin-install-dialog'
import { type UpdateChannel, usePluginsStore } from './store'
-type DetailTab = 'overview' | 'settings' | 'access' | 'logs' | 'about'
+type DetailTab = 'operations' | 'overview' | 'settings' | 'access' | 'logs'
export function PluginDetailPage() {
const { id = '' } = useParams()
@@ -80,11 +84,13 @@ export function PluginDetailPage() {
// mid-flight (which main then rejects — motrix.* is a reserved namespace).
const [updateChannel, setUpdateChannel] = useState<UpdateChannel | null>(null)
- const initialTab = (searchParams.get('tab') ?? 'overview') as DetailTab
- const [tab, setTab] = useState<DetailTab>(initialTab)
- useEffect(() => {
- setTab((searchParams.get('tab') ?? 'overview') as DetailTab)
- }, [searchParams])
+ const queryTab = searchParams.get('tab')
+ const [selection, setSelection] = useState<{
+ id: string
+ query: string | null
+ tab: DetailTab
+ } | null>(null)
+ const setTab = (tab: DetailTab) => setSelection({ id, query: queryTab, tab })
// Not-installed ids fall back to the registry-backed view (the landing
// surface of motrix://plugins/<id>). Only when the id is in neither the
@@ -122,6 +128,25 @@ export function PluginDetailPage() {
| JsonSchemaNode
| undefined
+ const hasOperations = hasPluginOperations(manifest)
+ const requestedTab =
+ selection?.id === id && selection.query === queryTab
+ ? selection.tab
+ : queryTab
+ const validTabs = [
+ 'overview',
+ 'access',
+ 'logs',
+ ...(schema ? ['settings'] : []),
+ ...(hasOperations ? ['operations'] : []),
+ ]
+ const tab =
+ requestedTab && validTabs.includes(requestedTab)
+ ? requestedTab
+ : hasOperations
+ ? 'operations'
+ : 'overview'
+
async function toggleEnabled(next: boolean) {
await transport.invoke(
next ? Commands.EnablePlugin : Commands.DisablePlugin,
@@ -183,8 +208,13 @@ export function PluginDetailPage() {
onValueChange={(v) => setTab(v as DetailTab)}
className="flex min-h-0 flex-1 flex-col"
>
- <div className="flex w-full shrink-0 items-center justify-between pb-2">
- <TabsList>
+ <div className="flex w-full shrink-0 flex-wrap items-center justify-between gap-2 pb-2">
+ <TabsList className="bg-tab-background">
+ {hasOperations && (
+ <TabsTrigger value="operations">
+ {t('plugins.detail.operations')}
+ </TabsTrigger>
+ )}
<TabsTrigger value="overview">
{t('plugins.detail.overview')}
</TabsTrigger>
@@ -314,6 +344,33 @@ export function PluginDetailPage() {
</div>
</div>
+ {hasOperations && (
+ <TabsContent
+ key={id}
+ value="operations"
+ keepMounted
+ className="m-0 flex min-h-0 flex-1 flex-col data-[hidden]:hidden"
+ >
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="pb-4 pe-4"
+ style={{ minWidth: '100%' }}
+ >
+ <PluginOperations
+ pluginId={id}
+ enabled={listEntry.enabled}
+ />
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
+ </TabsContent>
+ )}
+
<TabsContent
value="overview"
className="m-0 flex min-h-0 flex-1 flex-col"
@@ -324,13 +381,13 @@ export function PluginDetailPage() {
className="min-h-0 flex-1 overscroll-contain"
>
<ScrollAreaContent
- className="pb-6"
+ className="pb-4 pe-4"
style={{ minWidth: '100%' }}
>
<div className="mx-auto flex w-full flex-col gap-4">
<OverviewSection
- plugin={listEntry}
manifest={manifest}
+ plugin={listEntry}
onJumpToLogs={() => setTab('logs')}
/>
</div>
@@ -351,7 +408,7 @@ export function PluginDetailPage() {
className="min-h-0 flex-1 overscroll-contain"
>
<ScrollAreaContent
- className="pb-6"
+ className="pb-4 pe-4"
style={{ minWidth: '100%' }}
>
<div className="mx-auto flex w-full flex-col gap-4">
@@ -378,7 +435,7 @@ export function PluginDetailPage() {
className="min-h-0 flex-1 overscroll-contain"
>
<ScrollAreaContent
- className="pb-6"
+ className="pb-4 pe-4"
style={{ minWidth: '100%' }}
>
<div className="mx-auto flex w-full flex-col gap-4">
diff --git a/src/server/http/app.ts b/src/server/http/app.ts
index 6d8c51bf..6d68e414 100644
--- a/src/server/http/app.ts
+++ b/src/server/http/app.ts
@@ -23,6 +23,7 @@ import {
ListServerDirectoriesResultSchema,
ListServerDirectoryLocationsResultSchema,
ValidateServerDirectoryResultSchema,
+ ValidateServerFileResultSchema,
} from '@shared/schemas/server-directory'
import { parseTaskInspectorActivitySnapshot } from '@shared/schemas/task-inspector-activity'
import { torrentRpcBodyLimitSchema } from '@shared/schemas/torrent-request-limits'
@@ -50,6 +51,7 @@ const directoryResultSchemas = {
ListServerDirectoryLocationsResultSchema,
[Commands.CreateServerDirectory]: CreateServerDirectoryResultSchema,
[Queries.ListServerDirectories]: ListServerDirectoriesResultSchema,
+ [Queries.ValidateServerFile]: ValidateServerFileResultSchema,
[Queries.ValidateServerDirectory]: ValidateServerDirectoryResultSchema,
}
@@ -190,6 +192,7 @@ export async function createApp(
if (
req.params.channel === Queries.ListServerDirectories ||
req.params.channel === Queries.ValidateServerDirectory ||
+ req.params.channel === Queries.ValidateServerFile ||
req.params.channel === Queries.GetDirectoryPreferences ||
req.params.channel === Queries.GetGeneralSettingsDraft ||
req.params.channel === Queries.GetDownloadsSettingsDraft ||
diff --git a/src/server/http/server-directory.test.ts b/src/server/http/server-directory.test.ts
index d22ab900..60b5ba4a 100644
--- a/src/server/http/server-directory.test.ts
+++ b/src/server/http/server-directory.test.ts
@@ -25,6 +25,7 @@ const TOKEN = 'directory-test-owner'
const capabilities = [
{ kind: 'query', channel: Queries.ListServerDirectories },
{ kind: 'query', channel: Queries.ValidateServerDirectory },
+ { kind: 'query', channel: Queries.ValidateServerFile },
{ kind: 'command', channel: Commands.CreateServerDirectory },
] as const
@@ -45,6 +46,8 @@ describe('authenticated directory RPC', () => {
queryHandlers: {
[Queries.ListServerDirectories]: (request: unknown) =>
service.list(request),
+ [Queries.ValidateServerFile]: (request: unknown) =>
+ service.validateFile(request),
[Queries.ValidateServerDirectory]: (request: unknown) =>
service.validate(request),
},
@@ -69,7 +72,9 @@ describe('authenticated directory RPC', () => {
const requestFor = (channel: string, root: string) =>
channel === Commands.CreateServerDirectory
? { parentPath: root, name: 'new' }
- : { path: root }
+ : channel === Queries.ValidateServerFile
+ ? { kind: 'save', parentPath: root, name: 'new.mp4' }
+ : { path: root }
it.each(capabilities)(
'gates $channel against anonymous and cross-origin requests and accepts same-origin sessions',
@@ -105,7 +110,9 @@ describe('authenticated directory RPC', () => {
path:
channel === Commands.CreateServerDirectory
? path.join(root, 'new')
- : root,
+ : channel === Queries.ValidateServerFile
+ ? path.join(root, 'new.mp4')
+ : root,
},
})
}
@@ -120,7 +127,9 @@ describe('authenticated directory RPC', () => {
? 'create'
: channel === Queries.ListServerDirectories
? 'list'
- : 'validate'
+ : channel === Queries.ValidateServerFile
+ ? 'validateFile'
+ : 'validate'
)
for (const payload of [
{},
@@ -153,7 +162,9 @@ describe('authenticated directory RPC', () => {
? 'create'
: channel === Queries.ListServerDirectories
? 'list'
- : 'validate'
+ : channel === Queries.ValidateServerFile
+ ? 'validateFile'
+ : 'validate'
const spy = vi.spyOn(service, method)
const request = {
method: 'POST' as const,
diff --git a/src/server/ipc/commands.test.ts b/src/server/ipc/commands.test.ts
index 1fa0e0ca..090fa941 100644
--- a/src/server/ipc/commands.test.ts
+++ b/src/server/ipc/commands.test.ts
@@ -1997,3 +1997,44 @@ describe('host-owned task directory history', () => {
finish({ ok: true, value: { favorites: [], recent: [] } })
})
})
+
+describe('manual media merge logging', () => {
+ it('uses the existing plugin log capability for preparation failures', async () => {
+ const ctx = makeFakeCtx()
+ const error = vi.fn()
+ const createLog = vi.fn(() => ({ info: vi.fn(), warn: vi.fn(), error }))
+ const pluginId = 'test.merger'
+ const handlers = buildServerCommandHandlers({
+ ...ctx,
+ pluginRegistry: {
+ list: () => [{ id: pluginId, name: 'Merger', enabled: true }],
+ get: () => ({
+ manifest: {
+ permissions: ['ffmpeg'],
+ contributes: {
+ commands: [{ id: `${pluginId}.mergeStreams`, public: true }],
+ },
+ },
+ }),
+ },
+ capabilityHost: { createLog },
+ } as unknown as ServerCommandContext)
+ await expect(
+ handlers[Commands.StartMediaMerge]?.({
+ pluginId,
+ videoInput: 'relative.mp4',
+ audioInput: '/media/audio.mp4',
+ output: '/media/merged.mp4',
+ })
+ ).rejects.toThrow('mediaMerge.absolutePaths')
+ expect(createLog).toHaveBeenCalledWith(pluginId)
+ expect(error).toHaveBeenCalledWith(
+ 'Media merge failed',
+ expect.objectContaining({
+ event: 'media-merge.failed',
+ stage: 'preparing',
+ reason: 'mediaMerge.absolutePaths',
+ })
+ )
+ })
+})
diff --git a/src/server/ipc/commands.ts b/src/server/ipc/commands.ts
index 5fee6807..1f1fa9cb 100644
--- a/src/server/ipc/commands.ts
+++ b/src/server/ipc/commands.ts
@@ -1,3 +1,4 @@
+import path from 'node:path'
import type { Aria2RpcClient } from '@core/engine/aria2/aria2-rpc-client'
import type { DnsFallbackConsumer } from '@core/engine/aria2/dns-fallback'
import { dnsModeToAsyncDns } from '@core/engine/aria2/dns-fallback'
@@ -11,6 +12,7 @@ import { getLogger } from '@core/logger'
import { publishEngineRestartRequired } from '@core/notifications/engine-restart-required'
import type { NotificationCenter } from '@core/notifications/notification-center'
import type { CapabilityHost } from '@core/plugin/capabilities/interface'
+import { ManualMediaMerge } from '@core/plugin/commands/manual-media-merge'
import { pluginSecretFields } from '@core/plugin/configuration-schema'
import type { GrantsManager } from '@core/plugin/grants/grants-manager'
import type { HookAuditLog } from '@core/plugin/hooks/audit-log'
@@ -396,7 +398,25 @@ export function buildServerCommandHandlers(
directoryPreferences.mutate({ action: 'recordRecent', path }),
})
+ const manualMediaMerge = new ManualMediaMerge({
+ createLog: (pluginId) => capabilityHost.createLog(pluginId),
+ registry: pluginRegistry,
+ host: pluginHost,
+ tasks: taskManager,
+ authorizePath: (file) =>
+ ctx.serverDirectoryService.resolvePreferenceDirectory(path.dirname(file)),
+ })
+
return {
+ [Commands.GetMediaMergeState]: async () => manualMediaMerge.state(),
+ [Commands.GetMediaMergeSelection]: async (value: unknown) =>
+ manualMediaMerge.selection(value),
+ [Commands.StartMediaMerge]: async (value: unknown) =>
+ manualMediaMerge.start(value),
+ [Commands.GetMediaMergeJob]: async (value: unknown) =>
+ manualMediaMerge.get(value),
+ [Commands.CancelMediaMerge]: async (value: unknown) =>
+ manualMediaMerge.cancel(value),
[Commands.InstallFfmpeg]: async (payload: unknown) => {
z.undefined().parse(payload)
return { ok: false, error: 'unsupported' }
diff --git a/src/server/ipc/queries.ts b/src/server/ipc/queries.ts
index 56a69078..d5a463f5 100644
--- a/src/server/ipc/queries.ts
+++ b/src/server/ipc/queries.ts
@@ -131,7 +131,7 @@ export interface ServerQueryContext {
downloadPathPolicy: ServerDownloadPathPolicy
serverDirectoryService: Pick<
ServerDirectoryService,
- 'list' | 'validate' | 'locations'
+ 'list' | 'validate' | 'validateFile' | 'locations'
>
environment: NodeJS.ProcessEnv
}
@@ -194,6 +194,8 @@ export function buildServerQueryHandlers(
},
[Queries.ListServerDirectories]: async (request: unknown) =>
ctx.serverDirectoryService.list(request),
+ [Queries.ValidateServerFile]: async (request: unknown) =>
+ ctx.serverDirectoryService.validateFile(request),
[Queries.ValidateServerDirectory]: async (request: unknown) =>
ctx.serverDirectoryService.validate(request),
[Queries.GetDisclaimerState]: async () => ({
diff --git a/src/server/server-directory-service.test.ts b/src/server/server-directory-service.test.ts
index 03c6be87..f9f3ad96 100644
--- a/src/server/server-directory-service.test.ts
+++ b/src/server/server-directory-service.test.ts
@@ -638,3 +638,101 @@ describe('ServerDirectoryService locations', () => {
expect(fs.mkdir).not.toHaveBeenCalled()
})
})
+
+describe('server file selection', () => {
+ it('keeps directory-only results stable and includes only readable authorized files on request', async () => {
+ const { root, downloads, service } = await fixture()
+ await mkdir(path.join(downloads, 'folder'))
+ await writeFile(path.join(downloads, 'video.mp4'), 'video')
+ await writeFile(path.join(downloads, '.hidden.mp4'), 'hidden')
+ await writeFile(path.join(root, 'private.mp4'), 'private')
+ await symlink(
+ path.join(root, 'private.mp4'),
+ path.join(downloads, 'escape.mp4')
+ )
+ await symlink(
+ path.join(downloads, 'video.mp4'),
+ path.join(downloads, 'alias.mp4')
+ )
+ const directories = await service.list({ path: downloads })
+ expect(
+ directories.ok && directories.value.entries.map((entry) => entry.name)
+ ).toEqual(['folder'])
+ const files = await service.list({ path: downloads, includeFiles: true })
+ expect(
+ files.ok && files.value.entries.map((entry) => [entry.name, entry.kind])
+ ).toEqual([
+ ['alias.mp4', 'file'],
+ ['folder', 'directory'],
+ ['video.mp4', 'file'],
+ ])
+ expect(
+ await service.validateFile({
+ kind: 'open',
+ path: path.join(downloads, 'escape.mp4'),
+ })
+ ).toEqual({ ok: false, error: { code: 'outsideRoots' } })
+ expect(
+ await service.validateFile({
+ kind: 'open',
+ path: path.join(downloads, 'alias.mp4'),
+ })
+ ).toEqual({ ok: true, value: { path: path.join(downloads, 'alias.mp4') } })
+ })
+
+ it('initializes file paths in their parent and revalidates deleted or non-file inputs', async () => {
+ const { downloads, service } = await fixture()
+ const file = path.join(downloads, 'video.mp4')
+ await writeFile(file, 'video')
+ expect(
+ await service.list({ path: file, includeFiles: true, initialFile: true })
+ ).toMatchObject({
+ ok: true,
+ value: { path: downloads, separator: path.sep, initialName: 'video.mp4' },
+ })
+ expect(
+ await service.validateFile({ kind: 'open', path: downloads })
+ ).toMatchObject({ ok: false })
+ await rm(file)
+ expect(await service.validateFile({ kind: 'open', path: file })).toEqual({
+ ok: false,
+ error: { code: 'notFound' },
+ })
+ })
+
+ it('validates new output names without creating files or replacing files and dangling links', async () => {
+ const { root, downloads, service } = await fixture()
+ const output = {
+ kind: 'save',
+ parentPath: downloads,
+ name: 'merged.mp4',
+ extensions: ['mp4', 'mkv'],
+ }
+ expect(await service.validateFile(output)).toEqual({
+ ok: true,
+ value: { path: path.join(downloads, output.name) },
+ })
+ expect(await readdir(downloads)).toEqual([])
+ await writeFile(path.join(downloads, output.name), 'keep')
+ expect(await service.validateFile(output)).toEqual({
+ ok: false,
+ error: { code: 'alreadyExists' },
+ })
+ await symlink(
+ path.join(root, 'missing'),
+ path.join(downloads, 'dangling.mp4')
+ )
+ expect(
+ await service.validateFile({ ...output, name: 'dangling.mp4' })
+ ).toEqual({ ok: false, error: { code: 'alreadyExists' } })
+ expect(await service.validateFile({ ...output, parentPath: root })).toEqual(
+ { ok: false, error: { code: 'outsideRoots' } }
+ )
+ expect(
+ await service.validateFile({ ...output, name: '../escape.mp4' })
+ ).toEqual({ ok: false, error: { code: 'invalidName' } })
+ expect(
+ await service.validateFile({ ...output, name: 'wrong.txt' })
+ ).toEqual({ ok: false, error: { code: 'unsupportedFileType' } })
+ })
+})
diff --git a/src/server/server-directory-service.ts b/src/server/server-directory-service.ts
index 52ef47ea..e1831191 100644
--- a/src/server/server-directory-service.ts
+++ b/src/server/server-directory-service.ts
@@ -1,5 +1,5 @@
import { constants } from 'node:fs'
-import { access, mkdir, opendir } from 'node:fs/promises'
+import { access, lstat, mkdir, opendir, realpath, stat } from 'node:fs/promises'
import { homedir } from 'node:os'
import path from 'node:path'
import { AppError } from '@shared/errors'
@@ -21,6 +21,7 @@ import {
ValidateServerDirectoryRequestSchema,
type ValidateServerDirectoryResult,
ValidateServerDirectoryResultSchema,
+ ValidateServerFileRequestSchema,
} from '@shared/schemas/server-directory'
import type { MotrixAppSettings } from '@shared/types/settings'
import {
@@ -204,11 +205,66 @@ export class ServerDirectoryService {
}
}
+ private async readableFile(value: string) {
+ // Check both the user-visible parent and the resolved target's parent, so
+ // a symlink cannot expose a file outside the configured download roots.
+ const parent = await this.policy.authorizeDirectory(path.dirname(value))
+ const logicalPath = path.join(parent.path, path.basename(value))
+ const canonical = await realpath(logicalPath)
+ await this.policy.authorizeDirectory(path.dirname(canonical))
+ const info = await stat(canonical)
+ if (!info.isFile())
+ throw new DirectoryAuthorizationError('notFile', 'Not a regular file')
+ await this.fs.access(canonical, constants.R_OK)
+ return { path: logicalPath, modifiedAt: info.mtimeMs }
+ }
+
+ async validateFile(raw: unknown): Promise<ValidateServerDirectoryResult> {
+ const parsed = ValidateServerFileRequestSchema.safeParse(raw)
+ if (!parsed.success) return failure('invalidPath')
+ const request = parsed.data
+ try {
+ const name =
+ request.kind === 'open' ? path.basename(request.path) : request.name
+ if (!validName(name)) return failure('invalidName')
+ if (
+ request.extensions?.length &&
+ !request.extensions.some((ext) =>
+ name.toLowerCase().endsWith(`.${ext.toLowerCase()}`)
+ )
+ )
+ return failure('unsupportedFileType')
+ if (request.kind === 'open') {
+ const file = await this.readableFile(request.path)
+ return { ok: true, value: { path: file.path } }
+ }
+ const parent = await this.policy.authorizeDirectory(request.parentPath)
+ if (!(await this.writable(parent))) return failure('permissionDenied')
+ const output = path.join(parent.path, request.name)
+ if (output.length > SERVER_DIRECTORY_PATH_LIMIT)
+ return failure('tooLarge')
+ try {
+ await lstat(output)
+ return failure('alreadyExists')
+ } catch (error) {
+ if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error
+ }
+ // Validation never creates an output file. The merge service still owns
+ // atomic non-replacing publication if a name appears after selection.
+ return { ok: true, value: { path: output } }
+ } catch (error) {
+ return failure(errorCode(error))
+ }
+ }
+
async list(raw: unknown): Promise<ListServerDirectoriesResult> {
const request = ListServerDirectoriesRequestSchema.safeParse(raw)
if (!request.success) return failure('invalidPath')
try {
- const directory = await this.policy.authorizeDirectory(request.data.path)
+ const initialFile = request.data.includeFiles && request.data.initialFile
+ const directory = await this.policy.authorizeDirectory(
+ initialFile ? path.dirname(request.data.path) : request.data.path
+ )
await this.fs.access(
directory.canonicalPath,
constants.R_OK | constants.X_OK
@@ -229,17 +285,35 @@ export class ServerDirectoryService {
if (!entry) break
scanned++
if (!request.data.showHidden && entry.name.startsWith('.')) continue
- if (!entry.isDirectory() && !entry.isSymbolicLink()) continue
+ if (
+ !entry.isDirectory() &&
+ !entry.isSymbolicLink() &&
+ !(request.data.includeFiles && entry.isFile())
+ )
+ continue
const childPath = path.join(directory.path, entry.name)
if (childPath.length > SERVER_DIRECTORY_PATH_LIMIT) {
truncated = true
continue
}
try {
- const child = await this.policy.authorizeDirectory(childPath)
+ let kind: 'directory' | 'file' = 'directory'
+ let child: { path: string; modifiedAt?: number }
+ try {
+ child = await this.policy.authorizeDirectory(childPath)
+ } catch (error) {
+ if (
+ !request.data.includeFiles ||
+ errorCode(error) !== 'notDirectory'
+ )
+ throw error
+ child = await this.readableFile(childPath)
+ kind = 'file'
+ }
entries.push({
name: entry.name,
path: child.path,
+ ...(request.data.includeFiles ? { kind } : {}),
...(Number.isFinite(child.modifiedAt)
? { modifiedAt: child.modifiedAt }
: {}),
@@ -254,6 +328,7 @@ export class ServerDirectoryService {
'outsideRoots',
'notFound',
'notDirectory',
+ 'notFile',
'permissionDenied',
].includes(errorCode(error))
)
@@ -281,6 +356,10 @@ export class ServerDirectoryService {
entries,
truncated,
canCreate: await this.writable(directory),
+ ...(request.data.includeFiles ? { separator: path.sep } : {}),
+ ...(initialFile
+ ? { initialName: path.basename(request.data.path) }
+ : {}),
},
})
} catch (error) {
diff --git a/src/shared/locales/ar.json b/src/shared/locales/ar.json
index 6bef09f9..86d9e9c7 100644
--- a/src/shared/locales/ar.json
+++ b/src/shared/locales/ar.json
@@ -84,7 +84,9 @@
"outsideRoots": "هذا المجلد خارج المواقع المسموح بها.",
"permissionDenied": "ليس لديك إذن لاستخدام هذا المجلد.",
"tooLarge": "هذا المسار أو اسم المجلد أطول من الحد المسموح.",
- "unavailable": "تعذّر على الخادم إكمال هذا الطلب. حاول مجددًا."
+ "unavailable": "تعذّر على الخادم إكمال هذا الطلب. حاول مجددًا.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "المجلد المطلوب غير متاح. جارٍ عرض {{path}}.",
"folderName": "اسم المجلد",
@@ -123,7 +125,34 @@
"title": "اختيار مجلد على الخادم",
"unknownOutcome": "تعذّر تأكيد الإنشاء. حدّث للتحقق قبل إنشاء مجلد آخر هنا.",
"up": "مستوى واحد للأعلى",
- "viewOptions": "خيارات العرض"
+ "viewOptions": "خيارات العرض",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "إضافة مجلد مفضل",
@@ -1392,7 +1421,9 @@
"uninstallConfirm": "إلغاء تثبيت هذه الإضافة؟ ستُحذف بياناتها.",
"uninstallConfirmDesc": "ستُزال الإضافة وإعداداتها المخزّنة من Motrix.",
"uninstallConfirmTitle": "إلغاء تثبيت {{name}}؟",
- "viewIssue": "عرض المشكلة"
+ "viewIssue": "عرض المشكلة",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1600,7 +1631,8 @@
},
"ffmpeg": {
"plain": "تعالج الصوت أو الفيديو.",
- "strong": "استخدام FFmpeg"
+ "strong": "استخدام FFmpeg",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -3014,5 +3046,49 @@
"waitingMerged": "تظهر المهام المنتظرة الآن ضمن النشطة. تم فتح هذا العرض.",
"stoppedSplit": "تُصنف المهام المتوقفة ضمن المكتملة والأخطاء. تم فتح جميع التنزيلات.",
"invalidStatus": "فئة التنزيل غير صالحة. تم فتح جميع التنزيلات."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/bg.json b/src/shared/locales/bg.json
index 2a9d0260..2ffeca89 100644
--- a/src/shared/locales/bg.json
+++ b/src/shared/locales/bg.json
@@ -84,7 +84,9 @@
"outsideRoots": "Тази папка е извън разрешените местоположения.",
"permissionDenied": "Нямате разрешение да използвате тази папка.",
"tooLarge": "Този път или име на папка е твърде дълго.",
- "unavailable": "Сървърът не можа да изпълни тази заявка. Опитайте отново."
+ "unavailable": "Сървърът не можа да изпълни тази заявка. Опитайте отново.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "Исканата папка е недостъпна. Показва се {{path}}.",
"folderName": "Име на папката",
@@ -123,7 +125,34 @@
"title": "Избор на папка на сървъра",
"unknownOutcome": "Създаването не можа да бъде потвърдено. Обновете, за да проверите, преди да създадете друга папка тук.",
"up": "Едно ниво нагоре",
- "viewOptions": "Опции за изгледа"
+ "viewOptions": "Опции за изгледа",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "Добавяне на любима папка",
@@ -1336,7 +1365,9 @@
"uninstallConfirm": "Деинсталиране на тази приставка? Данните ѝ ще бъдат премахнати.",
"uninstallConfirmDesc": "Това ще премахне приставката и запазените ѝ настройки от Motrix.",
"uninstallConfirmTitle": "Деинсталиране на {{name}}?",
- "viewIssue": "Преглед на проблема"
+ "viewIssue": "Преглед на проблема",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1528,7 +1559,8 @@
},
"ffmpeg": {
"plain": "Обработва аудио или видео.",
- "strong": "Използване на FFmpeg"
+ "strong": "Използване на FFmpeg",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -2926,5 +2958,49 @@
"waitingMerged": "Чакащите задачи вече са в Активни. Този изглед е отворен.",
"stoppedSplit": "Спрените задачи са разделени на Завършени и Грешки. Отворени са всички изтегляния.",
"invalidStatus": "Невалидна категория. Отворени са всички изтегляния."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/ca.json b/src/shared/locales/ca.json
index c8a76fa1..ae770246 100644
--- a/src/shared/locales/ca.json
+++ b/src/shared/locales/ca.json
@@ -84,7 +84,9 @@
"outsideRoots": "Aquesta carpeta és fora de les ubicacions permeses.",
"permissionDenied": "No teniu permís per utilitzar aquesta carpeta.",
"tooLarge": "Aquest camí o nom de carpeta és massa llarg.",
- "unavailable": "El servidor no ha pogut completar aquesta petició. Torneu-ho a provar."
+ "unavailable": "El servidor no ha pogut completar aquesta petició. Torneu-ho a provar.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "La carpeta sol·licitada no està disponible. Es mostra {{path}}.",
"folderName": "Nom de la carpeta",
@@ -123,7 +125,34 @@
"title": "Seleccionar una carpeta del servidor",
"unknownOutcome": "No s'ha pogut confirmar la creació. Actualitzeu la llista per comprovar-ho abans de crear una altra carpeta aquí.",
"up": "Pujar un nivell",
- "viewOptions": "Opcions de visualització"
+ "viewOptions": "Opcions de visualització",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "Afegir una carpeta preferida",
@@ -1350,7 +1379,9 @@
"uninstallConfirm": "Voleu desinstal·lar aquest connector? Se n'eliminaran les dades.",
"uninstallConfirmDesc": "Això suprimirà el connector i la seva configuració desada del Motrix.",
"uninstallConfirmTitle": "Voleu desinstal·lar {{name}}?",
- "viewIssue": "Veure el problema"
+ "viewIssue": "Veure el problema",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1546,7 +1577,8 @@
},
"ffmpeg": {
"plain": "Processa àudio o vídeo.",
- "strong": "Utilitzar l'FFmpeg"
+ "strong": "Utilitzar l'FFmpeg",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -2948,5 +2980,49 @@
"waitingMerged": "Les tasques en espera ara apareixen a Actives. S’ha obert aquesta vista.",
"stoppedSplit": "Les tasques aturades s’agrupen a Completades i Errors. S’han obert totes les baixades.",
"invalidStatus": "La categoria no és vàlida. S’han obert totes les baixades."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/de.json b/src/shared/locales/de.json
index e15c81ea..acc250f6 100644
--- a/src/shared/locales/de.json
+++ b/src/shared/locales/de.json
@@ -2414,7 +2414,9 @@
"removeTitle": "Plugin entfernen",
"removeDesc": "Beim Entfernen dieses Plugins werden auch seine in Motrix gespeicherten Daten gelöscht.",
"uninstallConfirmTitle": "{{name}} deinstallieren?",
- "uninstallConfirmDesc": "Das Plugin und seine gespeicherten Einstellungen werden aus Motrix entfernt."
+ "uninstallConfirmDesc": "Das Plugin und seine gespeicherten Einstellungen werden aus Motrix entfernt.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "Dieses Plugin fordert keine Berechtigungen an.",
@@ -2632,7 +2634,8 @@
},
"ffmpeg": {
"strong": "FFmpeg verwenden",
- "plain": "Verarbeitet Audio oder Video."
+ "plain": "Verarbeitet Audio oder Video.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Benachrichtigungen senden",
@@ -2847,7 +2850,9 @@
"invalidName": "Geben Sie einen gültigen Ordnernamen ein.",
"tooLarge": "Dieser Pfad oder Ordnername ist zu lang.",
"unavailable": "Der Server konnte diese Anfrage nicht abschließen. Versuchen Sie es erneut.",
- "creationOutcomeUnknown": "Die Erstellung konnte nicht bestätigt werden. Aktualisieren Sie die Liste zur Überprüfung, bevor Sie hier einen weiteren Ordner erstellen."
+ "creationOutcomeUnknown": "Die Erstellung konnte nicht bestätigt werden. Aktualisieren Sie die Liste zur Überprüfung, bevor Sie hier einen weiteren Ordner erstellen.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Häufige Orte",
@@ -2859,6 +2864,33 @@
"downloads": "Downloads",
"root": "Dateisystem",
"loadFailed": "Einige Speicherorte konnten nicht geladen werden."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2926,5 +2958,49 @@
"waitingMerged": "Wartende Aufgaben werden jetzt unter Aktiv angezeigt. Aktiv wurde geöffnet.",
"stoppedSplit": "Gestoppte Aufgaben sind jetzt unter Abgeschlossen und Fehler zu finden. Alle Downloads wurden geöffnet.",
"invalidStatus": "Diese Download-Kategorie ist ungültig. Alle Downloads wurden geöffnet."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/el.json b/src/shared/locales/el.json
index 56acf135..430ba173 100644
--- a/src/shared/locales/el.json
+++ b/src/shared/locales/el.json
@@ -84,7 +84,9 @@
"outsideRoots": "Αυτός ο φάκελος βρίσκεται εκτός των επιτρεπόμενων τοποθεσιών.",
"permissionDenied": "Δεν έχετε δικαίωμα χρήσης αυτού του φακέλου.",
"tooLarge": "Το μήκος της διαδρομής ή του ονόματος φακέλου είναι υπερβολικό.",
- "unavailable": "Ο διακομιστής δεν μπόρεσε να ολοκληρώσει αυτό το αίτημα. Δοκιμάστε ξανά."
+ "unavailable": "Ο διακομιστής δεν μπόρεσε να ολοκληρώσει αυτό το αίτημα. Δοκιμάστε ξανά.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "Ο ζητούμενος φάκελος δεν είναι διαθέσιμος. Εμφανίζεται το {{path}}.",
"folderName": "Όνομα φακέλου",
@@ -123,7 +125,34 @@
"title": "Επιλογή φακέλου διακομιστή",
"unknownOutcome": "Δεν ήταν δυνατή η επιβεβαίωση της δημιουργίας. Κάντε ανανέωση για έλεγχο πριν δημιουργήσετε άλλον φάκελο εδώ.",
"up": "Ένα επίπεδο πάνω",
- "viewOptions": "Επιλογές προβολής"
+ "viewOptions": "Επιλογές προβολής",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "Προσθήκη αγαπημένου",
@@ -1336,7 +1365,9 @@
"uninstallConfirm": "Να απεγκατασταθεί αυτό το πρόσθετο; Τα δεδομένα του θα αφαιρεθούν.",
"uninstallConfirmDesc": "Αυτό θα αφαιρέσει το πρόσθετο και τις αποθηκευμένες ρυθμίσεις του από το Motrix.",
"uninstallConfirmTitle": "Να απεγκατασταθεί το {{name}};",
- "viewIssue": "Προβολή προβλήματος"
+ "viewIssue": "Προβολή προβλήματος",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1528,7 +1559,8 @@
},
"ffmpeg": {
"plain": "Επεξεργάζεται ήχο ή βίντεο.",
- "strong": "Χρήση FFmpeg"
+ "strong": "Χρήση FFmpeg",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -2926,5 +2958,49 @@
"waitingMerged": "Οι εργασίες σε αναμονή εμφανίζονται πλέον στις Ενεργές. Άνοιξε αυτή η προβολή.",
"stoppedSplit": "Οι σταματημένες εργασίες χωρίζονται σε Ολοκληρωμένες και Σφάλματα. Άνοιξαν όλες οι λήψεις.",
"invalidStatus": "Μη έγκυρη κατηγορία. Άνοιξαν όλες οι λήψεις."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/en-US.json b/src/shared/locales/en-US.json
index cc1ce31a..48771c67 100644
--- a/src/shared/locales/en-US.json
+++ b/src/shared/locales/en-US.json
@@ -2414,7 +2414,9 @@
"removeTitle": "Remove plugin",
"removeDesc": "Removing this plugin also deletes its data stored in Motrix.",
"uninstallConfirmTitle": "Uninstall {{name}}?",
- "uninstallConfirmDesc": "This will remove the plugin and its stored settings from Motrix."
+ "uninstallConfirmDesc": "This will remove the plugin and its stored settings from Motrix.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "This plugin requests no permissions.",
@@ -2632,7 +2634,8 @@
},
"ffmpeg": {
"strong": "Use FFmpeg",
- "plain": "Processes audio or video."
+ "plain": "Processes audio or video.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Send notifications",
@@ -2847,7 +2850,9 @@
"invalidName": "Enter a valid folder name.",
"tooLarge": "This path or folder name is too long.",
"unavailable": "The server could not complete this request. Try again.",
- "creationOutcomeUnknown": "Creation could not be confirmed. Refresh to check before creating another folder here."
+ "creationOutcomeUnknown": "Creation could not be confirmed. Refresh to check before creating another folder here.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Common places",
@@ -2859,6 +2864,33 @@
"downloads": "Downloads",
"root": "File system",
"loadFailed": "Some folder locations couldn’t be loaded."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2926,5 +2958,49 @@
"waitingMerged": "Waiting tasks are now shown in Active. The Active view has been opened.",
"stoppedSplit": "Stopped tasks are now grouped under Completed and Error. All downloads have been opened.",
"invalidStatus": "This download category is invalid. All downloads have been opened."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Bring your video and audio together in one file, without re-encoding.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Save as MP4 or MKV with a new filename. If MP4 is incompatible, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/es.json b/src/shared/locales/es.json
index 4545accb..290ba945 100644
--- a/src/shared/locales/es.json
+++ b/src/shared/locales/es.json
@@ -2431,7 +2431,9 @@
"uninstallConfirmTitle": "¿Desinstalar {{name}}?",
"uninstallConfirmDesc": "Se quitarán el plugin y sus ajustes guardados de Motrix.",
"healthIssues_many": "{{count}} problemas registrados en las últimas 24 horas",
- "accessHosts_many": "Puede leer {{count}} sitios web"
+ "accessHosts_many": "Puede leer {{count}} sitios web",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "Este plugin no solicita permisos.",
@@ -2652,7 +2654,8 @@
},
"ffmpeg": {
"strong": "Usar FFmpeg",
- "plain": "Procesa audio o vídeo."
+ "plain": "Procesa audio o vídeo.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Enviar notificaciones",
@@ -2869,7 +2872,9 @@
"invalidName": "Introduce un nombre de carpeta válido.",
"tooLarge": "Esta ruta o nombre de carpeta es demasiado largo.",
"unavailable": "El servidor no pudo completar esta solicitud. Vuelve a intentarlo.",
- "creationOutcomeUnknown": "No se pudo confirmar la creación. Actualiza para comprobarlo antes de crear otra carpeta aquí."
+ "creationOutcomeUnknown": "No se pudo confirmar la creación. Actualiza para comprobarlo antes de crear otra carpeta aquí.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Ubicaciones habituales",
@@ -2881,6 +2886,33 @@
"downloads": "Descargas",
"root": "Sistema de archivos",
"loadFailed": "No se pudieron cargar algunas ubicaciones de carpetas."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2948,5 +2980,49 @@
"waitingMerged": "Las tareas en espera ahora aparecen en Activas. Se ha abierto esa vista.",
"stoppedSplit": "Las tareas detenidas se agrupan en Completadas y Errores. Se han abierto todas las descargas.",
"invalidStatus": "La categoría no es válida. Se han abierto todas las descargas."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/fa.json b/src/shared/locales/fa.json
index a65660e1..15163501 100644
--- a/src/shared/locales/fa.json
+++ b/src/shared/locales/fa.json
@@ -84,7 +84,9 @@
"outsideRoots": "این پوشه خارج از مکان‌های مجاز است.",
"permissionDenied": "مجوز استفاده از این پوشه را ندارید.",
"tooLarge": "مسیر یا نام این پوشه بیش از حد طولانی است.",
- "unavailable": "سرور نتوانست این درخواست را تکمیل کند. دوباره تلاش کنید."
+ "unavailable": "سرور نتوانست این درخواست را تکمیل کند. دوباره تلاش کنید.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "پوشهٔ درخواستی در دسترس نیست. {{path}} نمایش داده می‌شود.",
"folderName": "نام پوشه",
@@ -123,7 +125,34 @@
"title": "انتخاب پوشهٔ سرور",
"unknownOutcome": "ساخته شدن پوشه تأیید نشد. پیش از ساخت پوشه‌ای دیگر در اینجا، فهرست را تازه‌سازی و بررسی کنید.",
"up": "یک سطح بالاتر",
- "viewOptions": "گزینه‌های نمایش"
+ "viewOptions": "گزینه‌های نمایش",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "افزودن به دلخواه‌ها",
@@ -1336,7 +1365,9 @@
"uninstallConfirm": "این افزونه حذف نصب شود؟ داده‌های آن حذف خواهند شد.",
"uninstallConfirmDesc": "افزونه و تنظیمات ذخیره‌شدهٔ آن از Motrix حذف می‌شوند.",
"uninstallConfirmTitle": "{{name}} حذف نصب شود؟",
- "viewIssue": "مشاهدهٔ مشکل"
+ "viewIssue": "مشاهدهٔ مشکل",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1528,7 +1559,8 @@
},
"ffmpeg": {
"plain": "صدا یا ویدیو را پردازش می‌کند.",
- "strong": "استفاده از FFmpeg"
+ "strong": "استفاده از FFmpeg",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -2926,5 +2958,49 @@
"waitingMerged": "کارهای منتظر اکنون در بخش فعال نمایش داده می‌شوند. این نما باز شد.",
"stoppedSplit": "کارهای متوقف‌شده در بخش‌های تکمیل‌شده و خطا قرار دارند. همهٔ بارگیری‌ها باز شد.",
"invalidStatus": "دستهٔ بارگیری نامعتبر است. همهٔ بارگیری‌ها باز شد."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/fr.json b/src/shared/locales/fr.json
index e59595e1..053ad039 100644
--- a/src/shared/locales/fr.json
+++ b/src/shared/locales/fr.json
@@ -84,7 +84,9 @@
"outsideRoots": "Ce dossier se trouve en dehors des emplacements autorisés.",
"permissionDenied": "Vous n’avez pas l’autorisation d’utiliser ce dossier.",
"tooLarge": "Ce chemin ou ce nom de dossier est trop long.",
- "unavailable": "Le serveur n’a pas pu traiter cette demande. Réessayez."
+ "unavailable": "Le serveur n’a pas pu traiter cette demande. Réessayez.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "Le dossier demandé est indisponible. Affichage de {{path}}.",
"folderName": "Nom du dossier",
@@ -123,7 +125,34 @@
"title": "Choisir un dossier du serveur",
"unknownOutcome": "La création n’a pas pu être confirmée. Actualisez la liste avant de créer un autre dossier ici.",
"up": "Remonter d’un niveau",
- "viewOptions": "Options d’affichage"
+ "viewOptions": "Options d’affichage",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "Ajouter un favori",
@@ -1350,7 +1379,9 @@
"uninstallConfirm": "Désinstaller cette extension ? Ses données seront supprimées.",
"uninstallConfirmDesc": "L’extension et ses paramètres enregistrés seront supprimés de Motrix.",
"uninstallConfirmTitle": "Désinstaller {{name}} ?",
- "viewIssue": "Voir le problème"
+ "viewIssue": "Voir le problème",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1546,7 +1577,8 @@
},
"ffmpeg": {
"plain": "Traite des fichiers audio ou vidéo.",
- "strong": "Utiliser FFmpeg"
+ "strong": "Utiliser FFmpeg",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -2948,5 +2980,49 @@
"waitingMerged": "Les tâches en attente figurent désormais dans Actifs. Cette vue a été ouverte.",
"stoppedSplit": "Les tâches arrêtées sont classées dans Terminés et Erreurs. Tous les téléchargements ont été ouverts.",
"invalidStatus": "Cette catégorie est invalide. Tous les téléchargements ont été ouverts."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/hu.json b/src/shared/locales/hu.json
index 609934dd..9c5b31b2 100644
--- a/src/shared/locales/hu.json
+++ b/src/shared/locales/hu.json
@@ -2414,7 +2414,9 @@
"removeTitle": "Bővítmény eltávolítása",
"removeDesc": "A bővítmény eltávolításával a Motrixban tárolt adatai is törlődnek.",
"uninstallConfirmTitle": "Eltávolítod a(z) {{name}} bővítményt?",
- "uninstallConfirmDesc": "Ezzel a bővítmény és a Motrixban tárolt beállításai is törlődnek."
+ "uninstallConfirmDesc": "Ezzel a bővítmény és a Motrixban tárolt beállításai is törlődnek.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "Ez a bővítmény nem kér engedélyeket.",
@@ -2632,7 +2634,8 @@
},
"ffmpeg": {
"strong": "FFmpeg használata",
- "plain": "Hang- vagy videótartalmat dolgoz fel."
+ "plain": "Hang- vagy videótartalmat dolgoz fel.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Értesítések küldése",
@@ -2847,7 +2850,9 @@
"invalidName": "Adj meg érvényes mappanevet.",
"tooLarge": "Az elérési út vagy a mappanév túl hosszú.",
"unavailable": "A szerver nem tudta végrehajtani a kérést. Próbáld újra.",
- "creationOutcomeUnknown": "A létrehozás eredménye nem erősíthető meg. Újabb mappa létrehozása előtt frissítsd a nézetet."
+ "creationOutcomeUnknown": "A létrehozás eredménye nem erősíthető meg. Újabb mappa létrehozása előtt frissítsd a nézetet.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Gyakori helyek",
@@ -2859,6 +2864,33 @@
"downloads": "Letöltések",
"root": "Fájlrendszer",
"loadFailed": "Néhány mappahelyet nem sikerült betölteni."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2926,5 +2958,49 @@
"waitingMerged": "A várakozó feladatok most az Aktív nézetben találhatók. Ez a nézet megnyílt.",
"stoppedSplit": "A leállított feladatok a Befejezett és Hiba csoportokba kerültek. Az összes letöltés megnyílt.",
"invalidStatus": "Érvénytelen letöltési kategória. Az összes letöltés megnyílt."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/id.json b/src/shared/locales/id.json
index 55a39b4f..1c463962 100644
--- a/src/shared/locales/id.json
+++ b/src/shared/locales/id.json
@@ -2396,7 +2396,9 @@
"removeTitle": "Hapus plugin",
"removeDesc": "Menghapus plugin ini juga menghapus datanya yang tersimpan di Motrix.",
"uninstallConfirmTitle": "Copot {{name}}?",
- "uninstallConfirmDesc": "Plugin dan pengaturannya yang tersimpan akan dihapus dari Motrix."
+ "uninstallConfirmDesc": "Plugin dan pengaturannya yang tersimpan akan dihapus dari Motrix.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "Plugin ini tidak meminta izin apa pun.",
@@ -2611,7 +2613,8 @@
},
"ffmpeg": {
"strong": "Gunakan FFmpeg",
- "plain": "Memproses audio atau video."
+ "plain": "Memproses audio atau video.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Kirim notifikasi",
@@ -2825,7 +2828,9 @@
"invalidName": "Masukkan nama folder yang valid.",
"tooLarge": "Jalur atau nama folder ini terlalu panjang.",
"unavailable": "Server tidak dapat menyelesaikan permintaan ini. Coba lagi.",
- "creationOutcomeUnknown": "Pembuatan folder belum dapat dikonfirmasi. Muat ulang untuk memeriksa sebelum membuat folder lain di sini."
+ "creationOutcomeUnknown": "Pembuatan folder belum dapat dikonfirmasi. Muat ulang untuk memeriksa sebelum membuat folder lain di sini.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Lokasi umum",
@@ -2837,6 +2842,33 @@
"downloads": "Unduhan",
"root": "Sistem berkas",
"loadFailed": "Beberapa lokasi folder tidak dapat dimuat."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2904,5 +2936,49 @@
"waitingMerged": "Tugas menunggu kini ditampilkan di Aktif. Tampilan Aktif telah dibuka.",
"stoppedSplit": "Tugas yang dihentikan dikelompokkan ke Selesai dan Galat. Semua unduhan telah dibuka.",
"invalidStatus": "Kategori unduhan tidak valid. Semua unduhan telah dibuka."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/it.json b/src/shared/locales/it.json
index d8a5ff54..60e1421b 100644
--- a/src/shared/locales/it.json
+++ b/src/shared/locales/it.json
@@ -2432,7 +2432,9 @@
"removeTitle": "Rimuovi plugin",
"removeDesc": "La rimozione del plugin elimina anche i suoi dati salvati in Motrix.",
"uninstallConfirmTitle": "Disinstallare {{name}}?",
- "uninstallConfirmDesc": "Il plugin e le sue impostazioni salvate verranno rimossi da Motrix."
+ "uninstallConfirmDesc": "Il plugin e le sue impostazioni salvate verranno rimossi da Motrix.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "Questo plugin non richiede autorizzazioni.",
@@ -2653,7 +2655,8 @@
},
"ffmpeg": {
"strong": "Usare FFmpeg",
- "plain": "Elabora audio o video."
+ "plain": "Elabora audio o video.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Inviare notifiche",
@@ -2869,7 +2872,9 @@
"invalidName": "Inserisci un nome valido per la cartella.",
"tooLarge": "Il percorso o il nome della cartella è troppo lungo.",
"unavailable": "Il server non ha potuto completare la richiesta. Riprova.",
- "creationOutcomeUnknown": "Impossibile confermare la creazione. Aggiorna per verificare prima di creare un’altra cartella qui."
+ "creationOutcomeUnknown": "Impossibile confermare la creazione. Aggiorna per verificare prima di creare un’altra cartella qui.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Posizioni comuni",
@@ -2881,6 +2886,33 @@
"downloads": "Download",
"root": "File system",
"loadFailed": "Impossibile caricare alcune posizioni delle cartelle."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2948,5 +2980,49 @@
"waitingMerged": "Le attività in attesa sono ora incluse in Attive. È stata aperta questa vista.",
"stoppedSplit": "Le attività arrestate sono raggruppate in Completate ed Errori. Sono stati aperti tutti i download.",
"invalidStatus": "La categoria non è valida. Sono stati aperti tutti i download."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/ja.json b/src/shared/locales/ja.json
index 5494531e..e0e058a7 100644
--- a/src/shared/locales/ja.json
+++ b/src/shared/locales/ja.json
@@ -2396,7 +2396,9 @@
"removeTitle": "プラグインを削除",
"removeDesc": "このプラグインを削除すると、Motrix に保存されたプラグインのデータも削除されます。",
"uninstallConfirmTitle": "{{name}} をアンインストールしますか?",
- "uninstallConfirmDesc": "プラグインと保存済みの設定を Motrix から削除します。"
+ "uninstallConfirmDesc": "プラグインと保存済みの設定を Motrix から削除します。",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "このプラグインは権限を要求していません。",
@@ -2611,7 +2613,8 @@
},
"ffmpeg": {
"strong": "FFmpeg の使用",
- "plain": "音声や動画を処理します。"
+ "plain": "音声や動画を処理します。",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "通知の送信",
@@ -2825,7 +2828,9 @@
"invalidName": "有効なフォルダー名を入力してください。",
"tooLarge": "パスまたはフォルダー名が長すぎます。",
"unavailable": "サーバーがこのリクエストを完了できませんでした。もう一度お試しください。",
- "creationOutcomeUnknown": "作成結果を確認できていません。同じ場所に別のフォルダーを作成する前に、更新して確認してください。"
+ "creationOutcomeUnknown": "作成結果を確認できていません。同じ場所に別のフォルダーを作成する前に、更新して確認してください。",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "よく使う場所",
@@ -2837,6 +2842,33 @@
"downloads": "ダウンロード",
"root": "ファイルシステム",
"loadFailed": "一部のフォルダーの場所を読み込めませんでした。"
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2904,5 +2936,49 @@
"waitingMerged": "待機中のタスクはアクティブに統合されました。アクティブを開きました。",
"stoppedSplit": "停止済みタスクは完了とエラーに分類されます。すべてのダウンロードを開きました。",
"invalidStatus": "ダウンロードの分類が無効です。すべてのダウンロードを開きました。"
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/ko.json b/src/shared/locales/ko.json
index c5e93d69..9deb8f28 100644
--- a/src/shared/locales/ko.json
+++ b/src/shared/locales/ko.json
@@ -2396,7 +2396,9 @@
"removeTitle": "플러그인 제거",
"removeDesc": "이 플러그인을 제거하면 Motrix에 저장된 플러그인 데이터도 삭제됩니다.",
"uninstallConfirmTitle": "{{name}}을(를) 제거하시겠습니까?",
- "uninstallConfirmDesc": "Motrix에서 플러그인과 저장된 설정을 제거합니다."
+ "uninstallConfirmDesc": "Motrix에서 플러그인과 저장된 설정을 제거합니다.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "이 플러그인은 권한을 요청하지 않습니다.",
@@ -2611,7 +2613,8 @@
},
"ffmpeg": {
"strong": "FFmpeg 사용",
- "plain": "오디오 또는 비디오를 처리합니다."
+ "plain": "오디오 또는 비디오를 처리합니다.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "알림 보내기",
@@ -2825,7 +2828,9 @@
"invalidName": "올바른 폴더 이름을 입력하세요.",
"tooLarge": "경로 또는 폴더 이름이 너무 깁니다.",
"unavailable": "서버가 요청을 완료하지 못했습니다. 다시 시도하세요.",
- "creationOutcomeUnknown": "폴더 생성 여부를 확인하지 못했습니다. 여기에 다른 폴더를 만들기 전에 새로고침하여 확인하세요."
+ "creationOutcomeUnknown": "폴더 생성 여부를 확인하지 못했습니다. 여기에 다른 폴더를 만들기 전에 새로고침하여 확인하세요.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "자주 사용하는 위치",
@@ -2837,6 +2842,33 @@
"downloads": "다운로드",
"root": "파일 시스템",
"loadFailed": "일부 폴더 위치를 불러오지 못했습니다."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2904,5 +2936,49 @@
"waitingMerged": "대기 작업이 활성 작업에 통합되었습니다. 활성 작업을 열었습니다.",
"stoppedSplit": "중지된 작업은 완료 및 오류로 분류됩니다. 모든 다운로드를 열었습니다.",
"invalidStatus": "잘못된 다운로드 분류입니다. 모든 다운로드를 열었습니다."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/nb.json b/src/shared/locales/nb.json
index 6fda569e..bed82e63 100644
--- a/src/shared/locales/nb.json
+++ b/src/shared/locales/nb.json
@@ -84,7 +84,9 @@
"outsideRoots": "Denne mappen er utenfor de tillatte plasseringene.",
"permissionDenied": "Du har ikke tillatelse til å bruke denne mappen.",
"tooLarge": "Stien eller mappenavnet har for mange tegn.",
- "unavailable": "Serveren kunne ikke fullføre denne forespørselen. Prøv igjen."
+ "unavailable": "Serveren kunne ikke fullføre denne forespørselen. Prøv igjen.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "Den forespurte mappen er utilgjengelig. Viser {{path}}.",
"folderName": "Mappenavn",
@@ -123,7 +125,34 @@
"title": "Velg servermappe",
"unknownOutcome": "Opprettelsen kunne ikke bekreftes. Oppdater for å kontrollere før du oppretter en ny mappe her.",
"up": "Opp ett nivå",
- "viewOptions": "Visningsvalg"
+ "viewOptions": "Visningsvalg",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "Legg til favoritt",
@@ -1336,7 +1365,9 @@
"uninstallConfirm": "Avinstallere dette programtillegget? Dataene blir fjernet.",
"uninstallConfirmDesc": "Dette fjerner programtillegget og de lagrede innstillingene fra Motrix.",
"uninstallConfirmTitle": "Avinstallere {{name}}?",
- "viewIssue": "Vis problem"
+ "viewIssue": "Vis problem",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1528,7 +1559,8 @@
},
"ffmpeg": {
"plain": "Behandler lyd eller video.",
- "strong": "Bruk FFmpeg"
+ "strong": "Bruk FFmpeg",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -2926,5 +2958,49 @@
"waitingMerged": "Ventende oppgaver vises nå under Aktive. Denne visningen er åpnet.",
"stoppedSplit": "Stoppede oppgaver er gruppert under Fullførte og Feil. Alle nedlastinger er åpnet.",
"invalidStatus": "Ugyldig nedlastingskategori. Alle nedlastinger er åpnet."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/nl.json b/src/shared/locales/nl.json
index fa10bdb5..1246590a 100644
--- a/src/shared/locales/nl.json
+++ b/src/shared/locales/nl.json
@@ -84,7 +84,9 @@
"outsideRoots": "Deze map bevindt zich buiten de toegestane locaties.",
"permissionDenied": "Je hebt geen toestemming om deze map te gebruiken.",
"tooLarge": "Het pad of de mapnaam is te lang.",
- "unavailable": "De server kon dit verzoek niet voltooien. Probeer het opnieuw."
+ "unavailable": "De server kon dit verzoek niet voltooien. Probeer het opnieuw.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "De opgevraagde map is niet beschikbaar. {{path}} wordt getoond.",
"folderName": "Mapnaam",
@@ -123,7 +125,34 @@
"title": "Servermap kiezen",
"unknownOutcome": "Het aanmaken kon niet worden bevestigd. Vernieuw om dit te controleren voordat je hier nog een map aanmaakt.",
"up": "Eén niveau omhoog",
- "viewOptions": "Weergaveopties"
+ "viewOptions": "Weergaveopties",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "Favoriet toevoegen",
@@ -1336,7 +1365,9 @@
"uninstallConfirm": "Deze plug-in de-installeren? De bijbehorende gegevens worden verwijderd.",
"uninstallConfirmDesc": "Hiermee worden de plug-in en de opgeslagen instellingen uit Motrix verwijderd.",
"uninstallConfirmTitle": "{{name}} de-installeren?",
- "viewIssue": "Probleem bekijken"
+ "viewIssue": "Probleem bekijken",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1528,7 +1559,8 @@
},
"ffmpeg": {
"plain": "Verwerkt audio of video.",
- "strong": "FFmpeg gebruiken"
+ "strong": "FFmpeg gebruiken",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -2926,5 +2958,49 @@
"waitingMerged": "Wachtende taken staan nu onder Actief. Deze weergave is geopend.",
"stoppedSplit": "Gestopte taken staan onder Voltooid en Fouten. Alle downloads zijn geopend.",
"invalidStatus": "Deze categorie is ongeldig. Alle downloads zijn geopend."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/pl.json b/src/shared/locales/pl.json
index 03619880..dc813636 100644
--- a/src/shared/locales/pl.json
+++ b/src/shared/locales/pl.json
@@ -2450,7 +2450,9 @@
"removeTitle": "Usuń wtyczkę",
"removeDesc": "Usunięcie tej wtyczki spowoduje też usunięcie jej danych przechowywanych w Motrix.",
"uninstallConfirmTitle": "Odinstalować {{name}}?",
- "uninstallConfirmDesc": "Spowoduje to usunięcie wtyczki i jej zapisanych ustawień z Motrix."
+ "uninstallConfirmDesc": "Spowoduje to usunięcie wtyczki i jej zapisanych ustawień z Motrix.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "Ta wtyczka nie prosi o żadne uprawnienia.",
@@ -2674,7 +2676,8 @@
},
"ffmpeg": {
"strong": "Używanie FFmpeg",
- "plain": "Przetwarza dźwięk lub wideo."
+ "plain": "Przetwarza dźwięk lub wideo.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Wysyłanie powiadomień",
@@ -2891,7 +2894,9 @@
"invalidName": "Wpisz prawidłową nazwę folderu.",
"tooLarge": "Ta ścieżka lub nazwa folderu jest zbyt długa.",
"unavailable": "Serwer nie mógł wykonać tego żądania. Spróbuj ponownie.",
- "creationOutcomeUnknown": "Nie udało się potwierdzić utworzenia. Odśwież i sprawdź wynik, zanim utworzysz tutaj kolejny folder."
+ "creationOutcomeUnknown": "Nie udało się potwierdzić utworzenia. Odśwież i sprawdź wynik, zanim utworzysz tutaj kolejny folder.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Typowe lokalizacje",
@@ -2903,6 +2908,33 @@
"downloads": "Pobrane",
"root": "System plików",
"loadFailed": "Nie udało się wczytać niektórych lokalizacji folderów."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2970,5 +3002,49 @@
"waitingMerged": "Oczekujące zadania są teraz w Aktywnych. Otwarto ten widok.",
"stoppedSplit": "Zatrzymane zadania są podzielone na Ukończone i Błędy. Otwarto wszystkie pobrania.",
"invalidStatus": "Nieprawidłowa kategoria. Otwarto wszystkie pobrania."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/pt-BR.json b/src/shared/locales/pt-BR.json
index 8b75ea4c..dcaf4711 100644
--- a/src/shared/locales/pt-BR.json
+++ b/src/shared/locales/pt-BR.json
@@ -2432,7 +2432,9 @@
"removeTitle": "Remover plugin",
"removeDesc": "Remover este plugin também exclui os dados dele armazenados no Motrix.",
"uninstallConfirmTitle": "Desinstalar {{name}}?",
- "uninstallConfirmDesc": "Isso removerá o plugin e as configurações dele armazenadas no Motrix."
+ "uninstallConfirmDesc": "Isso removerá o plugin e as configurações dele armazenadas no Motrix.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "Este plugin não solicita permissões.",
@@ -2653,7 +2655,8 @@
},
"ffmpeg": {
"strong": "Usar FFmpeg",
- "plain": "Processa áudio ou vídeo."
+ "plain": "Processa áudio ou vídeo.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Enviar notificações",
@@ -2869,7 +2872,9 @@
"invalidName": "Digite um nome de pasta válido.",
"tooLarge": "Este caminho ou nome de pasta é longo demais.",
"unavailable": "O servidor não conseguiu concluir esta solicitação. Tente novamente.",
- "creationOutcomeUnknown": "Não foi possível confirmar a criação. Atualize para verificar antes de criar outra pasta aqui."
+ "creationOutcomeUnknown": "Não foi possível confirmar a criação. Atualize para verificar antes de criar outra pasta aqui.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Locais comuns",
@@ -2881,6 +2886,33 @@
"downloads": "Downloads",
"root": "Sistema de arquivos",
"loadFailed": "Não foi possível carregar alguns locais de pastas."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2948,5 +2980,49 @@
"waitingMerged": "As tarefas em espera agora aparecem em Ativas. Essa visualização foi aberta.",
"stoppedSplit": "As tarefas paradas são agrupadas em Concluídas e Erros. Todos os downloads foram abertos.",
"invalidStatus": "A categoria é inválida. Todos os downloads foram abertos."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/ro.json b/src/shared/locales/ro.json
index d16458b5..577cd89e 100644
--- a/src/shared/locales/ro.json
+++ b/src/shared/locales/ro.json
@@ -84,7 +84,9 @@
"outsideRoots": "Acest dosar se află în afara locațiilor permise.",
"permissionDenied": "Nu ai permisiunea de a folosi acest dosar.",
"tooLarge": "Calea ori numele dosarului depășește lungimea permisă.",
- "unavailable": "Serverul nu a putut finaliza cererea. Încearcă din nou."
+ "unavailable": "Serverul nu a putut finaliza cererea. Încearcă din nou.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "Dosarul solicitat nu este disponibil. Se afișează {{path}}.",
"folderName": "Numele dosarului",
@@ -123,7 +125,34 @@
"title": "Selectează dosarul de pe server",
"unknownOutcome": "Crearea nu a putut fi confirmată. Reîmprospătează pentru a verifica înainte de a crea alt dosar aici.",
"up": "Un nivel mai sus",
- "viewOptions": "Opțiuni de afișare"
+ "viewOptions": "Opțiuni de afișare",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "Adaugă un favorit",
@@ -1350,7 +1379,9 @@
"uninstallConfirm": "Dezinstalezi acest modul? Datele sale vor fi eliminate.",
"uninstallConfirmDesc": "Această acțiune elimină modulul și setările sale salvate din Motrix.",
"uninstallConfirmTitle": "Dezinstalezi {{name}}?",
- "viewIssue": "Vezi problema"
+ "viewIssue": "Vezi problema",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1546,7 +1577,8 @@
},
"ffmpeg": {
"plain": "Procesează audio sau video.",
- "strong": "Folosește FFmpeg"
+ "strong": "Folosește FFmpeg",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -2948,5 +2980,49 @@
"waitingMerged": "Sarcinile în așteptare apar acum în Active. Această vizualizare a fost deschisă.",
"stoppedSplit": "Sarcinile oprite sunt grupate în Finalizate și Erori. Au fost deschise toate descărcările.",
"invalidStatus": "Categoria nu este validă. Au fost deschise toate descărcările."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/ru.json b/src/shared/locales/ru.json
index a161bacc..2fc861ef 100644
--- a/src/shared/locales/ru.json
+++ b/src/shared/locales/ru.json
@@ -2450,7 +2450,9 @@
"removeTitle": "Удаление плагина",
"removeDesc": "При удалении плагина также удаляются его данные, хранящиеся в Motrix.",
"uninstallConfirmTitle": "Удалить {{name}}?",
- "uninstallConfirmDesc": "Плагин и его сохранённые настройки будут удалены из Motrix."
+ "uninstallConfirmDesc": "Плагин и его сохранённые настройки будут удалены из Motrix.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "Этот плагин не запрашивает разрешений.",
@@ -2674,7 +2676,8 @@
},
"ffmpeg": {
"strong": "Использование FFmpeg",
- "plain": "Обрабатывает аудио или видео."
+ "plain": "Обрабатывает аудио или видео.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Отправка уведомлений",
@@ -2891,7 +2894,9 @@
"invalidName": "Введите корректное имя папки.",
"tooLarge": "Слишком длинный путь или имя папки.",
"unavailable": "Сервер не смог выполнить этот запрос. Повторите попытку.",
- "creationOutcomeUnknown": "Не удалось подтвердить создание. Обновите список и проверьте результат, прежде чем создавать здесь ещё одну папку."
+ "creationOutcomeUnknown": "Не удалось подтвердить создание. Обновите список и проверьте результат, прежде чем создавать здесь ещё одну папку.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Часто используемые расположения",
@@ -2903,6 +2908,33 @@
"downloads": "Загрузки",
"root": "Файловая система",
"loadFailed": "Не удалось загрузить некоторые расположения папок."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2970,5 +3002,49 @@
"waitingMerged": "Ожидающие задачи теперь находятся в активных. Открыт список активных задач.",
"stoppedSplit": "Остановленные задачи разделены на завершённые и ошибки. Открыты все загрузки.",
"invalidStatus": "Недопустимая категория. Открыты все загрузки."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/th.json b/src/shared/locales/th.json
index 46cda851..b900288c 100644
--- a/src/shared/locales/th.json
+++ b/src/shared/locales/th.json
@@ -84,7 +84,9 @@
"outsideRoots": "โฟลเดอร์นี้อยู่นอกตำแหน่งที่อนุญาต",
"permissionDenied": "คุณไม่มีสิทธิ์ใช้โฟลเดอร์นี้",
"tooLarge": "เส้นทางหรือชื่อโฟลเดอร์นี้ยาวเกินไป",
- "unavailable": "เซิร์ฟเวอร์ดำเนินการตามคำขอนี้ไม่ได้ ลองอีกครั้ง"
+ "unavailable": "เซิร์ฟเวอร์ดำเนินการตามคำขอนี้ไม่ได้ ลองอีกครั้ง",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "โฟลเดอร์ที่ขอไม่พร้อมใช้งาน กำลังแสดง {{path}}",
"folderName": "ชื่อโฟลเดอร์",
@@ -123,7 +125,34 @@
"title": "เลือกโฟลเดอร์บนเซิร์ฟเวอร์",
"unknownOutcome": "ยืนยันการสร้างไม่ได้ รีเฟรชเพื่อตรวจสอบก่อนสร้างโฟลเดอร์อื่นที่นี่",
"up": "ขึ้นหนึ่งระดับ",
- "viewOptions": "ตัวเลือกมุมมอง"
+ "viewOptions": "ตัวเลือกมุมมอง",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "เพิ่มโฟลเดอร์โปรด",
@@ -1322,7 +1351,9 @@
"uninstallConfirm": "ถอนการติดตั้งปลั๊กอินนี้หรือไม่ ข้อมูลของปลั๊กอินจะถูกลบ",
"uninstallConfirmDesc": "จะนำปลั๊กอินและการตั้งค่าที่บันทึกไว้ออกจาก Motrix",
"uninstallConfirmTitle": "ถอนการติดตั้ง {{name}} หรือไม่",
- "viewIssue": "ดูปัญหา"
+ "viewIssue": "ดูปัญหา",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1510,7 +1541,8 @@
},
"ffmpeg": {
"plain": "ประมวลผลเสียงหรือวิดีโอ",
- "strong": "ใช้ FFmpeg"
+ "strong": "ใช้ FFmpeg",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -2904,5 +2936,49 @@
"waitingMerged": "งานที่รออยู่แสดงในหมวดกำลังทำงานแล้ว ได้เปิดมุมมองนี้แล้ว",
"stoppedSplit": "งานที่หยุดแบ่งเป็นเสร็จสิ้นและข้อผิดพลาด ได้เปิดการดาวน์โหลดทั้งหมดแล้ว",
"invalidStatus": "หมวดการดาวน์โหลดไม่ถูกต้อง ได้เปิดการดาวน์โหลดทั้งหมดแล้ว"
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/tr.json b/src/shared/locales/tr.json
index b570754c..3c567e99 100644
--- a/src/shared/locales/tr.json
+++ b/src/shared/locales/tr.json
@@ -2414,7 +2414,9 @@
"removeTitle": "Eklentiyi kaldır",
"removeDesc": "Bu eklentiyi kaldırmak, Motrix’te saklanan verilerini de siler.",
"uninstallConfirmTitle": "{{name}} kaldırılsın mı?",
- "uninstallConfirmDesc": "Eklenti ve kaydedilmiş ayarları Motrix’ten kaldırılacak."
+ "uninstallConfirmDesc": "Eklenti ve kaydedilmiş ayarları Motrix’ten kaldırılacak.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "Bu eklenti herhangi bir izin istemiyor.",
@@ -2632,7 +2634,8 @@
},
"ffmpeg": {
"strong": "FFmpeg kullanma",
- "plain": "Ses veya video işler."
+ "plain": "Ses veya video işler.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Bildirim gönderme",
@@ -2847,7 +2850,9 @@
"invalidName": "Geçerli bir klasör adı girin.",
"tooLarge": "Bu yol veya klasör adı çok uzun.",
"unavailable": "Sunucu bu isteği tamamlayamadı. Tekrar deneyin.",
- "creationOutcomeUnknown": "Klasörün oluşturulduğu doğrulanamadı. Burada başka bir klasör oluşturmadan önce kontrol etmek için yenileyin."
+ "creationOutcomeUnknown": "Klasörün oluşturulduğu doğrulanamadı. Burada başka bir klasör oluşturmadan önce kontrol etmek için yenileyin.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Sık kullanılan konumlar",
@@ -2859,6 +2864,33 @@
"downloads": "İndirilenler",
"root": "Dosya sistemi",
"loadFailed": "Bazı klasör konumları yüklenemedi."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2926,5 +2958,49 @@
"waitingMerged": "Bekleyen görevler artık Etkin altında gösteriliyor. Etkin görünümü açıldı.",
"stoppedSplit": "Durdurulan görevler Tamamlanan ve Hatalar altında gruplanır. Tüm indirmeler açıldı.",
"invalidStatus": "Geçersiz indirme kategorisi. Tüm indirmeler açıldı."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/uk.json b/src/shared/locales/uk.json
index e6b6720f..8be71311 100644
--- a/src/shared/locales/uk.json
+++ b/src/shared/locales/uk.json
@@ -84,7 +84,9 @@
"outsideRoots": "Ця тека поза дозволеними розташуваннями.",
"permissionDenied": "У вас немає дозволу на використання цієї теки.",
"tooLarge": "Шлях до теки або її назва перевищує допустиму довжину.",
- "unavailable": "Серверу не вдалося виконати запит. Спробуйте ще раз."
+ "unavailable": "Серверу не вдалося виконати запит. Спробуйте ще раз.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"fallback": "Запитана тека недоступна. Показано {{path}}.",
"folderName": "Назва теки",
@@ -123,7 +125,34 @@
"title": "Виберіть теку на сервері",
"unknownOutcome": "Не вдалося підтвердити створення. Оновіть список перед створенням тут іншої теки.",
"up": "На рівень вище",
- "viewOptions": "Параметри вигляду"
+ "viewOptions": "Параметри вигляду",
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
+ }
},
"directoryPreferences": {
"addFavorite": "Додати улюблену теку",
@@ -1364,7 +1393,9 @@
"uninstallConfirm": "Видалити цей плагін? Його дані буде видалено.",
"uninstallConfirmDesc": "Плагін і його збережені налаштування буде видалено з Motrix.",
"uninstallConfirmTitle": "Видалити {{name}}?",
- "viewIssue": "Переглянути проблему"
+ "viewIssue": "Переглянути проблему",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"diagnostics": {
"callGraph": {
@@ -1564,7 +1595,8 @@
},
"ffmpeg": {
"plain": "Обробляє аудіо або відео.",
- "strong": "Використовувати FFmpeg"
+ "strong": "Використовувати FFmpeg",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"fs": {
"storage": {
@@ -2970,5 +3002,49 @@
"waitingMerged": "Завдання в очікуванні тепер містяться в активних. Відкрито активні завдання.",
"stoppedSplit": "Зупинені завдання розділено на завершені та помилки. Відкрито всі завантаження.",
"invalidStatus": "Недійсна категорія. Відкрито всі завантаження."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/vi.json b/src/shared/locales/vi.json
index f09a81d6..15a54ff0 100644
--- a/src/shared/locales/vi.json
+++ b/src/shared/locales/vi.json
@@ -2396,7 +2396,9 @@
"removeTitle": "Gỡ tiện ích",
"removeDesc": "Gỡ tiện ích này cũng sẽ xóa dữ liệu của tiện ích được lưu trong Motrix.",
"uninstallConfirmTitle": "Gỡ cài đặt {{name}}?",
- "uninstallConfirmDesc": "Thao tác này sẽ xóa tiện ích và các cài đặt đã lưu của tiện ích khỏi Motrix."
+ "uninstallConfirmDesc": "Thao tác này sẽ xóa tiện ích và các cài đặt đã lưu của tiện ích khỏi Motrix.",
+ "operations": "Operations",
+ "operationsFailed": "The operation panel could not load. Try again."
},
"permissions": {
"empty": "Tiện ích này không yêu cầu quyền nào.",
@@ -2611,7 +2613,8 @@
},
"ffmpeg": {
"strong": "Dùng FFmpeg",
- "plain": "Xử lý âm thanh hoặc video."
+ "plain": "Xử lý âm thanh hoặc video.",
+ "requirement": "Processes audio or video. First, <settings>install or select FFmpeg in Settings</settings>."
},
"notify": {
"strong": "Gửi thông báo",
@@ -2825,7 +2828,9 @@
"invalidName": "Nhập tên thư mục hợp lệ.",
"tooLarge": "Đường dẫn hoặc tên thư mục này quá dài.",
"unavailable": "Máy chủ không thể hoàn thành yêu cầu này. Hãy thử lại.",
- "creationOutcomeUnknown": "Chưa xác nhận được việc tạo thư mục. Hãy làm mới để kiểm tra trước khi tạo thư mục khác tại đây."
+ "creationOutcomeUnknown": "Chưa xác nhận được việc tạo thư mục. Hãy làm mới để kiểm tra trước khi tạo thư mục khác tại đây.",
+ "notFile": "Select a readable regular file.",
+ "unsupportedFileType": "This file extension is not supported."
},
"places": {
"common": "Vị trí thường dùng",
@@ -2837,6 +2842,33 @@
"downloads": "Tải xuống",
"root": "Hệ thống tệp",
"loadFailed": "Không thể tải một số vị trí thư mục."
+ },
+ "openFileTitle": "Select a file",
+ "saveFileTitle": "Save a file",
+ "fileDescription": "Browse files on the Motrix server.",
+ "selectFile": "Select file",
+ "saveFile": "Use this filename",
+ "files": "Files and folders",
+ "fileName": "File name",
+ "emptyFiles": "This folder is empty.",
+ "fileErrors": {
+ "invalidPath": "Enter a valid absolute path.",
+ "outsideRoots": "This path is outside the allowed locations.",
+ "notFound": "This path no longer exists.",
+ "permissionDenied": "You do not have permission to use this path.",
+ "invalidName": "Enter a valid file name.",
+ "tooLarge": "This path or file name is too long."
+ },
+ "selectedFilePath": "Selected file",
+ "file": {
+ "chooseOnServer": "Choose a file on the server using this picker.",
+ "singleFile": "Choose one file at a time.",
+ "wrongType": "Choose a file with one of these extensions: {{extensions}}.",
+ "pathUnavailable": "This file’s location is unavailable. Click to choose it instead.",
+ "choose": "Choose a file",
+ "dropHint": "Drop a file here or click to choose",
+ "browseHint": "Click to browse files",
+ "change": "Click to replace"
}
},
"directoryPreferences": {
@@ -2904,5 +2936,49 @@
"waitingMerged": "Tác vụ đang chờ nay nằm trong Đang hoạt động. Đã mở chế độ xem này.",
"stoppedSplit": "Tác vụ đã dừng được chia thành Hoàn tất và Lỗi. Đã mở tất cả bản tải xuống.",
"invalidStatus": "Danh mục tải xuống không hợp lệ. Đã mở tất cả bản tải xuống."
+ },
+ "mediaMerge": {
+ "title": "Merge audio and video",
+ "description": "Combine two files without re-encoding. Original files are kept. Audio-only and video-only inputs are detected automatically.",
+ "videoInput": "Video file",
+ "audioInput": "Audio file",
+ "output": "Output file",
+ "provider": "Plugin",
+ "browse": "Browse…",
+ "browseField": "Browse {{field}}",
+ "required": "Choose a file or enter its full path.",
+ "outputHint": "Use a new .mp4 or .mkv filename. Existing files are never overwritten. If the codecs cannot be copied to MP4, try MKV.",
+ "noPlugin": "Install and enable a media merge plugin. FFmpeg must be configured in Settings > Integration > Media Tools.",
+ "serverPaths": "Select files on the Motrix server. Files on this computer are not uploaded.",
+ "start": "Merge",
+ "running": "Merging…",
+ "cancelling": "Cancelling…",
+ "completed": "Merged successfully",
+ "cancelled": "Merge cancelled",
+ "failed": "Merge failed",
+ "invalidSelection": "Select two completed, single-file downloads.",
+ "jobMissing": "This merge is no longer available.",
+ "busy": "Another merge is already running.",
+ "pluginUnavailable": "The media merge plugin is unavailable.",
+ "absolutePaths": "Enter full, absolute file paths.",
+ "invalidFiles": "Choose two non-empty media files.",
+ "sameInput": "Choose two different input files.",
+ "outputFormat": "Use an .mp4 or .mkv output filename.",
+ "outputExists": "The output already exists. Choose a new filename.",
+ "invalidOutput": "The plugin did not produce a valid output file.",
+ "again": "Merge another file",
+ "pluginDisabled": "Enable this plugin to merge files.",
+ "choose": {
+ "videoInput": "Choose video",
+ "audioInput": "Choose audio",
+ "output": "Choose a save location"
+ },
+ "hint": {
+ "videoInput": "The picture for your merged file",
+ "audioInput": "The sound for your merged file",
+ "output": "Save as MP4 or MKV"
+ },
+ "preserveOriginals": "Original files are kept",
+ "format": "Output format"
}
}
diff --git a/src/shared/locales/zh-CN.json b/src/shared/locales/zh-CN.json
index 5c002382..7a7f819f 100644
--- a/src/shared/locales/zh-CN.json
+++ b/src/shared/locales/zh-CN.json
@@ -2396,7 +2396,9 @@
"removeTitle": "移除插件",
"removeDesc": "移除该插件会同时删除它在 Motrix 中存储的数据。",
"uninstallConfirmTitle": "确认卸载 {{name}}?",
- "uninstallConfirmDesc": "这将从 Motrix 中移除该插件及其存储的设置。"
+ "uninstallConfirmDesc": "这将从 Motrix 中移除该插件及其存储的设置。",
+ "operations": "操作",
+ "operationsFailed": "操作界面加载失败,请重试。"
},
"permissions": {
"empty": "此插件未请求任何权限。",
@@ -2611,7 +2613,8 @@
},
"ffmpeg": {
"strong": "使用 FFmpeg",
- "plain": "处理音频或视频。"
+ "plain": "处理音频或视频。",
+ "requirement": "用于处理音视频,使用前请先<settings>在设置中安装或选择 FFmpeg</settings>。"
},
"notify": {
"strong": "发送通知",
@@ -2825,7 +2828,9 @@
"invalidName": "请输入有效的文件夹名称。",
"tooLarge": "路径或文件夹名称过长。",
"unavailable": "服务器未能完成请求,请重试。",
- "creationOutcomeUnknown": "无法确认文件夹是否已创建。请先刷新检查,再在此处创建其他文件夹。"
+ "creationOutcomeUnknown": "无法确认文件夹是否已创建。请先刷新检查,再在此处创建其他文件夹。",
+ "notFile": "请选择可读取的普通文件。",
+ "unsupportedFileType": "不支持此文件扩展名。"
},
"places": {
"common": "常用位置",
@@ -2837,6 +2842,33 @@
"downloads": "下载",
"root": "文件系统",
"loadFailed": "部分目录位置未能加载。"
+ },
+ "openFileTitle": "选择文件",
+ "saveFileTitle": "保存文件",
+ "fileDescription": "浏览 Motrix 服务器上的文件。",
+ "selectFile": "选择文件",
+ "saveFile": "使用此文件名",
+ "files": "文件和文件夹",
+ "fileName": "文件名",
+ "emptyFiles": "此文件夹为空。",
+ "fileErrors": {
+ "invalidPath": "请输入有效的绝对路径。",
+ "outsideRoots": "此路径不在允许的位置范围内。",
+ "notFound": "此路径已不存在。",
+ "permissionDenied": "你没有使用此路径的权限。",
+ "invalidName": "请输入有效的文件名。",
+ "tooLarge": "路径或文件名过长。"
+ },
+ "selectedFilePath": "所选文件",
+ "file": {
+ "chooseOnServer": "请点击选择服务器上的文件。",
+ "singleFile": "请一次选择一个文件。",
+ "wrongType": "请选择以下格式的文件:{{extensions}}。",
+ "pathUnavailable": "无法读取此文件的位置,请点击选择。",
+ "choose": "选择文件",
+ "dropHint": "拖入文件,或点击选择",
+ "browseHint": "点击浏览文件",
+ "change": "点击更换文件"
}
},
"directoryPreferences": {
@@ -2904,5 +2936,49 @@
"waitingMerged": "等待中的任务现已归入活动任务,已打开活动任务列表。",
"stoppedSplit": "已停止的任务现按已完成和错误分类,已打开全部下载。",
"invalidStatus": "下载分类无效,已打开全部下载。"
+ },
+ "mediaMerge": {
+ "title": "合并音频和视频",
+ "description": "将视频画面与音频合为一个文件,无需重新编码。",
+ "videoInput": "视频文件",
+ "audioInput": "音频文件",
+ "output": "输出文件",
+ "provider": "插件",
+ "browse": "选择…",
+ "browseField": "选择{{field}}",
+ "required": "请选择文件或填写完整路径。",
+ "outputHint": "保存为 MP4 或 MKV,并使用新文件名。MP4 不兼容时可尝试 MKV。",
+ "noPlugin": "请安装并启用音视频合并扩展,并在“设置 → 集成 → 媒体工具”中配置 FFmpeg。",
+ "serverPaths": "选择 Motrix 服务器上的文件;不会上传本机文件。",
+ "start": "合并",
+ "running": "正在合并…",
+ "cancelling": "正在取消…",
+ "completed": "合并成功",
+ "cancelled": "已取消合并",
+ "failed": "合并失败",
+ "invalidSelection": "请选择两个已完成的单文件下载任务。",
+ "jobMissing": "此合并任务已不可用。",
+ "busy": "已有另一个合并任务正在运行。",
+ "pluginUnavailable": "音视频合并插件不可用。",
+ "absolutePaths": "请填写完整的文件绝对路径。",
+ "invalidFiles": "请选择两个非空媒体文件。",
+ "sameInput": "请选择两个不同的输入文件。",
+ "outputFormat": "输出文件名需以 .mp4 或 .mkv 结尾。",
+ "outputExists": "输出文件已存在,请使用新文件名。",
+ "invalidOutput": "插件未生成有效的输出文件。",
+ "again": "再次合并",
+ "pluginDisabled": "启用此扩展后即可合并文件。",
+ "choose": {
+ "videoInput": "选择视频",
+ "audioInput": "选择音频",
+ "output": "选择保存位置"
+ },
+ "hint": {
+ "videoInput": "提供合并后的画面",
+ "audioInput": "提供合并后的声音",
+ "output": "保存为 MP4 或 MKV"
+ },
+ "preserveOriginals": "无损合并,保留源文件",
+ "format": "输出格式"
}
}
diff --git a/src/shared/locales/zh-TW.json b/src/shared/locales/zh-TW.json
index 222b036d..97228d87 100644
--- a/src/shared/locales/zh-TW.json
+++ b/src/shared/locales/zh-TW.json
@@ -2496,7 +2496,9 @@
"removeTitle": "移除外掛程式",
"removeDesc": "移除此外掛程式也會刪除其儲存在 Motrix 的資料。",
"uninstallConfirmTitle": "要解除安裝 {{name}} 嗎?",
- "uninstallConfirmDesc": "這將從 Motrix 移除外掛程式及其已儲存的設定。"
+ "uninstallConfirmDesc": "這將從 Motrix 移除外掛程式及其已儲存的設定。",
+ "operations": "操作",
+ "operationsFailed": "操作介面載入失敗,請重試。"
},
"permissions": {
"empty": "此外掛程式未要求任何權限。",
@@ -2711,7 +2713,8 @@
},
"ffmpeg": {
"strong": "使用 FFmpeg",
- "plain": "處理音訊或影片。"
+ "plain": "處理音訊或影片。",
+ "requirement": "用於處理音訊與影片,使用前請先<settings>在設定中安裝或選擇 FFmpeg</settings>。"
},
"notify": {
"strong": "傳送通知",
@@ -2825,7 +2828,9 @@
"invalidName": "請輸入有效的資料夾名稱。",
"tooLarge": "路徑或資料夾名稱過長。",
"unavailable": "伺服器無法完成要求,請再試一次。",
- "creationOutcomeUnknown": "無法確認資料夾是否已建立。請先重新整理確認,再在此處建立其他資料夾。"
+ "creationOutcomeUnknown": "無法確認資料夾是否已建立。請先重新整理確認,再在此處建立其他資料夾。",
+ "notFile": "請選擇可讀取的一般檔案。",
+ "unsupportedFileType": "不支援此副檔名。"
},
"places": {
"common": "常用位置",
@@ -2837,6 +2842,33 @@
"downloads": "下載",
"root": "檔案系統",
"loadFailed": "部分目錄位置無法載入。"
+ },
+ "openFileTitle": "選擇檔案",
+ "saveFileTitle": "儲存檔案",
+ "fileDescription": "瀏覽 Motrix 伺服器上的檔案。",
+ "selectFile": "選擇檔案",
+ "saveFile": "使用此檔案名稱",
+ "files": "檔案和資料夾",
+ "fileName": "檔案名稱",
+ "emptyFiles": "此資料夾為空。",
+ "fileErrors": {
+ "invalidPath": "請輸入有效的絕對路徑。",
+ "outsideRoots": "此路徑不在允許的位置範圍內。",
+ "notFound": "此路徑已不存在。",
+ "permissionDenied": "你沒有使用此路徑的權限。",
+ "invalidName": "請輸入有效的檔案名稱。",
+ "tooLarge": "路徑或檔案名稱過長。"
+ },
+ "selectedFilePath": "所選檔案",
+ "file": {
+ "chooseOnServer": "請點擊選擇伺服器上的檔案。",
+ "singleFile": "請一次選擇一個檔案。",
+ "wrongType": "請選擇以下格式的檔案:{{extensions}}。",
+ "pathUnavailable": "無法讀取此檔案的位置,請點擊選擇。",
+ "choose": "選擇檔案",
+ "dropHint": "拖入檔案,或點擊選擇",
+ "browseHint": "點擊瀏覽檔案",
+ "change": "點擊更換檔案"
}
},
"directoryPreferences": {
@@ -2904,5 +2936,49 @@
"waitingMerged": "等待中的任務現已歸入活動任務,已開啟活動任務清單。",
"stoppedSplit": "已停止的任務現按已完成和錯誤分類,已開啟全部下載。",
"invalidStatus": "下載分類無效,已開啟全部下載。"
+ },
+ "mediaMerge": {
+ "title": "合併音訊與影片",
+ "description": "將影片畫面與音訊合為一個檔案,無需重新編碼。",
+ "videoInput": "影片檔案",
+ "audioInput": "音訊檔案",
+ "output": "輸出檔案",
+ "provider": "外掛",
+ "browse": "選擇…",
+ "browseField": "選擇{{field}}",
+ "required": "請選擇檔案或填寫完整路徑。",
+ "outputHint": "儲存為 MP4 或 MKV,並使用新檔名。MP4 不相容時可嘗試 MKV。",
+ "noPlugin": "請安裝並啟用音視訊合併擴充功能,並在「設定 → 整合 → 媒體工具」中設定 FFmpeg。",
+ "serverPaths": "選擇 Motrix 伺服器上的檔案;不會上傳本機檔案。",
+ "start": "合併",
+ "running": "正在合併…",
+ "cancelling": "正在取消…",
+ "completed": "合併成功",
+ "cancelled": "已取消合併",
+ "failed": "合併失敗",
+ "invalidSelection": "請選擇兩個已完成的單檔下載任務。",
+ "jobMissing": "此合併任務已無法使用。",
+ "busy": "已有另一個合併任務正在執行。",
+ "pluginUnavailable": "音訊與影片合併外掛無法使用。",
+ "absolutePaths": "請填寫完整的檔案絕對路徑。",
+ "invalidFiles": "請選擇兩個非空的媒體檔案。",
+ "sameInput": "請選擇兩個不同的輸入檔案。",
+ "outputFormat": "輸出檔名需以 .mp4 或 .mkv 結尾。",
+ "outputExists": "輸出檔案已存在,請使用新檔名。",
+ "invalidOutput": "外掛未產生有效的輸出檔案。",
+ "again": "再次合併",
+ "pluginDisabled": "啟用此擴充功能後即可合併檔案。",
+ "choose": {
+ "videoInput": "選擇影片",
+ "audioInput": "選擇音訊",
+ "output": "選擇儲存位置"
+ },
+ "hint": {
+ "videoInput": "提供合併後的畫面",
+ "audioInput": "提供合併後的聲音",
+ "output": "儲存為 MP4 或 MKV"
+ },
+ "preserveOriginals": "無損合併,保留原始檔案",
+ "format": "輸出格式"
}
}
diff --git a/src/shared/protocol/commands.ts b/src/shared/protocol/commands.ts
index dce0c820..c720bb5a 100644
--- a/src/shared/protocol/commands.ts
+++ b/src/shared/protocol/commands.ts
@@ -1,4 +1,10 @@
export const Commands = {
+ GetMediaMergeState: 'command:getMediaMergeState',
+ GetMediaMergeSelection: 'command:getMediaMergeSelection',
+ StartMediaMerge: 'command:startMediaMerge',
+ GetMediaMergeJob: 'command:getMediaMergeJob',
+ CancelMediaMerge: 'command:cancelMediaMerge',
+ PickFile: 'command:pickFile',
SetCompletionShutdown: 'command:setCompletionShutdown',
SaveDownloadsSettings: 'command:saveDownloadsSettings',
PauseTask: 'command:pauseTask',
diff --git a/src/shared/protocol/queries.ts b/src/shared/protocol/queries.ts
index 702a92c3..02d772ee 100644
--- a/src/shared/protocol/queries.ts
+++ b/src/shared/protocol/queries.ts
@@ -63,6 +63,7 @@ export const Queries = {
// Save directory allowlist (web degradation, electron returns unrestricted)
ListAllowedSaveDirs: 'query:listAllowedSaveDirs',
ListServerDirectories: 'query:listServerDirectories',
+ ValidateServerFile: 'query:validateServerFile',
ValidateServerDirectory: 'query:validateServerDirectory',
// GeoIP
GetGeoIPStatus: 'query:getGeoIPStatus',
diff --git a/src/shared/schemas/file-picker.ts b/src/shared/schemas/file-picker.ts
new file mode 100644
index 00000000..e03921e3
--- /dev/null
+++ b/src/shared/schemas/file-picker.ts
@@ -0,0 +1,19 @@
+import { z } from 'zod'
+
+export const fileExtensionsSchema = z
+ .array(
+ z
+ .string()
+ .regex(/^[a-zA-Z0-9]+$/)
+ .max(32)
+ )
+ .max(32)
+ .optional()
+export const filePickerOptionsSchema = z
+ .object({
+ kind: z.enum(['open', 'save']),
+ defaultPath: z.string().max(4096).optional(),
+ extensions: fileExtensionsSchema,
+ })
+ .strict()
+export type FilePickerOptions = z.infer<typeof filePickerOptionsSchema>
diff --git a/src/shared/schemas/manual-media-merge.ts b/src/shared/schemas/manual-media-merge.ts
new file mode 100644
index 00000000..24d74cdf
--- /dev/null
+++ b/src/shared/schemas/manual-media-merge.ts
@@ -0,0 +1,34 @@
+import { z } from 'zod'
+
+/** Opt-in public command convention; no new manifest keywords are required. */
+export const MEDIA_MERGE_COMMAND = 'mergeStreams'
+export const mediaMergePathSchema = z.string().min(1).max(4096)
+export const mediaMergeArgsSchema = z
+ .object({
+ videoInput: mediaMergePathSchema,
+ audioInput: mediaMergePathSchema,
+ output: mediaMergePathSchema,
+ })
+ .strict()
+export const mediaMergeStartSchema = mediaMergeArgsSchema
+ .extend({
+ pluginId: z.string().min(1).max(140),
+ })
+ .strict()
+export const mediaMergeSelectionSchema = z.array(z.string().min(1)).length(2)
+export const mediaMergeJobIdSchema = z.string().uuid()
+
+export interface MediaMergeProvider {
+ pluginId: string
+ title: string
+}
+export type MediaMergeArgs = z.infer<typeof mediaMergeArgsSchema>
+export type MediaMergeStart = z.infer<typeof mediaMergeStartSchema>
+export interface MediaMergeJob {
+ id: string
+ pluginId: string
+ status: 'running' | 'cancelling' | 'completed' | 'cancelled' | 'failed'
+ percent: number | null
+ output: string
+ error?: string
+}
diff --git a/src/shared/schemas/server-directory.ts b/src/shared/schemas/server-directory.ts
index b4bef41e..8a75789b 100644
--- a/src/shared/schemas/server-directory.ts
+++ b/src/shared/schemas/server-directory.ts
@@ -3,6 +3,7 @@ import {
DIRECTORY_FAVORITES_LIMIT,
DIRECTORY_RECENT_LIMIT,
} from './directory-preferences'
+import { fileExtensionsSchema } from './file-picker'
export const SERVER_DIRECTORY_PATH_LIMIT = 4096
export const SERVER_DIRECTORY_NAME_LIMIT = 255
@@ -14,6 +15,8 @@ export const DirectoryErrorCodeSchema = z.enum([
'outsideRoots',
'notFound',
'notDirectory',
+ 'notFile',
+ 'unsupportedFileType',
'permissionDenied',
'alreadyExists',
'invalidName',
@@ -32,6 +35,7 @@ const DirectoryEntrySchema = z
.strict()
const ListedDirectoryEntrySchema = DirectoryEntrySchema.extend({
modifiedAt: z.number().finite().optional(),
+ kind: z.enum(['directory', 'file']).optional(),
}).strict()
const DirectoryFailureSchema = z
.object({
@@ -41,7 +45,12 @@ const DirectoryFailureSchema = z
.strict()
export const ListServerDirectoriesRequestSchema = z
- .object({ path: DirectoryPathSchema, showHidden: z.boolean().optional() })
+ .object({
+ path: DirectoryPathSchema,
+ showHidden: z.boolean().optional(),
+ includeFiles: z.boolean().optional(),
+ initialFile: z.boolean().optional(),
+ })
.strict()
export const ListServerDirectoriesResultSchema = z.discriminatedUnion('ok', [
z
@@ -60,6 +69,8 @@ export const ListServerDirectoriesResultSchema = z.discriminatedUnion('ok', [
.max(SERVER_DIRECTORY_ENTRY_LIMIT),
truncated: z.boolean(),
canCreate: z.boolean(),
+ separator: z.enum(['/', '\\']).optional(),
+ initialName: z.string().max(SERVER_DIRECTORY_PATH_LIMIT).optional(),
})
.strict(),
})
@@ -78,6 +89,25 @@ export const ValidateServerDirectoryResultSchema = z.discriminatedUnion('ok', [
.strict(),
DirectoryFailureSchema,
])
+export const ValidateServerFileRequestSchema = z.discriminatedUnion('kind', [
+ z
+ .object({
+ kind: z.literal('open'),
+ path: DirectoryPathSchema,
+ extensions: fileExtensionsSchema,
+ })
+ .strict(),
+ z
+ .object({
+ kind: z.literal('save'),
+ parentPath: DirectoryPathSchema,
+ name: z.string().min(1).max(SERVER_DIRECTORY_NAME_LIMIT),
+ extensions: fileExtensionsSchema,
+ })
+ .strict(),
+])
+export const ValidateServerFileResultSchema =
+ ValidateServerDirectoryResultSchema
export const CreateServerDirectoryRequestSchema = z
.object({
parentPath: DirectoryPathSchema,