From 6fb2ba355411f7d0ad001aa3f112b6135bf268c1 Mon Sep 17 00:00:00 2001 From: vsTerminus Date: Mon, 1 Mar 2021 22:02:33 -0600 Subject: [PATCH] Don't print the same song repeatedly in the console window --- lib/Discord/NP.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Discord/NP.pm b/lib/Discord/NP.pm index 037765a..5c92b12 100755 --- a/lib/Discord/NP.pm +++ b/lib/Discord/NP.pm @@ -33,7 +33,7 @@ has 'lastfm_user' => ( is => 'ro' ); has 'lastfm_key' => ( is => 'ro' ); has 'lastfm' => ( is => 'lazy', builder => sub { Mojo::WebService::LastFM->new( api_key => shift->lastfm_key ) } ); has 'my_id' => ( is => 'rw' ); -has 'last_status' => ( is => 'rw' ); +has 'last_status' => ( is => 'rw', default => '' ); has 'show_artist' => ( is => 'ro' ); has 'show_title' => ( is => 'ro' ); @@ -75,7 +75,7 @@ sub update_status 'state' => $json->{'album'} }); - say localtime(time) . " - Now Playing: $nowplaying"; + say localtime(time) . " - Now Playing: $nowplaying" unless $nowplaying eq $self->last_status; $self->last_status($nowplaying); } else