aboutsummaryrefslogtreecommitdiff
path: root/yt
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2022-07-22 15:25:27 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2022-07-22 15:25:27 +0200
commit1e984fc8ced6a5915dbd7b6e17bd942e8438cf27 (patch)
tree1dbb64f3438030e3b1a3a45e728e73ee74787279 /yt
parent90d9d819b70f68e10482954cfc461737c0165f8a (diff)
downloadmdir-1e984fc8ced6a5915dbd7b6e17bd942e8438cf27.tar.gz
mdir-1e984fc8ced6a5915dbd7b6e17bd942e8438cf27.tar.bz2
mdir-1e984fc8ced6a5915dbd7b6e17bd942e8438cf27.zip
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.
Diffstat (limited to 'yt')
-rw-r--r--yt/manager.go25
1 files changed, 0 insertions, 25 deletions
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()
-}