tunewiki

NodeJS wrapper for the TuneWiki API

npm install tunewiki
17 downloads in the last month

node-tunewiki

NodeJS module for working with the tunewiki api

NPM

Initialization

var TuneWiki = require('tunewiki');
var tunewiki = new TuneWiki({
   key: TUNEWIKI_API_KEY,
   secret: TUNEWIKI_API_SECRET,
   username: TUNEWIKI_USERNAME,
   password: TUNEWIKI_PASSWORD
});

Lyrics

tunewiki.lyrics(artist, song, [language], [data], callback)

// Get lyrics
tunewiki.lyrics('coldplay', 'clocks', function (err, result) {
    // result =>
    // {
    //     '1': {
    //         ts: 0, 
    //         text: 'Lights go out and I can\'t be saved'
    //     },
    //     '2': {
    //         ts: 32730,
    //         text: 'Tides that I tried to swim against'
    //     },
    //     '3': {
    //         ts: 36540,
    //         text: 'Have fought me down upon my knees'
    //     },
    //     ...
    // }
});
// Get lyrics by language
tunewiki.lyrics('coldplay', 'clocks', 'fr', function (err, result) {
    // result =>
    // {
    //     '1': {
    //         ts: 0, 
    //         text: 'lumières s'éteignent et je ne peux pas être sauvé'
    //     },
    //     ...
    // }

});
// Set lyrics
var lyrics = {
    "1": {
        "ts": 0,
        "text": "lights go out and i can't be saved"
    },
    "2": {
        "ts": 32725,
        "text": "tides that i tried to swim against"
    },
    "3": {
        "ts": 36575,
        "text": "you've forced me down upon my knees"
    },
    ...
};
tunewiki.lyrics('coldplay', 'clocks', lyrics, function (err, result) {
   // result =>
   // {
   //    error: 'Not yet implemented'
   // }
});

Search

tunewiki.search.*(query, callback)

tunewiki.search.lyrics
tunewiki.search.artists
tunewiki.search.artistsongs
tunewiki.search.hashtags
tunewiki.search.shares
tunewiki.search.songs('Macklemore & Ryan Lewis', function (err, result) {
    // result =>
    // {
    //     "type": "songs",
    //     "hasMore": true,
    //     "results": [
    //         ...
    //         {
    //             "playcount": 1,
    //             "score": 6.9330707,
    //             "artist": {
    //                 "id": 283780,
    //                 "name": "Macklemore & Ryan Lewis"
    //             },
    //             "song": {
    //                 "id": 4437851,
    //                 "artist_id": 283780,
    //                 "name": "Macklemore - Can't Hold Us"
    //             }
    //         },
    //         ...
    //     ]
    // }
});
npm loves you