Cog icon indicating copy to clipboard operation
Cog copied to clipboard

Last.fm scrobbling stopped working

Open peczony opened this issue 4 years ago • 11 comments
trafficstars

Last.fm scrobbling stopped working in Cog. It looks like this — Last.fm desktop app doesn't recognize the music being played. I couldn't pinpoint the exact moment when this happened, because I also use other apps for scrobbling (e.g. Spotify), and I only noticed it today. I think it worked a month ago, definitely worked two months ago. Maybe it stopped working when I upgraded to Big Sur (mid-June), but I’m not 100% sure.

I tried:

  1. installing an older version of Cog (668475c4)
  2. reinstalling Last.fm desktop app (2.1.39, latest version)
  3. of course rebooting.

Neither helped.

Because installing an older version of Cog didn't help, I suppose this issue isn't related to some code change on your part, but is rather a macOS issue.

I'm sorry this description is so vague. Let me know if I can do something to pinpoint the issue.

peczony avatar Aug 18 '21 12:08 peczony

Hi, i'm pretty sure that Cog's integration with Last.fm is outdated.

I think we should migrate to official Web API to provide reliable scrobbling functionality, without requiring outdated desktop client.

@kode54 Chris, what do you think?

nevack avatar Aug 18 '21 12:08 nevack

Fine, if someone wants to do it. I'm not so sure I want to even bother learning how to do all that. The current web reader plugin was already a massive mess. I don't even want to think of how I'd have to implement a web view or browser interface to do OAuth.

kode54 avatar Aug 19 '21 02:08 kode54

You can just show a link for users to open and then paste the token, there are some apps that do so without a WebView, that open links in the users's default browser (e.g VOX player).

Also, the old non-OAuth (user/pass) API still works (e.g. Deadbeef uses it and scrobbles without a problem).

If you decide to invest time in fixing scrobbling, it might be even better to implement the old API since when last.fm eventually dies, if you expose a method to change the API url, users can just change the url and migrate to Libre.fm / ListenBrainz / whatever pops up.

peczony avatar Aug 19 '21 08:08 peczony

Hi, can I help with this issue? Do you think we can integrate the official last.fm api library into Cog?

I could do a huge part of the job, but I'd need some of your help at the beginning.

LexanderPL avatar Jan 29 '22 14:01 LexanderPL

I am not touching anything that requires Qt. I will consider using their HTTPS API in the future, but I won't use a client library that requires Qt.

kode54 avatar Jul 03 '22 05:07 kode54

I may be able to rewrite significant portions of the library for use. For instance, I would rewrite the fingerprint generator to use Apple's Accelerate DFT instead of FFTW, and also rewrite it to use R8Brain resampler for the downsampling process it normally uses libsamplerate for. This should be Fine To Do.

I'll also be using my own decoders to supply the audio data. I'll modify the Converter Node class in Cog, and move the format to float conversion code into a common function that can be used in other parts of the player. That way, I won't have to use their file decoders, either.

Also rewriting the entire network requests section to use Apple's network requests library. That part should be Fun.

I probably won't be supporting their radio functionality, though.

kode54 avatar Jul 12 '22 10:07 kode54

WIP to follow here:

https://github.com/kode54/liblastfm/tree/macNative

kode54 avatar Jul 13 '22 02:07 kode54

That was totally useless. There's no API for the fingerprint data. Guess I just get to spam Last.fm with whatever the hell tags the user has on their files.

kode54 avatar Jul 13 '22 09:07 kode54

I dont know if this implementation of last.fm scrobbling might be useful https://github.com/Arkq/cmusfm

danieltomasz avatar Sep 25 '22 20:09 danieltomasz

I have a working PoC for scrobbling from Cog, and potentially any other macOS application. It's based on another cli tool, and relies on polling with intervals, but it's way better than nothing.

Works well with radio streams too!

https://github.com/reactorcoremeltdown/radioscrobbler

IMO the scrobbler should stay external in relation to the player, and I think I will continue using it that way.

reactorcoremeltdown avatar Dec 11 '23 10:12 reactorcoremeltdown

Example of an output:

2023/12/11 12:08:31 Source macos updated song info to: makyo - tantrika
2023/12/11 12:09:06 Scrobbling completed
2023/12/11 12:17:46 Source macos updated song info to: Solar Fields - Unite
2023/12/11 12:18:22 Scrobbling completed
2023/12/11 12:26:59 Source macos updated song info to: SomaFM DropIn - L0pht: Aliases
2023/12/11 12:27:05 Source macos updated song info to: Spirallianz - The Re-Entry
2023/12/11 12:27:35 Scrobbling completed
2023/12/11 12:28:10 Scrobbling completed
Screenshot 2023-12-11 at 12 30 16

reactorcoremeltdown avatar Dec 11 '23 11:12 reactorcoremeltdown