Git Product home page Git Product logo

node-daap's Introduction

node-daap

NPM

node-daap is a Node.js helper library for Apple DAAP protocol. DAAP protocol has been built over HTTP. Apple doesn't provide a proper documentation for his protocol, that's why it is difficult to get some efficient information about the protocol. Almost all of the work that has been done, has been made by sniffing the network between my computer and official Apple Remote app. I will update the documentation as soon as I have some new information.

The library uses request to handle some interaction between user and iTunes. It has been designed to be as easiest as possible to use !

###Options

  • host : IP address or domain name where iTunes is located ;
  • port : Port which iTunes uses (default : 3689)
  • pairingCode : pairing code used to connect to iTunes the first time. You can get a proper pairing code using this tool : PairingJS. Please send me your question about this tool.

###Implementation

All the methods are built in the same way : they are all asynchronous, and every callbacks are composed with the same parameters. Here is an example :

var daap = require('daap');

daap.serverInfo(function (error, response) {
    // error = null, if everything is fine
    // response = JS object, parsed from web request response
});

Here are the methods which are currently in node-daap.

####serverInfo

  • Description : Provides information about what the server supports or not.
  • Parameters :
    • None

####login

  • Description : Provides session information for the next requests.
  • Parameters :
    • None

####databases

  • Description : Provides list of databases served up by the server.
  • Parameters :
    • sessionId : Session token get from the login request.

####containers

  • Description : Provides list of playlists which are in the user provided database.
  • Parameters :
    • sessionId : Session token get from the login request.
    • databaseId : Database ID get from the databases request.

####items

  • Description : Provides items (songs) that are in the user provided container.
  • Parameters :
    • sessionId : Session token get from the login request.
    • databaseId : Database ID get from the databases request.
    • containerId : Container ID get from the containers request

####play

  • Description : Play the user provided song.
  • Parameters :
    • sessionId : Session token get from the login request.
    • songId : Song ID get from the items request.

####setProperty

  • Description : Set one or many property (such as volume, for example) in iTunes.
  • Parameters :
    • sessionId : Session token get from the login request.
    • properties : Simple JS object with the properties to set.

####getProperty

  • Description : Get one or many property (such as volume, for example) in iTunes.
  • Parameters :
    • sessionId : Session token get from the login request.
    • properties : Simple JS array with the properties to get.

####artwork

  • Description : Get cover image for a song.
  • Parameters :
    • sessionId : Session token get from the login request.
    • databaseId : Database ID get from the databases request.
    • songId : Song ID get from the items request.

####playPause

  • Description : Play/pause iTunes current song.
  • Parameters :
    • sessionId : Session token get from the login request.

####playStatusUpdate

  • Description : Get information for the current iTunes song.
  • Parameters :
    • sessionId : Session token get from the login request.

###Testing

Every methods have been tested using Nodeunit. You can try yourself and get some examples in the "tests" directory.

koinkoin:/Users/jeffrey/Repositories/node-daap jeffrey$ nodeunit tests/01_music_fetcher.js 
Make sure your environment is properly configured !!
Make sure iTunes is ready.

01_music_fetcher.js
✔ serverInfo
✔ login
✔ databases
✔ containers
✔ items

OK: 16 assertions (937ms)

###Inspiration

This project has found inspiration thanks to great projects and great papers. Here are relevant links to understand how DAAP works :

###License

node-daap is freely distributable under the terms of the MIT license.

Copyright (c) 2012 - 2013 Jeffrey Muller <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Bitdeli Badge

node-daap's People

Contributors

adunkman avatar

Watchers

 avatar

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.