From 95890cbabfc2c9b4059b96cb40622c64b42e755b Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Wed, 29 Apr 2020 16:15:22 +0200 Subject: [PATCH] prevent live streams from syncing reduce timeout to 20 minutes --- manager/transfer.go | 2 +- manager/ytsync.go | 3 ++- sources/youtubeVideo.go | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/manager/transfer.go b/manager/transfer.go index 8c2957f..f0853bd 100644 --- a/manager/transfer.go +++ b/manager/transfer.go @@ -86,7 +86,7 @@ func abandonSupports(s *Sync) (float64, error) { consumerWG := &stop.Group{} //TODO: remove this once the SDK team fixes their RPC bugs.... s.daemon.SetRPCTimeout(30 * time.Second) - defer s.daemon.SetRPCTimeout(40 * time.Minute) + defer s.daemon.SetRPCTimeout(20 * time.Minute) for i := 0; i < s.ConcurrentVideos; i++ { consumerWG.Add(1) go func() { diff --git a/manager/ytsync.go b/manager/ytsync.go index a937500..a327d4d 100644 --- a/manager/ytsync.go +++ b/manager/ytsync.go @@ -307,7 +307,7 @@ func (s *Sync) FullCycle() (e error) { log.Infoln("Waiting for daemon to finish starting...") s.daemon = jsonrpc.NewClient(os.Getenv("LBRYNET_ADDRESS")) - s.daemon.SetRPCTimeout(40 * time.Minute) + s.daemon.SetRPCTimeout(20 * time.Minute) err = s.waitForDaemonStart() if err != nil { @@ -904,6 +904,7 @@ func (s *Sync) startWorker(workerNum int) { "interrupted by user", "Sign in to confirm your age", "This video is unavailable", + "video is a live stream and hasn't completed yet", } if util.SubstringInSlice(err.Error(), errorsNoRetry) { log.Println("This error should not be retried at all") diff --git a/sources/youtubeVideo.go b/sources/youtubeVideo.go index a0c99ee..41edcec 100644 --- a/sources/youtubeVideo.go +++ b/sources/youtubeVideo.go @@ -180,6 +180,9 @@ func (v *YoutubeVideo) getAbbrevDescription() string { } func (v *YoutubeVideo) download() error { + if v.youtubeInfo.Snippet.LiveBroadcastContent != "none" { + return errors.Err("video is a live stream and hasn't completed yet") + } videoPath := v.getFullPath() err := os.Mkdir(v.videoDir(), 0777)