Files
AynaLivePlayer/plugin/textinfo/model.go
Aynakeya 5cc5948a85 Merge 1.0.x branch (#8)
* rewrite

* update submodule

* make width height configurable

* update dependency

* update

* update file

* update dep

* fix basic config layout

* update plugin management

* more stuff

* add blacklist

* fix todo

* fix windows gethandle

* update windows update guide

* update windows build guide

* include go mod tidy in script

* update todo

* fix source session

* fix text output

* add plugin play duration control

* fix id diange not working

* update todo

* update version number
2024-04-22 21:21:02 -07:00

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
}