Add logs route, add rar handler

This commit is contained in:
Ben Sarmiento
2023-12-06 19:18:04 +01:00
parent 2a0b0fa9cd
commit 2aacff1125
19 changed files with 151 additions and 44 deletions

View File

@@ -4,11 +4,11 @@ import (
"fmt"
"os"
"go.uber.org/zap"
"github.com/debridmediamanager/zurg/pkg/logutil"
"gopkg.in/yaml.v3"
)
func LoadZurgConfig(filename string, log *zap.SugaredLogger) (ConfigInterface, error) {
func LoadZurgConfig(filename string, log *logutil.Logger) (ConfigInterface, error) {
log.Debug("Loading config file ", filename)
content, err := os.ReadFile(filename)
if err != nil {

View File

@@ -24,6 +24,7 @@ type ConfigInterface interface {
GetRetriesUntilFailed() int
EnableDownloadCache() bool
GetRateLimitSleepSeconds() int
ShouldDeleteRarFiles() bool
}
type ZurgConfig struct {
@@ -45,6 +46,7 @@ type ZurgConfig struct {
RealDebridTimeout int `yaml:"realdebrid_timeout_secs" json:"realdebrid_timeout_secs"`
RetriesUntilFailed int `yaml:"retries_until_failed" json:"retries_until_failed"`
UseDownloadCache bool `yaml:"use_download_cache" json:"use_download_cache"`
DeleteRarFiles bool `yaml:"delete_rar_files" json:"delete_rar_files"`
}
func (z *ZurgConfig) GetConfig() ZurgConfig {
@@ -146,3 +148,7 @@ func (z *ZurgConfig) GetRateLimitSleepSeconds() int {
}
return z.RateLimitSleepSeconds
}
func (z *ZurgConfig) ShouldDeleteRarFiles() bool {
return z.DeleteRarFiles
}

View File

@@ -7,8 +7,8 @@ import (
"strconv"
"strings"
"github.com/debridmediamanager/zurg/pkg/logutil"
"github.com/debridmediamanager/zurg/pkg/utils"
"go.uber.org/zap"
"gopkg.in/yaml.v3"
)
@@ -16,7 +16,7 @@ const (
ALL_TORRENTS = "__all__"
)
func loadV1Config(content []byte, log *zap.SugaredLogger) (*ZurgConfigV1, error) {
func loadV1Config(content []byte, log *logutil.Logger) (*ZurgConfigV1, error) {
var configV1 ZurgConfigV1
if err := yaml.Unmarshal(content, &configV1); err != nil {
return nil, err

View File

@@ -1,11 +1,11 @@
package config
import "go.uber.org/zap"
import "github.com/debridmediamanager/zurg/pkg/logutil"
type ZurgConfigV1 struct {
ZurgConfig `yaml:",inline"`
Directories map[string]*DirectoryFilterConditionsV1 `yaml:"directories"`
log *zap.SugaredLogger
log *logutil.Logger
}
type DirectoryFilterConditionsV1 struct {
GroupOrder int `yaml:"group_order"`