krateng / maloja

Self-hosted music scrobble database to create personal listening statistics and charts
https://maloja.krateng.ch
GNU General Public License v3.0
1.17k stars 68 forks source link

Funkwhale support #47

Closed elixx closed 4 years ago

elixx commented 4 years ago

I've been trying to get this to work with Funkwhale, which is supposed to work with both LastFM and ListenBrainz compatible scrobbling. I was hoping the legacy API addition might have been the trick, but it hasn't led anywhere.

https://dev.funkwhale.audio/funkwhale/funkwhale/-/tree/develop/api/funkwhale_api/contrib/scrobbler

Any ideas? Am I using a wrong endpoint?

krateng commented 4 years ago

What kind of feedback / error are you getting? From what I can tell, both legacy and new protocol should work as well as Listenbrainz. Listenbrainz should be the easiest, with the URL set to yourserver.tld/apis/listenbrainz.

elixx commented 4 years ago

I've tried with a bunch of different endpoints, but on the scrobbler side I'm getting back the HTML of an error page:

2020-10-31 18:05:10,222 plugins      INFO     Forwarding scrobble to http://10.0.0.99:42010/apis/listenbrainz
2020-10-31 18:05:11,257 plugins      WARNING  Plugin scrobbler errored during hook listening_created: <!DOCTYPE html>
<html>
        <head>
                <title>Maloja - Error</title>
...
                A team of Korean schoolgirls with katanas has been dispatched to deal with this situation.
...
</html>

Using the legacy plugin via http://ip:42010/apis/audioscrobbler_legacy I'm getting the same results.

At one point the other day, when I was messing around with the code in the PR for the legacy plugin, I was trying different URLs and managed to get an API response instead of a full HTML page that said something like { 'error': 'Unknown method' } or something similar.

Inside of the docker container, I've been tailing /etc/maloja/logs/*log and haven't gotten anything helpful.

krateng commented 4 years ago

http://ip:42010/apis/listenbrainz replaces the base URL of the listenbrainz server, so depending on the implementation of the scrobbler you might have to try http://ip:42010/apis/listenbrainz/1/ or http://ip:42010/apis/listenbrainz/1/submit-listens

krateng commented 4 years ago

So I just had a more detailed look at the code, looks like it doesn't support actual Listenbrainz scrobbling but only takes advantage of a Listenbrainz functionality to accept the Audioscrobbler protocol. It also for some reason determines the protocol based on whether the default URL is used, which makes things a little awkward - so it might actually be easier to use the legacy audioscrobbler. What result do you get when you try http://ip:42010/apis/audioscrobbler_legacy/?

elixx commented 4 years ago

Different results, Tailing the Maloja logs, I see:

==> apis.log <==
2020/11/01 11:39:45  API request: []

From the scrobbler side, the following is logged:

2020-11-01 11:39:44,982 plugins      INFO     Forwarding scrobble to http://10.0.0.99:42010/apis/audioscrobbler_legacy/
2020-11-01 11:39:55,932 plugins      WARNING  Plugin scrobbler errored during hook listening_created: HTTPSConnectionPool(host='10.0.0.99', port=42010): Read timed out. (read timeout=10)

I'll try setting up a packet capture between the two, later today, and try to extract the actual HTTP transaction.

krateng commented 4 years ago

Ah, that might be because the server returns https endpoints per default. I added the option to specifiy nossl as username to force a http connection.

elixx commented 4 years ago

Hey, it looks like that did the trick!

Thanks a lot!

phw commented 3 years ago

You might be interested in https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/1383 to add a native Maloja plugin to Funkwhale