From 1e984fc8ced6a5915dbd7b6e17bd942e8438cf27 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Fri, 22 Jul 2022 15:25:27 +0200 Subject: ref: Move the yt manager to the worker Simplify the worker/manager relationship. Now the worker is responsible for the managing the yt-dlp process as well. Also introduce chan to report back logs. That is an attempt to decouple things. --- yt/manager.go | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 yt/manager.go (limited to 'yt/manager.go') diff --git a/yt/manager.go b/yt/manager.go deleted file mode 100644 index b9dc333..0000000 --- a/yt/manager.go +++ /dev/null @@ -1,25 +0,0 @@ -package yt - -import ( - "fmt" - "os/exec" - - "git.sr.ht/~gabrielgio/midr/db" -) - -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