fix livestreams failing for wrong reason

This commit is contained in:
Niko Storni 2021-08-24 12:03:03 -04:00
parent a224fe44c2
commit 6944e17f43

View file

@ -216,9 +216,7 @@ func (v *YoutubeVideo) download() error {
defer func(start time.Time) { defer func(start time.Time) {
timing.TimedComponent("download").Add(time.Since(start)) timing.TimedComponent("download").Add(time.Since(start))
}(start) }(start)
if v.youtubeInfo.IsLive == true {
return errors.Err("video is a live stream and hasn't completed yet")
}
videoPath := v.getFullPath() videoPath := v.getFullPath()
err := os.Mkdir(v.videoDir(), 0777) err := os.Mkdir(v.videoDir(), 0777)
@ -783,6 +781,9 @@ func (v *YoutubeVideo) downloadAndPublish(daemon *jsonrpc.Client, params SyncPar
dur := time.Duration(v.youtubeInfo.Duration) * time.Second dur := time.Duration(v.youtubeInfo.Duration) * time.Second
minDuration := 7 * time.Second minDuration := 7 * time.Second
if v.youtubeInfo.IsLive == true {
return nil, errors.Err("video is a live stream and hasn't completed yet")
}
if dur > v.maxVideoLength { if dur > v.maxVideoLength {
logUtils.SendErrorToSlack("%s is %s long and the limit is %s", v.id, dur.String(), v.maxVideoLength.String()) logUtils.SendErrorToSlack("%s is %s long and the limit is %s", v.id, dur.String(), v.maxVideoLength.String())
return nil, errors.Err("video is too long to process") return nil, errors.Err("video is too long to process")
@ -801,7 +802,6 @@ func (v *YoutubeVideo) downloadAndPublish(daemon *jsonrpc.Client, params SyncPar
break break
} }
//log.Debugln("Downloaded " + v.id)
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second) ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
defer cancelFn() defer cancelFn()