midr @ 90d9d819b70f68e10482954cfc461737c0165f8a

 1package yt
 2
 3import (
 4	"fmt"
 5	"os/exec"
 6
 7	"git.sr.ht/~gabrielgio/midr/db"
 8)
 9
10func RunYtDlpProcess(entry *db.Entry) error {
11	args := []string{entry.Link}
12
13	output_template := fmt.Sprintf("%s/%%(title)s.%%(ext)s", entry.OutputFolder)
14	args = append(args, "-o", output_template)
15
16	downloaded_txt := fmt.Sprintf("%s/downloaded.txt", entry.OutputFolder)
17	args = append(args, "--download-archive", downloaded_txt)
18
19	if len(entry.DateAfter) > 0 {
20		args = append(args, "--dateafter", entry.DateAfter)
21	}
22
23	cmd := exec.Command("yt-dlp", args...)
24	return cmd.Run()
25}