From 942e5a6eee5a2ceb19382472913ebeb11ff397b0 Mon Sep 17 00:00:00 2001 From: lyx0 <66651385+lyx0@users.noreply.github.com> Date: Wed, 27 Dec 2023 13:12:13 +0100 Subject: [PATCH] fix conv command erroring out with permissions denied --- cmd/nourybot/download.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/nourybot/download.go b/cmd/nourybot/download.go index 41da886..99bd2e1 100644 --- a/cmd/nourybot/download.go +++ b/cmd/nourybot/download.go @@ -91,6 +91,7 @@ func (app *application) ConvertAndSave(fName, link string, msg twitch.PrivateMes } func (app *application) ConvertToMP4(link string, msg twitch.PrivateMessage) { + fName := "in" goutubedl.Path = "yt-dlp" uuid_og := uuid.NewString() uuid_new := uuid.NewString() @@ -110,7 +111,7 @@ func (app *application) ConvertToMP4(link string, msg twitch.PrivateMessage) { return } //app.Send(target, "Downloaded.", msg) - fileName := fmt.Sprintf("%s.%s", uuid_og, rExt) + fileName := fmt.Sprintf("/public/uploads/%s.%s", uuid_og, rExt) f, err := os.Create(fileName) //app.Send(target, fmt.Sprintf("Filename: %s", fileName), msg) if err != nil { @@ -128,7 +129,7 @@ func (app *application) ConvertToMP4(link string, msg twitch.PrivateMessage) { downloadResult.Close() f.Close() - out := "/public/uploads/output.mp4" + out := fmt.Sprintf("/public/uploads/%s.mp4", fName) fn, err := os.Create(out) if err != nil { app.Log.Errorln(err) @@ -141,6 +142,7 @@ func (app *application) ConvertToMP4(link string, msg twitch.PrivateMessage) { Output(out). OverWriteOutput().ErrorToStdOut().Run() + defer os.Remove(fileName) go app.NewUpload("yaf", out, msg.Channel, uuid_new, msg) }