1
0

For Song struct a method SetFrom was added.

This commit is contained in:
Alexander Andreev 2024-05-10 00:08:59 +04:00
parent c1d64700ff
commit ec6c1df474
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -16,6 +16,17 @@ type Song struct {
StartAt time.Time
}
func (s *Song) SetFrom(os *Song) {
s.mutex.Lock()
s.Artist = os.Artist
s.Title = os.Title
s.Duration = os.Duration
s.Listeners = os.Listeners
s.MaxListeners = os.MaxListeners
s.StartAt = os.StartAt
s.mutex.Unlock()
}
func (s *Song) UpdateMaxListeners(listeners int64) {
s.mutex.Lock()
if listeners > s.MaxListeners {