From f4aa9b4ac955487ec82b69d274db5f6b6d99afc7 Mon Sep 17 00:00:00 2001 From: aynakeya Date: Mon, 30 Jun 2025 00:38:21 +0800 Subject: [PATCH] fix bug: when diange limit is 1, user can only diange once & update version number to 1.2.0 --- pkg/config/config.go | 2 +- plugin/diange/diange.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 26bc51b..a62126d 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -10,7 +10,7 @@ import ( const ( ProgramName = "卡西米尔唱片机" - Version uint32 = 0x010103 + Version uint32 = 0x010200 ) const ( diff --git a/plugin/diange/diange.go b/plugin/diange/diange.go index a09c414..0cf05a9 100644 --- a/plugin/diange/diange.go +++ b/plugin/diange/diange.go @@ -135,6 +135,7 @@ func (d *Diange) Enable() error { "plugin.diange.queue.update", func(event *event.Event) { d.currentQueueLength = len(event.Data.(events.PlaylistDetailUpdateEvent).Medias) + d.log.Debugf("current queue length: %d", d.currentQueueLength) medias := event.Data.(events.PlaylistDetailUpdateEvent).Medias tmpUserCount := make(map[string]int) for _, media := range medias { @@ -144,8 +145,11 @@ func (d *Diange) Enable() error { } tmpUserCount[media.ToUser().Name]++ } + // clear user count + d.userCount.Clear() for user, count := range tmpUserCount { d.userCount.Store(user, count) + d.log.Debugf("user media count in player playlist %s: %d", user, count) } }) global.EventManager.RegisterA(