mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
fix conv command erroring out with permissions denied
This commit is contained in:
parent
eda759a437
commit
942e5a6eee
|
@ -91,6 +91,7 @@ func (app *application) ConvertAndSave(fName, link string, msg twitch.PrivateMes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *application) ConvertToMP4(link string, msg twitch.PrivateMessage) {
|
func (app *application) ConvertToMP4(link string, msg twitch.PrivateMessage) {
|
||||||
|
fName := "in"
|
||||||
goutubedl.Path = "yt-dlp"
|
goutubedl.Path = "yt-dlp"
|
||||||
uuid_og := uuid.NewString()
|
uuid_og := uuid.NewString()
|
||||||
uuid_new := uuid.NewString()
|
uuid_new := uuid.NewString()
|
||||||
|
@ -110,7 +111,7 @@ func (app *application) ConvertToMP4(link string, msg twitch.PrivateMessage) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//app.Send(target, "Downloaded.", msg)
|
//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)
|
f, err := os.Create(fileName)
|
||||||
//app.Send(target, fmt.Sprintf("Filename: %s", fileName), msg)
|
//app.Send(target, fmt.Sprintf("Filename: %s", fileName), msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -128,7 +129,7 @@ func (app *application) ConvertToMP4(link string, msg twitch.PrivateMessage) {
|
||||||
downloadResult.Close()
|
downloadResult.Close()
|
||||||
f.Close()
|
f.Close()
|
||||||
|
|
||||||
out := "/public/uploads/output.mp4"
|
out := fmt.Sprintf("/public/uploads/%s.mp4", fName)
|
||||||
fn, err := os.Create(out)
|
fn, err := os.Create(out)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Log.Errorln(err)
|
app.Log.Errorln(err)
|
||||||
|
@ -141,6 +142,7 @@ func (app *application) ConvertToMP4(link string, msg twitch.PrivateMessage) {
|
||||||
Output(out).
|
Output(out).
|
||||||
OverWriteOutput().ErrorToStdOut().Run()
|
OverWriteOutput().ErrorToStdOut().Run()
|
||||||
|
|
||||||
|
defer os.Remove(fileName)
|
||||||
go app.NewUpload("yaf", out, msg.Channel, uuid_new, msg)
|
go app.NewUpload("yaf", out, msg.Channel, uuid_new, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue