Coder Social home page Coder Social logo

roeyb / node-spotify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from frontierpsychiatrist/node-spotify

0.0 2.0 0.0 1.86 MB

A module for node.js to use libspotify.

Home Page: http://www.node-spotify.com

License: MIT License

Python 1.39% C++ 72.30% C 20.83% JavaScript 5.48%

node-spotify's Introduction

node-spotify

Important note

Spotify has declared [1] libspotify, which this project is based on as "no longer under active development". A newer library will be released "later this year".

I hope to find the time to still add some features and remove bugs from node-spotify. When the new library is out I also want to check if a transition to it is feasible without changing the API too much.

[1] https://developer.spotify.com/technologies/libspotify/

Overview

node-spotify is a node.js module to use the Spotify API in an easy manner from node.js.

The node.js module is a native module written mainly in C++.

A webpage for the project is here: http://www.node-spotify.com.

Notes

I'm working toward version 1.0.0 which is not meant to provide everything libspotify offers. But I intend to wrap all libspotify types and provide methods to access them where possible. Options and convenience features my lack, though.

You need a spotify premium account to build or use node-spotify. This is a requirement for using libspotify, sorry. You also need an appkey that comes with a premium account (https://developer.spotify.com/technologies/libspotify/#application-keys).

Dependencies

node-gyp and libspotify are required for building. Under Linux you need libasound2-dev additionally. Install node-gyp via npm install -g node-gyp.

Your compiler must be able to translate some C++11 features (std::shared_ptr, G++ 4.7 or Clang 3.2 should do).

Compiling & installing

Compiling was tested on Raspbian, Ubuntu and OSX. Due to the usage of pthreads I'm not sure if node-spotify will compile on Windows.

There's one special option you can set when compiling node-spotify. --native_audio=false will compile no ALSA/OpenAL audio code (depending on your platform). Default is true. This is both settable for node-gyp and npm.

If you use OSX and have installed libspotify as a framework you need to edit the binding.gyp file. Remove "-lspotify" and write instead as one link option: "-framework OpenAL -framework libspotify". This is due to a bug in node-gyp that will eliminate a duplicate "-framework" entry from the link settings. If you have installed libspotify via homebrew you don't need this step.

Change into the main folder (where binding.gyp lies) and run node-gyp configure && node-gyp build.

Now the spotify module lies in ./build/Release/spotify.js. You can use it in a node.js program like so

var spotify = require('./build/Release/spotify')( {
  appkeyFile: './spotify_appkey.key'
});

The appkey file can be obtained from https://developer.spotify.com/technologies/libspotify/#application-keys (choose binary, not C-code).

Binary distribution

As of version 0.4.0 downloads of the pure compiled node.js module are available at http://www.node-spotify.com. I'll try to provide OSX, Linux x86_64 (ALSA) and Linux ARMv6hf (ALSA) builds.

How to debug node-spotify

Launch node.js and load node-spotify with require.

Attach lldb with $PID=process id of node

lldb -p $PID

Set a breakpoint with, for example

breakpoint set --file Album.cc --line 57

In the lldb console, execute this to continue the node.js process

cont

Now you can execute commands in node.js. That lead to the breakpoint.

If you want to attach additional breakpoints, interrupt the process with

process interrupt

in lldb.

Used software

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.