Add reading torrent list from file cache, add ffprobe check, bring back proxy in config

This commit is contained in:
Ben Adrian Sarmiento
2024-06-17 17:16:24 +02:00
parent bf9adfb764
commit f33c2411e0
6 changed files with 89 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
netHttp "net/http"
"os"
"os/exec"
"strings"
"time"
@@ -52,7 +53,13 @@ func MainApp(configPath string) {
os.Exit(1)
}
proxyURL := os.Getenv("PROXY")
var proxyURL string
if config.GetProxy() != "" {
proxyURL = config.GetProxy()
zurglog.Infof("Using proxy: %s", proxyURL)
} else {
proxyURL = os.Getenv("PROXY")
}
repoClient4 := http.NewHTTPClient("", 0, 1, false, []string{}, proxyURL, log.Named("network_test"))
repoClient6 := http.NewHTTPClient("", 0, 1, true, []string{}, proxyURL, log.Named("network_test"))
@@ -135,6 +142,11 @@ func MainApp(configPath string) {
log.Named("router"),
)
_, err = exec.LookPath("ffprobe")
if err != nil {
zurglog.Warn("ffprobe not found in PATH (do you have ffmpeg installed?), you won't be able to perform media analysis")
}
//// pprof
// workerPool.Submit(func() {
// if err := netHttp.ListenAndServe(":6060", nil); err != nil && err != netHttp.ErrServerClosed {

View File

@@ -29,6 +29,11 @@ func NetworkTest(testURL string) {
log := logutil.NewLogger(logPath)
proxyURL := os.Getenv("PROXY")
if proxyURL != "" {
log.Infof("Using proxy: %s", proxyURL)
} else {
log.Info("You can set a proxy by setting the PROXY environment variable")
}
repoClient4 := http.NewHTTPClient("", 0, 1, false, []string{}, proxyURL, log.Named("network_test"))
repoClient6 := http.NewHTTPClient("", 0, 1, true, []string{}, proxyURL, log.Named("network_test"))

View File

@@ -34,6 +34,7 @@ type ConfigInterface interface {
GetDownloadsEveryMins() int
GetDumpTorrentsEveryMins() int
GetPlayableExtensions() []string
GetProxy() string
}
type ZurgConfig struct {
@@ -54,6 +55,7 @@ type ZurgConfig struct {
Password string `yaml:"password" json:"password"`
PlayableExtensions []string `yaml:"addl_playable_extensions" json:"addl_playable_extensions"`
Port string `yaml:"port" json:"port"`
Proxy string `yaml:"proxy" json:"proxy"`
RefreshEverySecs int `yaml:"check_for_changes_every_secs" json:"check_for_changes_every_secs"`
RepairEveryMins int `yaml:"repair_every_mins" json:"repair_every_mins"`
RetainFolderNameExtension bool `yaml:"retain_folder_name_extension" json:"retain_folder_name_extension"`
@@ -205,3 +207,7 @@ func (z *ZurgConfig) GetPlayableExtensions() []string {
}
return z.PlayableExtensions
}
func (z *ZurgConfig) GetProxy() string {
return z.Proxy
}