1
0

A reduntant method Song.ArtistTitle() was removed.

This commit is contained in:
Alexander Andreev 2023-10-07 21:31:00 +04:00
parent 4a4c228984
commit 131ea35341
Signed by: Arav
GPG Key ID: D22A817D95815393
3 changed files with 3 additions and 8 deletions

View File

@ -54,7 +54,7 @@ func CheckAndUpdateMostListenedSong(cur Song) {
mostListened = MostListenedSong{ mostListened = MostListenedSong{
Listeners: cur.MaxListeners, Listeners: cur.MaxListeners,
Date: cur.StartAt, Date: cur.StartAt,
Song: cur.ArtistTitle()} Song: cur.Artist + " - " + cur.Title}
} }
mlsChanged = true mlsChanged = true
} }

View File

@ -16,11 +16,6 @@ type Song struct {
StartAt time.Time StartAt time.Time
} }
// ArtistTitle returns a string formatted as "<artist> - <title>".
func (s *Song) ArtistTitle() string {
return s.Artist + " - " + s.Title
}
// DurationString returns song's duration as a string formatted as [H:]M:SS. // DurationString returns song's duration as a string formatted as [H:]M:SS.
func (s *Song) DurationString() string { func (s *Song) DurationString() string {
if s.Duration.Hours() >= 1 { if s.Duration.Hours() >= 1 {

View File

@ -47,7 +47,7 @@ html(lang='en')
div div
if (songList.Current() != nil) if (songList.Current() != nil)
- cur := *songList.Current() - 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 else
p Now playing: #[span#radio-song ] ( #[span#radio-duration-estimate ] #[span#radio-duration ] ) 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()}] 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 td= song.MaxListeners
else else
td td
td= song.ArtistTitle() td #{song.Artist} - #{song.Title}
- ml := radio.MostListened() - ml := radio.MostListened()
if ml.Song != "" 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. p.right Most listened song was "#{ml.Song}" on #{utils.ToClientTimezone(ml.Date, r).Format(radio.MostListenedDateFormat)} with #[b #{ml.Listeners}] listeners.