Skip to content

Conversation

@martindale
Copy link

The format that LastFM was returning did not appear to be handled correctly, so I went ahead and inspected the format and modified index.js to reflect where the keys were.

@70hundert
Copy link

Hi there!

I'm trying to get the scrobbling running for plast.fm and plug.dj. So I used the code provided to this package:

...Some Plug.dj-Code before...

var Lastfm = require('simple-lastfm');
var lastfm = new Lastfm({
api_key: 'xxx',
api_secret: 'xxx',
username: 'xxx',
password: 'xxx'
});

...some more Plug.dj-Code...

console.log('New song: ' + JSON.stringify(data));

lastfm.getSessionKey(function(result) {
console.log("session key = " + result.session_key);

if(result.success) {
console.log("session key = success");

bot.chat("@" + bot.getDJs()[0].username
+ " is playing: :sound: "
+ bot.getMedia().author + " - "
+ bot.getMedia().title
+ "");

console.log(data);

lastfm.scrobbleNowPlayingTrack({
artist: bot.getMedia().author,
track: bot.getMedia().title,
callback: function(result) {
console.log("in callback, finished: ", result);
}
});
console.log("scrobbled");

So the terminal outputs first the session-key, then my console.log-entry for "session key success" gets displays, and the console.log(data) as well. Inside the chat-window the now playing artist and tracktitle are displayed.

But I don't get any scrobble to lastfm submitted, nor the console.log (scrobbled), which should be outputted after the successfull scrobble is missing. So the problem must be at

callback: function(result)

I guess.

I also tried the "Fix handshake problem" by martindale. When I ran the script using this fix i did get the following output:

{ '@': { status: 'ok' }, session: { name: 'xxxCORRECT NAME<<<', key: 'xxxCORRECT KEYxxx', subscriber: '0' } }

So I guess everything should be fine? But I returned to the original.js, because using it with the fix didn't provide me any output in the terminal after:

console.log('New song: ' + JSON.stringify(data));

Any tip on getting this to work?

@Shuunen
Copy link

Shuunen commented Jun 7, 2017

is this PR still useful ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants