Improve disk UI and build performance

This commit is contained in:
2026-04-23 22:51:36 +03:00
parent 31bac2b5d8
commit e7917b41b5
15 changed files with 651 additions and 154 deletions

View File

@@ -19,6 +19,8 @@ import (
"jukebox_maker/internal/watcher"
)
var Version = "dev"
func main() {
configPath := flag.String("config", "/config/config.json", "path to config file")
addr := flag.String("addr", ":8080", "HTTP listen address")
@@ -106,6 +108,7 @@ func main() {
srv, err := api.New(api.Deps{
Config: cfg,
ConfigPath: *configPath,
Version: Version,
Watcher: w,
Copier: cp,
Tasks: taskStore,
@@ -147,13 +150,14 @@ func main() {
}
func triggerAutoCopy(cp *copier.Copier, cfg *config.Config, info disk.DiskInfo, mediaPath string) {
var sources []string
hasEnabledSources := false
for _, s := range cfg.Sources {
if s.Enabled {
sources = append(sources, s.Path)
hasEnabledSources = true
break
}
}
if len(sources) == 0 {
if !hasEnabledSources {
return
}
go func() {
@@ -162,7 +166,7 @@ func triggerAutoCopy(cp *copier.Copier, cfg *config.Config, info disk.DiskInfo,
MountPath: info.MountPath,
MediaPath: mediaPath,
DestFolder: cfg.DestFolder,
EnabledSources: sources,
SourceRules: cfg.Sources,
ReserveFreeGB: cfg.ReserveFreeGB,
OverwriteMode: cfg.OverwriteMode,
FileSelectMode: cfg.FileSelectMode,