Skip to content

Commit

Permalink
irc: initial song now does not get announced after a restart
Browse files Browse the repository at this point in the history
  • Loading branch information
Wessie committed Feb 25, 2024
1 parent 3037326 commit fa852b1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ircbot/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ func (ann *announceService) AnnounceSong(ctx context.Context, status radio.Statu
zerolog.Ctx(ctx).Info().Str("metadata", status.Song.Metadata).Msg("skipping announce: announce period")
return nil
}
// don't do the announcement if this is the first song we see since we get an initial
// value from somewhere hopefully
if ann.lastAnnounceSong.ID == 0 {
zerolog.Ctx(ctx).Info().Str("metadata", status.Song.Metadata).Msg("skipping anounce: first song")
ann.lastAnnounceSong = status.Song
return nil
}
// don't do the announcement if this song is equal to the last song we announced
if ann.lastAnnounceSong.EqualTo(status.Song) {
zerolog.Ctx(ctx).Info().Str("metadata", status.Song.Metadata).Msg("skipping announce: same as last song")
return nil
Expand Down

0 comments on commit fa852b1

Please sign in to comment.