Add queued FFmpeg conversion and finish splitting the window from the host.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-25 01:49:50 +02:00
parent 48d03f794f
commit 6fc7506eb7
85 changed files with 3394 additions and 512 deletions

View File

@@ -837,17 +837,24 @@ Bitte diese Punkte klären. Empfohlene Defaults in Klammern:
---
## Hintergrunddienst: A vs. B
## Hintergrundprozess: Explorer.Host.exe
| | A In-Process (V1) | B Windows Service (später) |
Indexing, USN/watchers, transfer queue, hash worker, and history rollup run in **`Explorer.Host.exe`**, not in the WPF window.
| | Explorer.Host.exe (current) | Windows Service |
|---|---|---|
| Komplexität | niedrig | Session 0, ACL, IPC, Updates |
| Index wenn UI zu | stoppt | läuft weiter |
| USN-Rechte | oft unzureichend | SYSTEM kann Journal lesen |
| Crash-Isolation | UI-Crash stoppt Index | getrennt |
| Empfohlen | **V1 = A** | **V2 = B**, wenn Identity+Schema stabil sind |
| Complexity | per-user process, named pipe | Session 0, ACL, service updates |
| Index when the window is closed | continues | continues |
| Rights | same user as the window | typically SYSTEM |
| Crash isolation | window crash does not stop the index | isolated |
| Autostart | optional HKCU Run (current user, no elevation) | service start |
| Used | **yes** | **not used** |
V1 so schneiden, dass der Indexer ein `IHostedService` ist. Im Dienst-Host später derselbe Service, UI spricht über Named Pipe / gRPC (`Explorer.Contracts`). Nicht in V1 bauen, Interfaces nicht an WPF kleben.
The window (`Explorer.App.exe`) opens the SQLite index **read-only** (WAL). Only the host opens it for write. `Explorer.Contracts` (`IWorkbenchHost`, `ICloudOverlay`, `IHostConnection`) is the IPC surface over a current-user named pipe. Plugin implementations load in the host; the window talks overlay through the pipe.
If the host is not running, the window starts `Explorer.Host.exe` beside itself. Closing the window does not stop the host. Quit it from the host tray (**Quit background host**) or **File → Stop background host…**. Settings can add the host to the current users Windows sign-in programs (`HKCU\...\Run`) so it starts at logon without administrator rights.
The original V1 sketch was in-process `IHostedService` inside the UI. That path is gone. A Windows Service is still out of scope.
---
@@ -886,7 +893,7 @@ Deviations from the design above, with reasons:
3. **WPF-UI (lepoco)** — not used. Light/Dark Fluent-style brushes live in `Themes/Dark.xaml` and `Themes/Light.xaml` so the UI toolkit stays replaceable.
4. **`PRAGMA mmap_size` / large `cache_size`** — not applied at runtime. They made SQLite native startup unreliable under concurrent test hosts; WAL + `synchronous=NORMAL` remain.
5. **App data folder**`%LocalAppData%\ExplorerWorkbench` (not `Explorer`) so the working name does not collide with Windows Explorer.
6. **Background work** — in-process `IHostedService` instances (indexer, transfer queue, hash worker, history rollup, watchers). No Windows Service in this run.
6. **Background work** — indexer, transfer queue, hash worker, history rollup, and watchers run as `IHostedService` instances inside **`Explorer.Host.exe`**. The WPF window is a named-pipe client (`Explorer.Hosting.Client`) with a read-only SQLite store. No Windows Service; optional current-user sign-in (`HKCU\Software\Microsoft\Windows\CurrentVersion\Run`).
7. **Search syntax** — structured `SearchQuery` exists; Everything-like lexer is not shipped (Phase 7).
8. **UNIQUE identity**`UNIQUE (source_id, ifnull(parent_id,-1), name_norm)` because SQLite UNIQUE treats NULLs as distinct.
9. **INSERT ids**`Microsoft.Data.Sqlite` + Dapper `ExecuteScalarAsync` on `INSERT … RETURNING` leaves the write connection busy and hangs the next command. Writer-connection SQL uses `SqliteCommand` (`SqliteExec`) and `last_insert_rowid()`.

