From ec6c1df474bded4eb9195461af31353c6905de2f Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Fri, 10 May 2024 00:08:59 +0400 Subject: [PATCH] For Song struct a method SetFrom was added. --- internal/radio/song.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/radio/song.go b/internal/radio/song.go index bb47e64..ff51ccc 100644 --- a/internal/radio/song.go +++ b/internal/radio/song.go @@ -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 {