diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2022-06-13 21:03:34 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2022-06-13 21:07:54 +0200 |
commit | f1fd665089dd6b0a1fa4fc72a64db3cbf0b6d5f5 (patch) | |
tree | 7d9fe5031671cdf5fd8da3e031966c72a358942e /yt | |
parent | f13a07aa433298de91e1c4aff68f72be6d851be2 (diff) | |
download | mdir-f1fd665089dd6b0a1fa4fc72a64db3cbf0b6d5f5.tar.gz mdir-f1fd665089dd6b0a1fa4fc72a64db3cbf0b6d5f5.tar.bz2 mdir-f1fd665089dd6b0a1fa4fc72a64db3cbf0b6d5f5.zip |
feat: Add poor implementation for the worker
This is just me testing a bit how doworker works, while I learn of
go/gin in the process.
Diffstat (limited to 'yt')
-rw-r--r-- | yt/manager.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/yt/manager.go b/yt/manager.go new file mode 100644 index 0000000..190387f --- /dev/null +++ b/yt/manager.go @@ -0,0 +1,17 @@ +package yt + +import ( + "fmt" + "io" + "os/exec" +) + +func RunYtDlpProcess(link string, output string) string { + output_template := fmt.Sprintf("%s/%%(title)s.%%(ext)s", output) + cmd := exec.Command("yt-dlp", link, "-o", output_template) + cmdOut, _ := cmd.StdoutPipe() + cmd.Start() + cmd.Wait() + cmdOutBytes, _ := io.ReadAll(cmdOut) + return string(cmdOutBytes) +} |