|
|
4 nedēļas atpakaļ | |
|---|---|---|
| .. | ||
| apps | 1 mēnesi atpakaļ | |
| src | 4 nedēļas atpakaļ | |
| README.md | 1 mēnesi atpakaļ | |
| package.json | 1 mēnesi atpakaļ | |
| tsconfig.json | 1 mēnesi atpakaļ | |
A Node.js CLI for interacting with the Watch Finished system. Provides commands for managing files, settings, tasks, and maintenance from the terminal.
graph TD
CLI[watch-finished-cli] --> INTER[Interactive Mode<br/>Default]
CLI --> DIRECT[Direct Commands]
INTER --> MENU[Menu-Driven Interface<br/>Guided prompts]
DIRECT --> HELP[--help<br/>Command reference]
DIRECT --> FILES[File Commands]
DIRECT --> TASKS[Task Commands]
DIRECT --> CONFIG[Config Commands]
DIRECT --> WATCHER[Watcher Commands]
DIRECT --> MAINT[Maintenance Commands]
FILES --> FLIST[files:list<br/>List dataset files]
FILES --> FGET[file:get<br/>Get file details]
FILES --> FSET[file:set<br/>Create/update file]
FILES --> FREMOVE[file:remove<br/>Delete file]
FILES --> FDELETED[files:deleted-older-than<br/>Find old deleted files]
TASKS --> TLIST[task:list<br/>List all tasks]
TASKS --> TGET[task:get<br/>Get task details]
TASKS --> TREMOVE[task:remove<br/>Delete task]
TASKS --> TSETTINGS[task:queue-settings<br/>Update queue config]
CONFIG --> CLIST[config:list<br/>List all settings]
CONFIG --> CGET[config:get<br/>Get setting value]
CONFIG --> CSET[config:set<br/>Update setting]
WATCHER --> WSTATUS[watcher:status<br/>Get watcher status]
WATCHER --> WSTART[watcher:start<br/>Start file watching]
WATCHER --> WSTOP[watcher:stop<br/>Stop file watching]
MAINT --> MCLEANUP[maintenance:cleanup<br/>Clean up files]
MAINT --> MPURGE[maintenance:purge<br/>Purge old data]
MAINT --> MPRUNE[maintenance:prune<br/>Remove orphaned files]
style INTER fill:#e3f2fd
style DIRECT fill:#f3e5f5
style FILES fill:#e8f5e8
style TASKS fill:#fff3e0
style CONFIG fill:#fce4ec
style WATCHER fill:#f1f8e9
style MAINT fill:#e0f2f1
pnpm run cli <command> [...args]
Note: The CLI defaults to connecting to http://localhost:3001. If your service runs on a different port, set the WATCH_FINISHED_API environment variable:
WATCH_FINISHED_API=http://localhost:3000 pnpm run cli <command>
The CLI launches in interactive mode by default for a guided, menu-driven experience. Use specific commands for automation or pass --help for command-line usage.
# Interactive mode (default)
pnpm run cli
# Command-line mode for automation
pnpm run cli task:list
# Show help
pnpm run cli --help
The interactive mode provides:
list --dataset <dataset> — List files in a datasetfile:get --dataset <dataset> --file <file> — Get a file recordfile:set --dataset <dataset> --file <file> [options] — Set (create/update) a file recordfile:remove --dataset <dataset> --file <file> [options] — Remove a file recordfiles:deleted-older-than --dataset <dataset> --isoDate <date> — Get deleted files older than a dateconfig:list — List available config filesconfig:settings [key] — Get settings (optionally by key)config:file --name <name> — Get a config file by nametask:list — List all taskstask:get --id <id> — Get a task by IDtask:delete --id <id> — Delete a task by IDtask:queue:status — Get queue statustask:queue:settings — Get queue settingstask:queue:settings:update [options] — Update queue settingswatcher:start [options] — Start the watcherwatcher:stop — Stop the watcherwatcher:status — Get watcher statusmaintenance:cleanup [options] — Cleanup a file from DB if missingmaintenance:purge [options] — Purge deleted records older than a thresholdmaintenance:prune [options] — Prune processed files that no longer existhandbrake:presets — List HandBrake presetshandbrake:process [options] — Process a video file with HandBrakeWhen updating queue settings with task:queue:settings:update, you can specify:
--batch-size <number> — Number of tasks to process in each batch--concurrency <number> — Maximum number of concurrent tasks--retry-enabled <true|false> — Enable/disable retry logic--max-retries <number> — Maximum number of retry attempts--retry-delay <milliseconds> — Delay between retry attempts--processing-interval <milliseconds> — Interval between processing cycles# List all tasks (uses default localhost:3001)
pnpm run cli task:list
# Get current queue settings
pnpm run cli task:queue:settings
# Update queue settings (increase batch size and concurrency)
pnpm run cli task:queue:settings:update --batch-size 5 --concurrency 3
# Start the file watcher
pnpm run cli watcher:start --watches "/data/movies,/data/tvshows"
# Process a video file
pnpm run cli handbrake:process --input input.mp4 --output output.m4v --preset "Fast 1080p30"
# Get settings
pnpm run cli config:settings
# Add a file record
pnpm run cli file:set --dataset movies --file mymovie.mkv --output mymovie.mp4 --status completed
# Launch interactive mode (also the default when no command is specified)
pnpm run cli
# If your service runs on a different port, set the environment variable
WATCH_FINISHED_API=http://localhost:3000 pnpm run cli task:list
The CLI is the default entrypoint for the Docker container, making it easy to run CLI commands:
# Interactive CLI (default when running container)
docker-compose run --rm app
# Direct CLI commands
docker-compose run --rm app files:list --dataset movies
docker-compose run --rm app task:list
docker-compose run --rm app config:get datasets
# Run development servers instead
docker-compose run --rm app pnpm dev
When running the CLI from within a running Docker container:
docker-compose exec app pnpm run cli task:list