From d9c929b8c57b7ec12c32a582b5ce8a0cc986ffba Mon Sep 17 00:00:00 2001 From: Keuin Date: Thu, 8 Sep 2022 11:12:16 +0800 Subject: Proper notification when the live is ended. --- bilibili/streaming.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bilibili') diff --git a/bilibili/streaming.go b/bilibili/streaming.go index f6ffac9..4ca8682 100644 --- a/bilibili/streaming.go +++ b/bilibili/streaming.go @@ -62,10 +62,15 @@ func (b Bilibili) CopyLiveStream( // blocking copy n, err := common.Copy(ctx, out, resp.Body) - if !errors.Is(err, context.Canceled) { + if err != nil && !errors.Is(err, context.Canceled) { // real error happens b.error.Printf("Stream copying was interrupted unexpectedly: %v", err) } + + if err == nil { + b.info.Printf("The live is ended. (room %v)", roomId) + } + b.info.Printf("Bytes copied: %v", n) return err } -- cgit v1.2.3