98 lines
2.2 KiB
Markdown
98 lines
2.2 KiB
Markdown
# ncore-hnr
|
|
|
|
Go app for checking nCore hit'n'run-risk torrents, force-starting matching qBittorrent torrents, and tracking state in SQLite.
|
|
|
|
## Configuration
|
|
|
|
Put local config in `.env`:
|
|
|
|
```bash
|
|
NCORE_USERNAME='your-ncore-username'
|
|
NCORE_PASSWORD='your-ncore-password'
|
|
|
|
QBITTORRENT_URL='http://localhost:8080'
|
|
QBITTORRENT_USERNAME='admin'
|
|
QBITTORRENT_PASSWORD='your-qbit-password'
|
|
|
|
APP_DB_PATH='data/ncore-hnr.sqlite'
|
|
DRY_RUN='false'
|
|
ALERT_AFTER='48h'
|
|
|
|
# Optional notifications: set NOTIFICATION_TYPE to 'ntfy' or 'smtp'.
|
|
NOTIFICATION_TYPE=''
|
|
|
|
NOTIFICATION_NTFY_URL=''
|
|
|
|
NOTIFICATION_SMTP_HOST=''
|
|
NOTIFICATION_SMTP_PORT='587'
|
|
NOTIFICATION_SMTP_USERNAME=''
|
|
NOTIFICATION_SMTP_PASSWORD=''
|
|
NOTIFICATION_SMTP_FROM=''
|
|
NOTIFICATION_SMTP_TO=''
|
|
```
|
|
|
|
`DRY_RUN=false` is the default and will call qBittorrent `setForceStart` and `reannounce`. Use `--dry-run=true` when you only want to preview matches.
|
|
|
|
Set `NOTIFICATION_TYPE=ntfy` and `NOTIFICATION_NTFY_URL='https://ntfy.sh/your-secret-topic'` to send manual-needed alerts through ntfy. For compatibility, old `NOTIFY_URL` values still work as the ntfy URL.
|
|
|
|
Set `NOTIFICATION_TYPE=smtp` to send manual-needed alerts by email. For Gmail, use:
|
|
|
|
```bash
|
|
NOTIFICATION_SMTP_HOST='smtp.gmail.com'
|
|
NOTIFICATION_SMTP_PORT='587'
|
|
NOTIFICATION_SMTP_USERNAME='youraddress@gmail.com'
|
|
NOTIFICATION_SMTP_PASSWORD='your-gmail-app-password'
|
|
NOTIFICATION_SMTP_FROM='ncore <youraddress@gmail.com>'
|
|
NOTIFICATION_SMTP_TO='target@example.com'
|
|
```
|
|
|
|
## Run
|
|
|
|
```bash
|
|
go run ./cmd/ncore-hnr
|
|
```
|
|
|
|
Preview without qBittorrent actions:
|
|
|
|
```bash
|
|
go run ./cmd/ncore-hnr --dry-run=true
|
|
```
|
|
|
|
JSON output:
|
|
|
|
```bash
|
|
go run ./cmd/ncore-hnr --json
|
|
```
|
|
|
|
## SQLite Views
|
|
|
|
Show aggregate statistics and the latest run:
|
|
|
|
```bash
|
|
go run ./cmd/ncore-hnr stats
|
|
```
|
|
|
|
Show tracked torrent status rows:
|
|
|
|
```bash
|
|
go run ./cmd/ncore-hnr status
|
|
```
|
|
|
|
Both read-only commands support JSON and a custom DB path:
|
|
|
|
```bash
|
|
go run ./cmd/ncore-hnr status --json
|
|
go run ./cmd/ncore-hnr stats --db data/ncore-hnr.sqlite
|
|
```
|
|
|
|
## Docker
|
|
|
|
```bash
|
|
docker build -t ncore-hnr:local .
|
|
docker run --rm --env-file .env -v "$PWD/data:/data" ncore-hnr:local
|
|
```
|
|
|
|
## Kubernetes
|
|
|
|
The `k8s/` folder contains a CronJob, PVC, and example Secret. Store real secrets out of git.
|