Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom scrobblers #37

Closed
frewsxcv opened this issue Jan 29, 2012 · 37 comments
Closed

Support custom scrobblers #37

frewsxcv opened this issue Jan 29, 2012 · 37 comments
Labels
feature New feature or request

Comments

@frewsxcv
Copy link

Allow users to input a 3rd party scrobbler, like FOSS scrobbler libre.fm

@david-sabata
Copy link
Contributor

The page you linked says "Currently, we're implementing the Audioscrobbler API." and Audioscrobbler API = Last.fm API.
So I guess it would be possible to add some kind of "switch" to select whether you want to scrobble your music at Last.fm or Libre.fm, once they finish the API.

@frewsxcv
Copy link
Author

"Currently, we're implementing the Audioscrobbler API." means it's already been implemented and is for the most part identical, so there shouldn't be any backend changes to reflect the switch between Librefm and Lastfm

@treyhunner
Copy link

👍 I would appreciate libre.fm support also

@treyhunner
Copy link

I tried modifying the plugin to use libre.fm instead (to see if it worked).

I could authenticate but now on every page the icon in the URL bar informs me that the song could not be identified. When I click the icon the track is filled in but the artist is blank. Any ideas what this might indicate?

Here's my experimental change: treyhunner/web-scrobbler@97331d8

@david-sabata
Copy link
Contributor

@treyhunner It's been a while since this issue was created, but we're finally getting somewhere. I am reworking the core of the extension and definitely plan on supporting multiple scrobbling services. And it will be even easier with Libre.fm supporting Audioscrobbler API

@Shuunen
Copy link

Shuunen commented Jan 8, 2015

@david-sabata I tryed to do like @treyhunner but doesn't worked, any solutions by now ?

@david-sabata
Copy link
Contributor

@Shuunen Does the Libre.fm really implement the same API as Last.fm? It seems that the track didn't pass the validation (asking the L.FM if it is valid).

@inverse
Copy link
Member

inverse commented Jan 8, 2015

This server is compatible with Last.fm’s so nearly all scrobbling clients will scrobble to Libre.fm. (Note that to get many clients to work you actually have to modify your /etc/hosts file to redirect outgoing connections that would normally go to post.audioscrobbler.com so that they go to the libre.fm scrobbling machine.

src: http://musicmachinery.com/2009/04/24/librefm-whats-the-point/

A bit old but probably still relevant.

@david-sabata
Copy link
Contributor

AFAIK there is no hardcoded url other than this https://github.com/david-sabata/web-scrobbler/blob/master/core/background/services/lastfm.js#L19

@inverse
Copy link
Member

inverse commented Jan 8, 2015

I'll give it a shot and will report back...

@inverse
Copy link
Member

inverse commented Jan 8, 2015

It's not working with the above changes. I had to modify the callback for the auth too which went off and successfully set the token within the storage. However the problem then came with scrobbling:

https://libre.fm/2.0/?method=track.updatenowplaying&track=I%2C%20You%2C%20We%20Know...&artist=Sun%20Glitters&api_key=d9bb1870d3269646f740544d9def2c95&sk=54af1563653e3b9a21e2ce67177a2bd5&album=Scattered%20Into%20Light&duration=232&api_sig=ab859b70e48d11f9f019f658cc935fd0
``

Receiving the following

<lfm status="failed">
  <error code="6">Invalid parameters - Your request is missing a required parameter</error>
</lfm>

Here is the src code for the Libre.fm update method:

@Shuunen
Copy link

Shuunen commented Jan 8, 2015

I was looking at Simple Last.fm Scrobbler (https://github.com/tgwizard/sls) wich scrobble to Last.fm and Libre.fm (I use it on my android phone) and I saw that in the code :

LASTFM(
        0x01, "Last.fm", "http://post.audioscrobbler.com/?hs=true", "",
        "https://www.last.fm/join", "http://www.last.fm/user/%1"), //
    LIBREFM(
        0x02, "Libre.fm", "http://turtle.libre.fm/?hs=true", "librefm",
        "http://libre.fm/", "http://libre.fm/user/%1");

So maybe it would work with "turtle.libre.fm" ?

@Shuunen
Copy link

Shuunen commented Jan 8, 2015

By looking at the php code of libre fm api :

https://gitorious.org/foocorp/gnu-fm/source/75335015c23cfa057232ca4c42c4b31b8e23a670:nixtape/2.0/index.php#L1392

And what you sent :
method: track.updatenowplaying
track: I, You, We Know...
artist: Sun Glitters
api_key: d9bb1870d3269646f740544d9def2c95
sk: 54af1563653e3b9a21e2ce67177a2bd5
album: Scattered Into Light
duration: 232
**api_sig:**ab859b70e48d11f9f019f658cc935fd0

That should work, only artist , track and sk are required acording to function comments, and only artist and track according to the code inside :

 if (!isset($_POST['artist']) || !isset($_POST['track'])) {
        report_failure(LFM_INVALID_PARAMS);
    }

@inverse
Copy link
Member

inverse commented Jan 8, 2015

Got it working :) Proof: https://libre.fm/user/inversechi

Had to change one line based on looking through the libre.fm src

http_request.send($.param(params));

Branch: https://github.com/inverse/web-scrobbler/tree/libre-fm
Chnges: https://github.com/inverse/web-scrobbler/compare/libre-fm

@Shuunen
Copy link

Shuunen commented Jan 8, 2015

Nice, gonna try this :)

