mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2026-03-15 14:03:17 +08:00
55 lines
948 B
Go
55 lines
948 B
Go
package textinfo
|
|
|
|
import (
|
|
"AynaLivePlayer/core/model"
|
|
"github.com/AynaLivePlayer/miaosic"
|
|
)
|
|
|
|
type Time struct {
|
|
Seconds int
|
|
Minutes int
|
|
TotalSeconds int
|
|
}
|
|
|
|
func NewTimeFromSec(sec int) Time {
|
|
return Time{
|
|
Seconds: sec % 60,
|
|
Minutes: sec / 60,
|
|
TotalSeconds: sec,
|
|
}
|
|
}
|
|
|
|
type MediaInfo struct {
|
|
Index int
|
|
Title string
|
|
Artist string
|
|
Album string
|
|
Username string
|
|
Cover miaosic.Picture
|
|
}
|
|
|
|
func NewMediaInfo(idx int, media model.Media) MediaInfo {
|
|
return MediaInfo{
|
|
Index: idx,
|
|
Title: media.Info.Title,
|
|
Artist: media.Info.Artist,
|
|
Album: media.Info.Album,
|
|
Username: media.ToUser().Name,
|
|
Cover: media.Info.Cover,
|
|
}
|
|
}
|
|
|
|
type OutInfo struct {
|
|
// ============== Current ==============
|
|
Current MediaInfo
|
|
CurrentTime Time
|
|
TotalTime Time
|
|
|
|
Lyric string
|
|
NextLyrics []string
|
|
|
|
// ============== Playlist ==============
|
|
Playlist []MediaInfo
|
|
PlaylistLength int
|
|
}
|