From 131ea3534182888db1bef9b396bfe322f0680481 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 7 Oct 2023 21:31:00 +0400 Subject: [PATCH] A reduntant method Song.ArtistTitle() was removed. --- internal/radio/mostlistened.go | 2 +- internal/radio/song.go | 5 ----- web/templates/index.pug | 4 ++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/internal/radio/mostlistened.go b/internal/radio/mostlistened.go index f501c90..602e320 100644 --- a/internal/radio/mostlistened.go +++ b/internal/radio/mostlistened.go @@ -54,7 +54,7 @@ func CheckAndUpdateMostListenedSong(cur Song) { mostListened = MostListenedSong{ Listeners: cur.MaxListeners, Date: cur.StartAt, - Song: cur.ArtistTitle()} + Song: cur.Artist + " - " + cur.Title} } mlsChanged = true } diff --git a/internal/radio/song.go b/internal/radio/song.go index e53d7ce..b83b05c 100644 --- a/internal/radio/song.go +++ b/internal/radio/song.go @@ -16,11 +16,6 @@ type Song struct { StartAt time.Time } -// ArtistTitle returns a string formatted as " - ". -func (s *Song) ArtistTitle() string { - return s.Artist + " - " + s.Title -} - // DurationString returns song's duration as a string formatted as [H:]M:SS. func (s *Song) DurationString() string { if s.Duration.Hours() >= 1 { diff --git a/web/templates/index.pug b/web/templates/index.pug index 3743c90..449436f 100644 --- a/web/templates/index.pug +++ b/web/templates/index.pug @@ -47,7 +47,7 @@ html(lang='en') div if (songList.Current() != nil) - cur := *songList.Current() - p Now playing: #[span#radio-song #{cur.ArtistTitle()}] ( #[span#radio-duration-estimate ] #[span#radio-duration #{cur.DurationString()}] ) + p Now playing: #[span#radio-song #{cur.Artist} - #{cur.Title}] ( #[span#radio-duration-estimate ] #[span#radio-duration #{cur.DurationString()}] ) else p Now playing: #[span#radio-song ] ( #[span#radio-duration-estimate ] #[span#radio-duration ] ) p Current/peak listeners: #[span#radio-listeners #{listeners.Current()}] / #[span#radio-listener-peak #{listeners.Peak()}] @@ -64,7 +64,7 @@ html(lang='en') td= song.MaxListeners else td - td= song.ArtistTitle() + td #{song.Artist} - #{song.Title} - ml := radio.MostListened() if ml.Song != "" p.right Most listened song was "#{ml.Song}" on #{utils.ToClientTimezone(ml.Date, r).Format(radio.MostListenedDateFormat)} with #[b #{ml.Listeners}] listeners.