summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-09-08 11:12:16 +0800
committerKeuin <[email protected]>2022-09-08 11:12:16 +0800
commitd9c929b8c57b7ec12c32a582b5ce8a0cc986ffba (patch)
tree748055eadee287751a30d1801655516911f378f8
parent7805c6a04fac3dcd1077b32975ab12d5e04be695 (diff)
Proper notification when the live is ended.
-rw-r--r--bilibili/streaming.go7
1 files changed, 6 insertions, 1 deletions
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
}