mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-17 23:48:15 +08:00
Initial commit
This commit is contained in:
36
player/media.go
Normal file
36
player/media.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package player
|
||||
|
||||
import "AynaLivePlayer/liveclient"
|
||||
|
||||
type Media struct {
|
||||
Title string
|
||||
Artist string
|
||||
Cover string
|
||||
Album string
|
||||
Lyric string
|
||||
Url string
|
||||
Header map[string]string
|
||||
User interface{}
|
||||
Meta interface{}
|
||||
}
|
||||
|
||||
func (m *Media) ToUser() *User {
|
||||
if u, ok := m.User.(*User); ok {
|
||||
return u
|
||||
}
|
||||
return &User{Name: m.DanmuUser().Username}
|
||||
}
|
||||
|
||||
func (m *Media) SystemUser() *User {
|
||||
if u, ok := m.User.(*User); ok {
|
||||
return u
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Media) DanmuUser() *liveclient.DanmuUser {
|
||||
if u, ok := m.User.(*liveclient.DanmuUser); ok {
|
||||
return u
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user