aboutsummaryrefslogtreecommitdiff
path: root/yt
diff options
context:
space:
mode:
Diffstat (limited to 'yt')
-rw-r--r--yt/manager.go22
1 files changed, 17 insertions, 5 deletions
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()
}