From 90d9d819b70f68e10482954cfc461737c0165f8a Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Wed, 13 Jul 2022 12:22:15 +0200 Subject: feat: Add custom css --- yt/manager.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'yt') diff --git a/yt/manager.go b/yt/manager.go index c0cf6cb..b9dc333 100644 --- a/yt/manager.go +++ b/yt/manager.go @@ -3,11 +3,23 @@ package yt import ( "fmt" "os/exec" + + "git.sr.ht/~gabrielgio/midr/db" ) -func RunYtDlpProcess(link string, output string) { - output_template := fmt.Sprintf("%s/%%(title)s.%%(ext)s", output) - downloaded_txt := fmt.Sprintf("%s/downloaded.txt", output) - cmd := exec.Command("yt-dlp", link, "-o", output_template, "--download-archive", downloaded_txt) - cmd.Run() +func RunYtDlpProcess(entry *db.Entry) error { + args := []string{entry.Link} + + output_template := fmt.Sprintf("%s/%%(title)s.%%(ext)s", entry.OutputFolder) + args = append(args, "-o", output_template) + + downloaded_txt := fmt.Sprintf("%s/downloaded.txt", entry.OutputFolder) + args = append(args, "--download-archive", downloaded_txt) + + if len(entry.DateAfter) > 0 { + args = append(args, "--dateafter", entry.DateAfter) + } + + cmd := exec.Command("yt-dlp", args...) + return cmd.Run() } -- cgit v1.2.3