summaryrefslogtreecommitdiff
path: root/bilibili/room_status.go
diff options
context:
space:
mode:
Diffstat (limited to 'bilibili/room_status.go')
-rw-r--r--bilibili/room_status.go47
1 files changed, 3 insertions, 44 deletions
diff --git a/bilibili/room_status.go b/bilibili/room_status.go
index cbb8bc4..f33277c 100644
--- a/bilibili/room_status.go
+++ b/bilibili/room_status.go
@@ -6,52 +6,11 @@ package bilibili
import (
"fmt"
+ "github.com/keuin/slbr/types"
)
-type LiveStatus int
-
-const (
- Inactive LiveStatus = 0
- Streaming LiveStatus = 1
- Playback LiveStatus = 2
-)
-
-var liveStatusStringMap = map[LiveStatus]string{
- Inactive: "inactive",
- Streaming: "streaming",
- Playback: "inactive (playback)",
-}
-
-type roomPlayInfo struct {
- RoomID uint64 `json:"room_id"`
- ShortID uint `json:"short_id"`
- UID uint `json:"uid"`
- IsHidden bool `json:"is_hidden"`
- IsLocked bool `json:"is_locked"`
- IsPortrait bool `json:"is_portrait"`
- LiveStatus LiveStatus `json:"live_status"` // 0: inactive 1: streaming 2: playback
- HiddenTill int `json:"hidden_till"`
- LockTill int `json:"lock_till"`
- Encrypted bool `json:"encrypted"`
- PwdVerified bool `json:"pwd_verified"`
- LiveTime int `json:"live_time"`
- RoomShield int `json:"room_shield"`
- AllSpecialTypes []interface{} `json:"all_special_types"`
- PlayurlInfo interface{} `json:"playurl_info"`
-}
-
-type RoomPlayInfoResponse = BaseResponse[roomPlayInfo]
-
-func (s LiveStatus) IsStreaming() bool {
- return s == Streaming
-}
-
-func (s LiveStatus) String() string {
- return liveStatusStringMap[s]
-}
-
-func (b Bilibili) GetRoomPlayInfo(roomId RoomId) (resp RoomPlayInfoResponse, err error) {
+func (b Bilibili) GetRoomPlayInfo(roomId types.RoomId) (resp types.RoomPlayInfoResponse, err error) {
url := fmt.Sprintf("https://api.live.bilibili.com/xlive/web-room/v2/index/getRoomPlayInfo"+
"?room_id=%d&protocol=0,1&format=0,1,2&codec=0,1&qn=0&platform=web&ptype=8&dolby=5&panorama=1", roomId)
- return callGet[RoomPlayInfoResponse](b, url)
+ return callGet[types.RoomPlayInfoResponse](b, url)
}