From a4a6934dcead6826c1c46f4059b539b97957276a Mon Sep 17 00:00:00 2001 From: Viktor Varland Date: Fri, 28 Mar 2025 13:16:50 +0100 Subject: [PATCH] feat: embed additional metadata --- internal/config/config.go | 13 +++++++++---- internal/dl/dl.go | 5 +++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 7ba3972..4363829 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -1,16 +1,18 @@ package config import ( + "log" "os" toml "github.com/pelletier/go-toml/v2" ) type Provider struct { - Url string - Throttle int - Video_items int - After_date string + Url string + Throttle int + Range string + After_date string + Cmd string } type Config struct { @@ -32,5 +34,8 @@ func Load(filepath string) (Config, error) { panic(err) } + log.Printf("Loaded config:") + log.Printf("%+v\n", cfg) + return cfg, err } diff --git a/internal/dl/dl.go b/internal/dl/dl.go index 2adbe56..6da77a9 100644 --- a/internal/dl/dl.go +++ b/internal/dl/dl.go @@ -44,7 +44,7 @@ func Get(d Download, p config.Provider) { simulate = "--no-simulate" } - cmd := exec.Command("yt-dlp", + cmd := exec.Command(p.Cmd, fullUrl.String(), simulate, "--no-progress", @@ -59,8 +59,9 @@ func Get(d Download, p config.Provider) { "--output", output, "--download-archive", archive, "--break-on-existing", - "--playlist-items", strconv.Itoa(p.Video_items), + "--playlist-items", p.Range, "--restrict-filenames", + "--embed-metadata", ) stdout, err := cmd.StdoutPipe()