View File

@@ -8,7 +8,7 @@ Mental model:
Windows remains the source of truth. Removing a location from Workbench removes Workbenchs index data for it. It does **not** disconnect a network drive, unlink OneDrive, or change Explorer settings.
Version documented here: **0.1** (schema 8). This file is the user guide. Edit it in any text editor; Explorer Workbench reloads it when you open **Help → Documentation**.
Version documented here: **0.1** (schema 9). This file is the user guide. Edit it in any text editor; Explorer Workbench reloads it when you open **Help → Documentation**.
---
@@ -18,27 +18,27 @@ Workbench **does**:
- Browse live folders (local, removable, network, cloud mounts)
- Index locations you choose, then search and analyze them
- Queue copy, move, recycle, rename, archive, sync, and organize work
- Queue copy, move, recycle, rename, archive, convert, sync, and organize work
- Overlay Git and cloud status without becoming a Git client or a sync engine
Workbench **does not**:
- Two-way sync
- Convert media (no FFmpeg in this build)
- Hydrate online-only cloud files just to look at them
- Change Windows drive mappings or cloud client folders
- Replace Git (no stash, branch UI, mergetool, or credential dialog)
Specialized tools still do specialized jobs. 7-Zip compresses. Git reports status, shows diffs, commits selected files, resolves conflicts, and runs fetch, pull, and push. Workbench orchestrates.
Specialized tools still do specialized jobs. 7-Zip compresses. FFmpeg converts a few media kinds. Git reports status, shows diffs, commits selected files, resolves conflicts, and runs fetch, pull, and push. Workbench orchestrates.
---
## First launch
The window opens immediately. Locations fill in a moment later — Workbench does not wait for slow network shares or a second instance locking the index.
1. The window starts `Explorer.Host.exe` if it is not already running, then connects over a named pipe. Locations fill in a moment later — Workbench does not wait for slow network shares.
2. Browsing works with an empty index.
3. Folder sizes, search, duplicates, and storage analysis need an index. Use the banner **Build index**, **Tools → Locations → Index this location**, or the toolbar **Index** control.
4. Data lives under `%LocalAppData%\ExplorerWorkbench\` — never beside the executable.
5. Closing the window leaves the host running (indexing and the queue). A tray icon **Explorer Workbench host** can open the window again or **Quit background host**. **File → Stop background host…** does the same from the window.
| Path | Contents |
| --- | --- |
@@ -51,7 +51,7 @@ The window opens immediately. Locations fill in a moment later — Workbench doe
## Window layout
- **Title bar** — Explorer Workbench; minimize / maximize / close.
- **Menu** — File, View, Tools, Settings, Help. Tools is grouped: Storage, Locations, File Operations (including Archives), Automation, Development, Recycle Bin.
- **Menu** — File (including Stop background host), View, Tools, Settings, Help. Tools is grouped: Storage, Locations, File Operations (including Archives and Convert), Automation, Development, Recycle Bin.
- **Toolbar** — path, navigation, view mode, search, storage, queue summary.
- **Tree** — This PC, Network, Cloud (grouping is optional in Settings).
- **Folder pane** — details, list, or preview. Split pane is optional.
@@ -67,6 +67,8 @@ The window opens immediately. Locations fill in a moment later — Workbench doe
| Details / List / Preview | View menu or toolbar |
| Refresh | View → Refresh, or `F5` |
Tabs, split panes, and the folder shown in each pane are restored the next time you open Workbench.
---
## Locations
@@ -172,7 +174,7 @@ Intentional and sync copies are hidden by default. Hardlinks are not wasted spac
Almost every change goes through the queue instead of happening silently.
Supported operations today: copy, move, recycle, permanent delete, rename, empty Recycle Bin, extract, compress, add to archive, verify archive.
Supported operations today: copy, move, recycle, permanent delete, rename, empty Recycle Bin, extract, compress, add to archive, verify archive, convert.
The queue:
@@ -217,6 +219,20 @@ Jobs go through the queue. Online-only cloud archives are refused so Workbench w
---
## Convert
Needs **`ffmpeg.exe`** on the machine. FFmpeg is usually a zip, not an installer: unpack a Windows build and either put `ffmpeg.exe` on PATH, under `Program Files\ffmpeg\bin\`, or point Settings at the file. `ffprobe` / `ffplay` are not required. FFmpeg is not bundled. This is not HandBrake — a few conversions only.
| Kind | Output |
| --- | --- |
| Video to H.264 MP4 | `.mp4` next to the source, or in a folder you pick |
| Extract audio | AAC in `.m4a` |
| HEIC to JPEG | `.jpg` (depends on the FFmpeg build having a HEIC decoder) |
**Tools → File Operations → Convert…** or **Convert…** on the item context menu. Select files or a folder, pick a kind and destination, preview names, then Queue. Each file is one queue job on the background host. Online-only cloud files are skipped. Existing names get a unique suffix so nothing is overwritten. Source last-write time is copied onto the output when that is possible.
---
## Folder sync
**Tools → Automation → Folder sync…****one-way** only.
@@ -236,18 +252,19 @@ Files copied by sync are tagged as synchronized duplicates.
**Tools → Automation → Operation profiles…** — named recipes that **plan** work, then enqueue it. Steps never touch the filesystem themselves.
Toggles (not a free-form graph): Copy, Rename, Compress, require a clean Git working tree. Excludes are globs, one per line.
Toggles (not a free-form graph): Copy, Rename, Compress, Convert, require a clean Git working tree. Excludes are globs, one per line.
Built-in recipes (seeded when the list is empty):
1. **Archive folder** — require clean Git, compress 7z, exclude `.git` / `bin` / `obj` / `.vs`
2. **Copy to destination** — copy; AutoRun when the destination volume connects
3. **Convert videos to MP4** — FFmpeg H.264 MP4 into the destination folder
Run from the window, from **Run profile** on the context menu (always previews first), or by dropping files onto a profile. AutoRun is Copy-only (no rename, no compress) and fires on unreachable → reachable, not on a timer while already online.
Run from the window, from **Run profile** on the context menu (always previews first), or by dropping files onto a profile. AutoRun is Copy-only (no rename, no compress, no convert) and fires on unreachable → reachable, not on a timer while already online.
Dirty or missing Git, missing 7-Zip, or an unreachable destination stops the plan. Nothing is queued.
Dirty or missing Git, missing 7-Zip, missing FFmpeg, or an unreachable destination stops the plan. Nothing is queued.
Not in this build: SHA-256, recycle source after success, FFmpeg, scheduled or folder-watcher triggers.
Not in this build: SHA-256, recycle source after success, GPU tuner, trim editor, scheduled or folder-watcher triggers.
---
@@ -295,7 +312,7 @@ When a cloud folder is added:
- **Always keep on this device** / **Free up space** when the provider supports pin/dehydrate
- Quota in capacity/free space where the provider reports it
Workbench never starts a cloud vendors own two-way sync. It never hydrates a file as a side effect of browse, size, search, hash, or archive.
Workbench never starts a cloud vendors own two-way sync. It never hydrates a file as a side effect of browse, size, search, hash, archive, or convert.
---
@@ -309,8 +326,11 @@ Workbench never starts a cloud vendors own two-way sync. It never hydrates a
- Show protected system locations
- Auto-clear queue when done
- Include archive contents in the index
- Automatically index removable drives when they appear
- Start Explorer.Host.exe at Windows sign-in (current-user Startup, no administrator rights)
- Path to 7-Zip
- Path to git.exe
- Path to ffmpeg.exe
These options change what Workbench shows and indexes. They do not change Windows Explorer settings.
@@ -336,7 +356,7 @@ Left open on purpose:
- Two-way sync and conflict resolution UI
- Undo for copy/move
- Concurrent copies across different disks
- FFmpeg / media conversion
- GPU / trim / filter conversion
- Multi-PC search, sharing, encrypted vaults
- Robocopy as a second transfer engine
- Scheduled profiles and folder-watcher triggers