vsTerminus / Discord-NP

Last.FM Now Playing info in your Discord status message
MIT License
43 stars 6 forks source link

Now Playing: Songs I'm not scrobbling/listening to #29

Open dreedxela opened 1 year ago

dreedxela commented 1 year ago

Hey, basically your program shows my Now Playing as songs I'm not listening to or scrobbling anywhere:

error

Wires crossed somewhere? This happens both when I am listening to/scrobbling something and when I'm not. Seems a bit insecure not sure where it's pulling the info from or how.

vsTerminus commented 1 year ago

That's... weird.

I've not seen that before. What are you using to scrobble? Are those even songs from your library?

The Last.FM code is all in https://github.com/vsTerminus/Mojo-WebService-LastFM/blob/master/lib/Mojo/WebService/LastFM.pm

It calls http://ws.audioscrobbler.com/2.0?method=user.getrecenttracks&user=USERNAME&api_key=API_KEY&format=json&limit=1

(Replace USERNAME with your Last.FM Username and API_KEY with your last.fm API key from your config file, and then paste that whole URL into your browser)

And then the payload Last.FM returns is examined in this project: https://github.com/vsTerminus/Discord-NP/blob/master/lib/Discord/NP.pm

At the time I wrote this there was no way to positively identify which song was currently playing except to look for the absence of a date. A date means "it was last played at this time". No date meant "It's playing right now." I wonder if the API is returning songs without a date field but that aren't currently playing for some reason.

It does look like there is a nowplaying=true field now, I'll have to try targeting that instead and maybe it'll solve the problem.

vsTerminus commented 1 year ago

I was able to recreate this on my end.

No idea what causes it, but my console log is showing songs that aren't even in my library.

I'll investigate further. If it's something I can fix I will.

dreedxela commented 1 year ago

ib

Thank you! I want to keep using it but not with this bug. I was afraid of security until you confirmed you recreated lol

Matias314 commented 1 year ago

I experienced this too but it only happened once or twice and I've not noticed it ever since, strange.