Library optimizer
- Go 74.6%
- HTML 18.1%
- Just 4.8%
- Nix 2.5%
| cmd | ||
| internal | ||
| .envrc | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| GEMINI.md | ||
| go.mod | ||
| go.sum | ||
| justfile | ||
| README.md | ||
Siftarr
Siftarr is a distributed media file optimization system. It monitors media libraries, analyzes files, and distributes optimization tasks (transcoding, cleanup) to worker nodes using user-defined Lua scripts.
Project Roadmap & Checklist
Phase 1: Core Infrastructure & Communication
- Database Setup
- Design SQLite schema (
nodes,libraries,files,jobs,scripts). - Implement database initialization and migration logic.
- Design SQLite schema (
- Server - Node Communication (WebSocket)
- Enhance handshake to include Node Capabilities (CPU/GPU, supported codecs) during registration.
- Implement Heartbeat mechanism (
POST /api/v1/nodes/{id}/heartbeator WS ping/pong). - Implement Job Dispatching via WebSocket or polling (
GET /api/v1/jobs/next).
Phase 2: Library Monitoring & Analysis
- Library Watcher (Server)
- Implement file system watcher (recursive) for configured library paths.
- Handle events: Create, Delete, Move/Rename.
- Analysis Engine
- Implement
detectMediaTypelogic. - Implement file probing (using
ffprobeor similar) to extract metadata (codec, container, bitrate). - Store file metadata in DB.
- Implement
Phase 3: Scripting Engine (Lua)
Replaces the original plan for Anko. We will use go-lua.
- Lua Environment Setup
- Integrate
github.com/Shopify/go-luainto the Node.
- Integrate
- Host API Bindings (Lua -> Go)
detectMediaType(path)readMeta(path)probeMedia(path)ffmpegRun(args...)- Wrapsexec.Commandfor FFmpeg.logEntry(map)
- Script Management API
- CRUD endpoints for Scripts (
/api/v1/scripts).
- CRUD endpoints for Scripts (
Phase 4: Node Execution Logic
- Job Processing
- Node fetches "Next Job".
- Node downloads the required Lua script.
- Node executes the Lua script against the target file.
- FFmpeg Integration
- Ensure
ffmpegandffprobeare available in the Node's path. - Handle stdout/stderr parsing from FFmpeg for progress reporting.
- Ensure
- Job Completion
- Report status (Success/Fail) and metrics (size saved) back to Server.
Phase 5: Web UI & Dashboard
- Dashboard
- Stats: Storage saved, Files processed, Active nodes.
- Node Management
- List connected nodes and their status/capabilities.
- Script Editor
- Code editor for Lua scripts.
- (Optional) Block-based editor (it's probably easier to do custom rather than blockly) that compiles to Lua.
- Library Browser
- View monitored files and their statuses.
Phase 6: Polish & Deployment
- Containerization
- Dockerfile for Server.
- Dockerfile for Node (including FFmpeg dependencies).
- Nix Flakes Note: Possibly combine these into one flake.
- Nix flake for Node.
- Nix flake for Server.
- Testing
- Unit tests for Lua bindings.
- Integration tests for Server-Node communication.