feat(usenet): warn at startup when par2 or extractor is missing
A usenet-enabled agent silently produces corrupt files when par2 is not installed: bad NNTP segments go unrepaired and unrar reports checksum errors. Likewise, no unrar/7z means RAR-packed downloads can't be unpacked at all. When the registered agent has the usenet feature, check par2 and the extractor (unrar/7z) in PATH and log a loud WARNING for each missing one, mirroring the existing ffmpeg-for-HLS warning.
This commit is contained in:
parent
0e8d9e87f6
commit
a5a92b111b
1 changed files with 16 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
|
|
@ -178,6 +179,21 @@ func (d *Daemon) Run(ctx context.Context) error {
|
|||
log.Printf("Agent registered: %s (%s) [%s]", d.User.Name, d.User.Email, d.User.Plan)
|
||||
log.Printf("Features: torrent=%v debrid=%v usenet=%v", d.Features.Torrent, d.Features.Debrid, d.Features.Usenet)
|
||||
|
||||
// Usenet needs par2 (segment repair) + an extractor (RAR/7z) on the host.
|
||||
// Without par2, a single bad segment corrupts the file silently; without
|
||||
// an extractor, RAR-packed downloads can't be unpacked. Warn loudly at
|
||||
// startup so the operator installs them before the first download fails.
|
||||
if d.Features.Usenet {
|
||||
if _, err := exec.LookPath("par2"); err != nil {
|
||||
log.Printf("[usenet] WARNING: par2 not found in PATH — corrupted segments cannot be repaired and extraction may fail. Install par2 (apt install par2 / brew install par2).")
|
||||
}
|
||||
_, unrarErr := exec.LookPath("unrar")
|
||||
_, sevenZErr := exec.LookPath("7z")
|
||||
if unrarErr != nil && sevenZErr != nil {
|
||||
log.Printf("[usenet] WARNING: no archive extractor (unrar or 7z) found — RAR-packed downloads cannot be unpacked. Install unrar or 7z.")
|
||||
}
|
||||
}
|
||||
|
||||
// Wire sync callbacks
|
||||
d.sync.OnNewTasks = func(tasks []Task) {
|
||||
if d.OnTasksClaimed != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue