For Song struct a method SetFrom was added.
This commit is contained in:
parent
c1d64700ff
commit
ec6c1df474
@ -16,6 +16,17 @@ type Song struct {
|
|||||||
StartAt time.Time
|
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) {
|
func (s *Song) UpdateMaxListeners(listeners int64) {
|
||||||
s.mutex.Lock()
|
s.mutex.Lock()
|
||||||
if listeners > s.MaxListeners {
|
if listeners > s.MaxListeners {
|
||||||
|
Loading…
Reference in New Issue
Block a user