@inverse
Copy link
Member

inverse commented Jan 8, 2015

Not 100% sure since in the stat's nothing is showing up. But no errors or anything else. Perhaps they take time.

Ahhh Noticed something already.

submit called for Sun Glitters - Lonely Trip (Scattered Into Light)
scrobbler.js:408 submitted Sun Glitters - Lonely Trip (<?xml version="1.0"?>
<lfm status="failed">
  <error code="6">Invalid parameters - Your request is missing a required parameter</error>
</lfm>

I guess to do with the same issue as mentioned above with param encoding. I'll fix this and update the branch.

Good luck and thanks for the pointer of the turtle domain - interesting to see how they've worked on just mirroring the API to make all existing code easy to port/use :)

@Shuunen
Copy link

Shuunen commented Jan 8, 2015

I tested your changes @inverse and it works well for updating the "now playing track", here the request to libre.fm :

https://libre.fm/2.0/?method=track.updatenowplaying&track=Planet%20Munderscore&artist=Glen%20Porter&api_key=xxx&sk=yyy&duration=147&api_sig=zzz

and the response :

<?xml version="1.0"?>
<lfm status="ok">
  <nowplaying>
    <track corrected="0">Planet Munderscore</track>
    <artist corrected="0">Glen Porter</artist>
    <album corrected="0"/>
    <albumArtist corrected="0"/>
    <ignoredMessage code="0"/>
  </nowplaying>
</lfm>

But, the scrobble for the same track don't work :

https://libre.fm/2.0/?method=track.scrobble&timestamp[0]=1420724305&track[0]=Planet%20Munderscore&artist[0]=Glen%20Porter&api_key=xxx&sk=yyy&source[0]=YouTube&sourceId[0]=pY1G5wZFQQg&api_sig=zzz

here the response :

<?xml version="1.0"?>
<lfm status="failed">
  <error code="6">Invalid parameters - Your request is missing a required parameter</error>
</lfm>

@inverse
Copy link
Member

inverse commented Jan 8, 2015

@Shuunen Sorry about that - I realised that after I said it worked. I pushed a small change to fix the scrobbling part. It was the same as the update fiix involving using jQuery's param function.

@Shuunen
Copy link

Shuunen commented Jan 8, 2015

@inverse don't be sorry, thank you a lot for helping
@david-sabata what do you think of this update, will it be in the next release ?

@inverse
Copy link
Member

inverse commented Jan 8, 2015

I can tell you that it won't be in the next release - This was just a proof of concept that shows that there isn't much work required to 'switch' last.fm for libre.fm.

I don't know the direction that @david-sabata plans on taking alternative scrobbling but the way I envision it would be allow multiple scrobblers to be registered and pushed too. This would require a lot of work from both setting up accounts and pushing.

@Shuunen
Copy link

Shuunen commented Jan 8, 2015

A switch (Last/Libre) will be simpler to develop for a first release, then a multiple scrobbling settings in the future.

@inverse your fix works well now :)

@david-sabata
Copy link
Contributor

I'd like to go for multiple "connected accounts". It's good that Libre.fm has the same API, but that won't be the case for possible other services.

Introducing a simple switch to hot fix would most likely mean the switch will stay there forever and I'd like to have more generic solution :)

@inverse
Copy link
Member

inverse commented Jan 9, 2015

+1 for Generic solution over switch

@Shuunen
Copy link

Shuunen commented Jan 9, 2015

+1 too :) I thought switch to simplify development but sure the generic solution is way more elegant :)

Thanks guys for your work :)

@AltarBeastiful
Copy link
Contributor

Anyone working on this? I'd be glad to help get this in!

strongly implies +1

@inverse
Copy link
Member

inverse commented Jun 26, 2015

I have a proof of concept in a branch. It's way out of date but feel free to pick it up and work on it:

https://github.com/inverse/web-scrobbler/tree/libre-fm

Perhaps speak with @david-sabata first if he has any ideas of where to take this though.

@AltarBeastiful
Copy link
Contributor

Yes saw that. Works well!

I'll look into the generic solution proposed before. Multi-account scrobbling sounds cool.

@cywtf
Copy link

cywtf commented Jul 29, 2015

Thanks a lot for the branch @inverse. I just tested and it worked wonderfully.
I've been searching for this for a while. Thanks!

@a-r-db
Copy link
Contributor

a-r-db commented Aug 10, 2015

+1 I will try to help on this if I can. Any support for dual scrobbling?

@inverse
Copy link
Member

inverse commented Aug 16, 2015

Working on a new version of this: master...inverse:multi-scrobble

@Avamander
Copy link

Any updates to this?

@inverse
Copy link
Member

inverse commented Jul 7, 2017

Still WIP @Avamander

@alexesprit
Copy link
Member

Added initial support for Libre.fm and multiple scrobbling services.

@eternal-sorrow
Copy link

Ping here when it's uploaded to chrome webstore.

@marsjaninzmarsa
Copy link
Contributor

@eternal-sorrow: ping.

@inverse
Copy link
Member

inverse commented Sep 23, 2017

Custom scrobblers are stilll a long way off but feasible.

@eternal-sorrow
Copy link

works fine, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests