From f1fd665089dd6b0a1fa4fc72a64db3cbf0b6d5f5 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Mon, 13 Jun 2022 21:03:34 +0200 Subject: 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. --- yt/manager.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 yt/manager.go (limited to 'yt/manager.go') 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) +} -- cgit v1.2.3