diff --git a/common/event/event.go b/common/event/event.go index 22acb8b..81e1004 100644 --- a/common/event/event.go +++ b/common/event/event.go @@ -10,18 +10,22 @@ type Event struct { Id EventId Cancelled bool Data interface{} + Outdated bool + lock sync.RWMutex } type HandlerFunc func(event *Event) type Handler struct { - EventId EventId - Name string - Handler HandlerFunc + EventId EventId + Name string + Handler HandlerFunc + SkipOutdated bool } type Manager struct { handlers map[EventId]map[string]*Handler + prevEvent map[EventId]*Event queue chan func() stopSig chan int queueSize int @@ -32,6 +36,7 @@ type Manager struct { func NewManger(queueSize int, workerSize int) *Manager { manager := &Manager{ handlers: make(map[EventId]map[string]*Handler), + prevEvent: make(map[EventId]*Event), queue: make(chan func(), queueSize), stopSig: make(chan int, workerSize), queueSize: queueSize, @@ -55,6 +60,7 @@ func NewManger(queueSize int, workerSize int) *Manager { func (h *Manager) NewChildManager() *Manager { return &Manager{ handlers: make(map[EventId]map[string]*Handler), + prevEvent: make(map[EventId]*Event), queue: h.queue, stopSig: h.stopSig, queueSize: h.queueSize, @@ -81,9 +87,10 @@ func (h *Manager) Register(handler *Handler) { func (h *Manager) RegisterA(id EventId, name string, handler HandlerFunc) { h.Register(&Handler{ - EventId: id, - Name: name, - Handler: handler, + EventId: id, + Name: name, + Handler: handler, + SkipOutdated: true, }) } @@ -104,16 +111,29 @@ func (h *Manager) Unregister(name string) { } func (h *Manager) Call(event *Event) { - h.lock.RLock() + h.lock.Lock() + handlers, ok := h.handlers[event.Id] - h.lock.RUnlock() + if e := h.prevEvent[event.Id]; e != nil { + e.lock.Lock() + e.Outdated = true + e.lock.Unlock() + } + h.prevEvent[event.Id] = event + h.lock.Unlock() if !ok { return } for _, eh := range handlers { - handler := eh.Handler + eventHandler := eh h.queue <- func() { - handler(event) + event.lock.Lock() + if eventHandler.SkipOutdated && event.Outdated { + event.lock.Unlock() + return + } + eventHandler.Handler(event) + event.lock.Unlock() } } } diff --git a/common/event/event_test.go b/common/event/event_test.go new file mode 100644 index 0000000..af9fafa --- /dev/null +++ b/common/event/event_test.go @@ -0,0 +1,35 @@ +package event + +import ( + "fmt" + "testing" + "time" +) + +func TestEventSeq(t *testing.T) { + m := NewManger(128, 16) + m.RegisterA("ceshi", "asdf1", func(event *Event) { + fmt.Println("Num:", event.Data) + }) + go func() { + for i := 0; i < 1000; i++ { + m.CallA("ceshi", fmt.Sprintf("a%d", i)) + } + }() + for i := 0; i < 1000; i++ { + m.CallA("ceshi", i) + } +} + +func TestEventWeired(t *testing.T) { + m := NewManger(128, 2) + m.RegisterA("playlist.update", "asdf1", func(event *Event) { + fmt.Printf("%d %p, outdated: %t\n", event.Data, event, event.Outdated) + }) + for i := 0; i < 2; i++ { + fmt.Println("asdfsafasfasfasfasfasf") + m.CallA("playlist.update", i) + fmt.Println("asdfsafasfasfasfasfasf") + } + time.Sleep(1 * time.Second) +} diff --git a/common/logger/logger.go b/common/logger/logger.go index 8c50827..584861e 100644 --- a/common/logger/logger.go +++ b/common/logger/logger.go @@ -19,7 +19,7 @@ func init() { HideKeys: true, NoColors: true, }) - _ = os.Truncate(config.Log.Path, 0) + //_ = os.Truncate(config.Log.Path, 0) file, err := os.OpenFile(config.Log.Path, os.O_CREATE|os.O_WRONLY, 0666) if err == nil { Logger.Out = io.MultiWriter(file, os.Stdout) diff --git a/config/config.go b/config/config.go index d0da19f..59ed84d 100644 --- a/config/config.go +++ b/config/config.go @@ -8,7 +8,7 @@ import ( const ( ProgramName = "卡西米尔唱片机" - Version = "beta 0.9.5" + Version = "beta 0.9.6" ) const ( diff --git a/controller/core/playlist.go b/controller/core/playlist.go index f3daf50..2ff6eb2 100644 --- a/controller/core/playlist.go +++ b/controller/core/playlist.go @@ -241,7 +241,7 @@ func (p *corePlaylist) Get(index int) *model.Media { } func (p *corePlaylist) Pop() *model.Media { - lg.Info("[Playlists] %s pop first media", p.Playlist) + lg.Debugf("[Playlists] %s pop first media", p.Playlist) if p.Size() == 0 { return nil } @@ -262,7 +262,9 @@ func (p *corePlaylist) Pop() *model.Media { } p.eventManager.CallA( model.EventPlaylistUpdate, - model.PlaylistUpdateEvent{Playlist: p.Playlist.Copy()}, + model.PlaylistUpdateEvent{ + Playlist: p.Playlist.Copy(), + }, ) return m } @@ -275,7 +277,9 @@ func (p *corePlaylist) Replace(medias []*model.Media) { p.Lock.Unlock() p.eventManager.CallA( model.EventPlaylistUpdate, - model.PlaylistUpdateEvent{Playlist: p.Playlist.Copy()}, + model.PlaylistUpdateEvent{ + Playlist: p.Playlist.Copy(), + }, ) } @@ -315,7 +319,9 @@ func (p *corePlaylist) Insert(index int, media *model.Media) { p.Lock.Unlock() p.eventManager.CallA( model.EventPlaylistUpdate, - model.PlaylistUpdateEvent{Playlist: p.Playlist.Copy()}, + model.PlaylistUpdateEvent{ + Playlist: p.Playlist.Copy(), + }, ) p.eventManager.CallA( model.EventPlaylistInsert, @@ -343,7 +349,9 @@ func (p *corePlaylist) Delete(index int) *model.Media { } p.eventManager.CallA( model.EventPlaylistUpdate, - model.PlaylistUpdateEvent{Playlist: p.Playlist.Copy()}) + model.PlaylistUpdateEvent{ + Playlist: p.Playlist.Copy(), + }) return m } @@ -376,7 +384,9 @@ func (p *corePlaylist) Move(src int, dst int) { p.Lock.Unlock() p.eventManager.CallA( model.EventPlaylistUpdate, - model.PlaylistUpdateEvent{Playlist: p.Playlist.Copy()}) + model.PlaylistUpdateEvent{ + Playlist: p.Playlist.Copy(), + }) } func (p *corePlaylist) Next() *model.Media { diff --git a/go.mod b/go.mod index a37af2c..5cbaad2 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/sirupsen/logrus v1.8.1 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/spf13/cast v1.5.0 - github.com/stretchr/testify v1.7.2 + github.com/stretchr/testify v1.8.0 github.com/tidwall/gjson v1.14.3 github.com/virtuald/go-paniclog v0.0.0-20190812204905-43a7fa316459 golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 @@ -25,23 +25,23 @@ require ( ) require ( - fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93 // indirect + fyne.io/systray v1.10.1-0.20221115204952-d16a6177e6f1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 // indirect + github.com/fredbi/uri v0.1.0 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 // indirect github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 // indirect github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect - github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec // indirect + github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect - github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff // indirect + github.com/goki/freetype v0.0.0-20220119013949-7a161fd3728c // indirect github.com/google/uuid v1.3.0 // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564 // indirect - github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9 // indirect + github.com/srwiley/oksvg v0.0.0-20220731023508-a61f04f16b76 // indirect + github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780 // indirect github.com/tevino/abool v1.2.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect diff --git a/go.sum b/go.sum index fb23e1e..a87cd10 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,9 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= fyne.io/fyne/v2 v2.2.4 h1:izyiDUjJYAB7B/MST7M9GDs+mQ0CwDgRZTiVJZQoEe4= fyne.io/fyne/v2 v2.2.4/go.mod h1:MBoGuHzLLSXdQOWFAwWhIhYTEMp33zqtGCReSWhaQTA= -fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93 h1:V2IC9t0Zj9Ur6qDbfhUuzVmIvXKFyxZXRJyigUvovs4= fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE= +fyne.io/systray v1.10.1-0.20221115204952-d16a6177e6f1 h1:OiHw+bZAGEaSreHsA8dDkBOVJmSFzsNTOc/htpM+fOc= +fyne.io/systray v1.10.1-0.20221115204952-d16a6177e6f1/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -85,8 +86,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= -github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 h1:FDqhDm7pcsLhhWl1QtD8vlzI4mm59llRvNzrFg6/LAA= github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3/go.mod h1:CzM2G82Q9BDUvMTGHnXf/6OExw/Dz2ivDj48nVg7Lg8= +github.com/fredbi/uri v0.1.0 h1:8XBBD74STBLcWJ5smjEkKCZivSxSKMhFB0FbQUKeNyM= +github.com/fredbi/uri v0.1.0/go.mod h1:1xC40RnIOGCaQzswaOvrzvG/3M3F0hyDVb3aO/1iGy0= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= @@ -102,8 +104,9 @@ github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6/go.mod h1:9YTyiznxEY1fVin github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec h1:3FLiRYO6PlQFDpUU7OEFlWgjGD1jnBIVSJ5SYRWk+9c= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b h1:GgabKamyOYguHqHjSkDACcgoPIz3w0Dis/zJ1wyHHHU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-resty/resty/v2 v2.6.0/go.mod h1:PwvJS6hvaPkjtjNg9ph+VrSD92bi5Zq73w/BIH7cC3Q= github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY= @@ -112,8 +115,9 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff h1:W71vTCKoxtdXgnm1ECDFkfQnpdqAO00zzGXLA5yaEX8= github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff/go.mod h1:wfqRWLHRBsRgkp5dmbG56SA0DmVtwrF5N3oPdI8t+Aw= +github.com/goki/freetype v0.0.0-20220119013949-7a161fd3728c h1:JGCm/+tJ9gC6THUxooTldS+CUDsba0qvkvU3DHklqW8= +github.com/goki/freetype v0.0.0-20220119013949-7a161fd3728c/go.mod h1:wfqRWLHRBsRgkp5dmbG56SA0DmVtwrF5N3oPdI8t+Aw= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -287,11 +291,14 @@ github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t6 github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564 h1:HunZiaEKNGVdhTRQOVpMmj5MQnGnv+e8uZNu3xFLgyM= github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564/go.mod h1:afMbS0qvv1m5tfENCwnOdZGOF8RGR/FsZ7bvBxQGZG4= -github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9 h1:m59mIOBO4kfcNCEzJNy71UkeF4XIx2EVmL9KLwDQdmM= +github.com/srwiley/oksvg v0.0.0-20220731023508-a61f04f16b76 h1:Ga2uagHhDeGysCixLAzH0mS2TU+CrbQavmsHUNkEEVA= +github.com/srwiley/oksvg v0.0.0-20220731023508-a61f04f16b76/go.mod h1:cNQ3dwVJtS5Hmnjxy6AgTPd0Inb3pW05ftPSX7NZO7Q= github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9/go.mod h1:mvWM0+15UqyrFKqdRjY6LuAVJR0HOVhJlEgZ5JWtSWU= +github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780 h1:oDMiXaTMyBEuZMU53atpxqYsSB3U1CHkeAu2zr6wTeY= +github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780/go.mod h1:mvWM0+15UqyrFKqdRjY6LuAVJR0HOVhJlEgZ5JWtSWU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -299,8 +306,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tevino/abool v1.2.0 h1:heAkClL8H6w+mK5md9dzsuohKeXHUpY7Vw0ZCKW+huA= github.com/tevino/abool v1.2.0/go.mod h1:qc66Pna1RiIsPa7O4Egxxs9OqkuxDX55zznh9K07Tzg= diff --git a/gui/player_playlist.go b/gui/player_playlist.go index 2f04d89..9e70106 100644 --- a/gui/player_playlist.go +++ b/gui/player_playlist.go @@ -60,6 +60,8 @@ func createPlaylist() fyne.CanvasObject { newLabelWithWrapping("user", fyne.TextTruncate))) }, func(id widget.ListItemID, object fyne.CanvasObject) { + l().Debugf("Update playlist item: %d", id) + l().Debugf("Update playlist event during update %d", UserPlaylist.Playlist.Size()) object.(*fyne.Container).Objects[0].(*fyne.Container).Objects[0].(*widget.Label).SetText( UserPlaylist.Playlist.Medias[id].Title) object.(*fyne.Container).Objects[0].(*fyne.Container).Objects[1].(*widget.Label).SetText( @@ -85,11 +87,9 @@ func createPlaylist() fyne.CanvasObject { func registerPlaylistHandler() { controller.Instance.Playlists().GetCurrent().EventManager().RegisterA(model.EventPlaylistUpdate, "gui.playlist.update", func(event *event.Event) { - // Read lock Playlists when updating free after updating. - l().Tracef("Playlist update event received: %s", event.Data.(model.PlaylistUpdateEvent).Playlist) - UserPlaylist.mux.RLock() + UserPlaylist.mux.Lock() UserPlaylist.Playlist = event.Data.(model.PlaylistUpdateEvent).Playlist UserPlaylist.List.Refresh() - UserPlaylist.mux.RUnlock() + UserPlaylist.mux.Unlock() }) } diff --git a/model/liveroom.go b/model/liveroom.go index d9033b6..b50774d 100644 --- a/model/liveroom.go +++ b/model/liveroom.go @@ -3,9 +3,10 @@ package model import "fmt" type LiveRoom struct { - ClientName string - ID string - AutoConnect bool + ClientName string + ID string + AutoConnect bool + AutoReconnect bool } func (r *LiveRoom) String() string { diff --git a/model/playlist.go b/model/playlist.go index 43bfdbf..65d3312 100644 --- a/model/playlist.go +++ b/model/playlist.go @@ -7,6 +7,7 @@ type PlaylistMode int const ( PlaylistModeNormal PlaylistMode = iota PlaylistModeRandom + PlaylistModeRepeat ) type Playlist struct { @@ -17,7 +18,7 @@ type Playlist struct { } func (p Playlist) String() string { - return fmt.Sprintf("", p.Name) + return fmt.Sprintf("", p.Name, len(p.Medias)) } func (p *Playlist) Size() int { diff --git a/player/player.go b/player/player.go index d47533d..1b2beea 100644 --- a/player/player.go +++ b/player/player.go @@ -6,7 +6,7 @@ import ( "AynaLivePlayer/model" ) -var lg = logger.Logger.WithField("Module", "PlayControl") +var lg = logger.Logger.WithField("Module", "Player") type IPlayer interface { Start() diff --git a/todo.txt b/todo.txt index d17d365..366cd9c 100644 --- a/todo.txt +++ b/todo.txt @@ -13,6 +13,7 @@ beta ---- Finished +- 2022.12.27@0.9.6: 闪退bug修复 - 2022.12.24@0.9.5: ui界面优化,event handler优化-新增任务池模式,歌词加载优化,新房间管理(可以自动连接) 本地音频搜索算法优化, - 2022.12.24 : 修复拖动进度条时产生的噪音