diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2022-07-13 12:22:15 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2022-07-13 12:22:15 +0200 |
commit | 90d9d819b70f68e10482954cfc461737c0165f8a (patch) | |
tree | fa5dd5b15c0c5a53d084c7b4be9fc2d7d6782491 /yt | |
parent | 4e5b2d9dfd9413ce084e64e048a57ad6e23356d3 (diff) | |
download | mdir-90d9d819b70f68e10482954cfc461737c0165f8a.tar.gz mdir-90d9d819b70f68e10482954cfc461737c0165f8a.tar.bz2 mdir-90d9d819b70f68e10482954cfc461737c0165f8a.zip |
feat: Add custom css
Diffstat (limited to 'yt')
-rw-r--r-- | yt/manager.go | 22 |
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() } |