andrewrk / node-groove

bindings to libgroove - music player backend library
MIT License
157 stars 16 forks source link

Can't inspect node-groove playlist object with console.dir #8

Closed whmountains closed 9 years ago

whmountains commented 10 years ago

As the title says, when I try to dump the node-groove playlist object with console.dir(playlist), I get an output of simply {}. This is right after I've created the playlist:

var playlist = groove.createPlaylist();
console.dir(playlist);

This is frustrating because that means it's hard to debug code that operates on these objects. For example,

console.dir(playlist.items());
//in my case returns [{},{}]
var files = _.pick(playlist.items(), 'file');
console.dir(files);
//returns {}

I can't figure out why _.pick isn't working if I can't even see the variable. (I suspect it can't see it either.)

This is probably some obvious newbie issue, (I haven't been coding in javascript for very long.) or it might actually be a bug. At any rate, I'd appreciate some enlightenment.

EDIT: I have this same problem if I put console.dir(playlist); right after the playlist declaration in the examples/playlist.js example file. It still returns {} but then goes on to play the audio file I asked it to.

P.S. I love node-groove <3

andrewrk commented 10 years ago

This has to do with the fact that the playlist items are native C++ objects. I'll see if I can set a flag or something in order to expose the fields. It might not be possible or practical to do, in which case you would have to rely on the README docs to know what fields existed.

I'm glad you're finding node-groove useful :-)

andrewrk commented 10 years ago

I looked into this a little bit. I am in fact setting the parameter in a way that should have the object be enumerable, but it does not seem to be respecting that value. Normally I would dig into this a little more and figure out what's going on, but we're nearing Node.js 0.12 release, which has a completely new API for v8 addons. This means this code will have to be rewritten and will look completely different. So I'm going to wait until Node.js 0.12 is released before trying to resolve this issue.

whmountains commented 10 years ago

Thanks for checking into it and being willing to fix it. I also appreciate the note about the update of node.js. I'd've naively upgraded and then realized that my most important package didn't work anymore.

andrewrk commented 9 years ago

Sorry, I think the best resolution to this is going to be to have detailed documentation in the README.