web-scrobbler / web-scrobbler

Scrobble music all around the web!
https://web-scrobbler.com
MIT License
2.44k stars 545 forks source link

Add other means of identifying a service #1882

Open SkyLeite opened 5 years ago

SkyLeite commented 5 years ago

Is it possible to add an option for connectors to identify a service through means other than the website's URL? It would make adding support for self-hosted platforms such as https://funkwhale.audio, which are not tied to a specific pattern or URL, but work consistently across all of them.

inverse commented 5 years ago

We provide the ability to change the URL for a given connector. See https://github.com/web-scrobbler/web-scrobbler/wiki/Custom-URL-patterns

Is that sufficient?

SkyLeite commented 5 years ago

It works in the short term, but I think ideally it's best to have something like having the extension look for certain meta tags to automatically identify such services.

inverse commented 5 years ago

This has been mentioned before. Perhaps it's time to start implementing some Dom parsing matcher as an experimental feature for this.

agateblue commented 5 years ago

Hi, Funkwhale maintainer here :)

If needed, I can easily add a meta tag into Funkwhale HTML, like <meta name="generator" content="funkwhale 0.18">. I'm not sure how the actual scrobbling work though. How does Web Scrobbler identifies that the player switched to another track? If I can help with that, let me know!

inverse commented 5 years ago

Hey @EliotBerriot - thanks for reaching out. Once we start implementing this feature I can imagine that'll be useful for injecting the correct logic into the page.

The scrobbling normally works by binding to DOM elements and watching for changes. e.g. like this: https://github.com/web-scrobbler/web-scrobbler/blob/master/src/connectors/mnet.js

Sometimes even binding to native audio elements or the JS that the apps expose.

agateblue commented 5 years ago

The scrobbling normally works by binding to DOM elements and watching for changes. e.g. like this: https://github.com/web-scrobbler/web-scrobbler/blob/master/src/connectors/mnet.js

Makes sense, I'll try to keep stable class names for artists / albums / track data then!

alexesprit commented 4 years ago

I've added a basic support for identifying websites via checking for match rules in a content script. Will merge these changes into master branch after some testing and extending the match rules.

alexesprit commented 4 years ago

@EliotBerriot would be great if you add a meta tag like you suggested. I think it should contain no version:

<meta name="generator" content="Funkwhale">

as the version is redundant here (can be added as a separate meta tag, though).

agateblue commented 4 years ago

@alexesprit, sure, I'll do that today, and it will be included in our next release :)

agateblue commented 4 years ago

@alexesprit So it's been implemented, and deployed at https://open.audio/library if you want to try it. Let me know if you need me to set some static classes / attributes on the player to make the job easier for you :)

stephanebruckert commented 4 years ago

Can we find a method to do this with the Spotify and Bandcamp embeds as well? These are still open/unmerged:

alexesprit commented 4 years ago

@stephanebruckert the way I added should work for embeds in theory, but I haven't checked it.

There're some known limitations:

inverse commented 4 years ago

@alexesprit did you make any progress on this injection mechanism?

alexesprit commented 4 years ago

https://github.com/web-scrobbler/web-scrobbler/tree/feature/request-inject but it's not finished.