Skip to content

Commit

Permalink
fix(exec): add more debug to live download
Browse files Browse the repository at this point in the history
  • Loading branch information
Zibbp committed Aug 5, 2023
1 parent eb214b0 commit 15c7251
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/exec/exec.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package exec

import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
osExec "os/exec"
Expand Down Expand Up @@ -293,12 +295,17 @@ func DownloadTwitchLiveVideo(v *ent.Vod, ch *ent.Channel, startChatDownloadChann
return err
}
defer videoLogfile.Close()
cmd.Stdout = videoLogfile
cmd.Stderr = videoLogfile
var stdout bytes.Buffer

multiWriterStdout := io.MultiWriter(videoLogfile, &stdout)

cmd.Stdout = multiWriterStdout

if err := cmd.Run(); err != nil {
// Streamlink will error when the stream is offline - do not log this as an error
log.Debug().Msgf("finished downloading live video for %s", v.ExtID)
log.Debug().Msgf("finished downloading live video for %s - %s", v.ExtID, err.Error())
log.Debug().Msgf("streamlink live stdout: %s", stdout.String())
return nil
}

Expand Down

0 comments on commit 15c7251

Please sign in to comment.