tinysong-api

Nodejs tinysong implementation, normalization, and extension. Adds AlbumCover images as well.

npm install tinysong-api
7 downloads in the last week
13 downloads in the last month

tinysong-node-api

Diginow.it Nodejs tinysong implementation, normalization, and extension.


Install

npm install tinySong-api


Methods

set your api key

tinySong.api.set.key('your-api-key-here');

you must do this before making any API calls, this may also be useful to stagger calls across keys for high traffic applications.

get the tiny song url for a single song

tinySong.api.get.url(query,callback);

example:

var tinySong=require('tinySong-api');
tinySong.api.get.url('test',console.log);

>http://tinysong.com/vLxC

get the most likely song for a given query

tinySong.api.get.song(query,callback);

example:

var tinySong=require('tinySong-api');
tinySong.api.get.song('test',console.log);

>[
    {
        Url: 'http://tinysong.com/vLxC',
        SongID: 25854857,
        SongName: 'Mmm Mmm Mmm Mmm',
        ArtistID: 3201,
        ArtistName: 'Crash Test Dummies',
        AlbumID: 155790,
        AlbumName: 'God Shuffled His Feet', 
        AlbumCover:{
            s30: 'http://images.gs-cdn.net/static/albums/30_155790.jpg',
            s40: 'http://images.gs-cdn.net/static/albums/40_155790.jpg',
            s50: 'http://images.gs-cdn.net/static/albums/50_155790.jpg', 
            s60: 'http://images.gs-cdn.net/static/albums/60_155790.jpg',
            s70: 'http://images.gs-cdn.net/static/albums/70_155790.jpg',
            s80: 'http://images.gs-cdn.net/static/albums/80_155790.jpg',
            s90: 'http://images.gs-cdn.net/static/albums/90_155790.jpg' 
        } 
    } 
] 

note the addition of the AlbumCovers node, this is a pre processed list of album cover images. The key is s30 - s90 (s - size, 30-90 pixels)

get a list of the most likely song matches for a query

tinySong.api.get.list(query,callback,limit);

this call will by default return 5 songs. The max number able to be returned is 32.

example:

var tinySong=require('tinySong-api');
tinySong.api.get.list('test',console.log,3);

>[
    { 
        Url: 'http://tinysong.com/vLxC',
        SongID: 25854857,
        SongName: 'Mmm Mmm Mmm Mmm',
        ArtistID: 3201,
        ArtistName: 'Crash Test Dummies',
        AlbumID: 155790,
        AlbumName: 'God Shuffled His Feet'
        AlbumCover: { 
            s30: 'http://images.gs-cdn.net/static/albums/30_155790.jpg', 
            s40: 'http://images.gs-cdn.net/static/albums/40_155790.jpg', 
            s50: 'http://images.gs-cdn.net/static/albums/50_155790.jpg', 
            s60: 'http://images.gs-cdn.net/static/albums/60_155790.jpg', 
            s70: 'http://images.gs-cdn.net/static/albums/70_155790.jpg', 
            s80: 'http://images.gs-cdn.net/static/albums/80_155790.jpg', 
            s90: 'http://images.gs-cdn.net/static/albums/90_155790.jpg' 
        } 
    },
    {
        Url: 'http://tinysong.com/rfCM',
        SongID: 24525551,
        SongName: 'Pass That Dutch',
        ArtistID: 92,
        ArtistName: 'Missy Elliott',
        AlbumID: 2630650,
        AlbumName: 'This Is Not a Test!',
        AlbumCover:{
            s30: 'http://images.gs-cdn.net/static/albums/30_2630650.jpg',
            s40: 'http://images.gs-cdn.net/static/albums/40_2630650.jpg', 
            s50: 'http://images.gs-cdn.net/static/albums/50_2630650.jpg', 
            s60: 'http://images.gs-cdn.net/static/albums/60_2630650.jpg',
            s70: 'http://images.gs-cdn.net/static/albums/70_2630650.jpg',
            s80: 'http://images.gs-cdn.net/static/albums/80_2630650.jpg',
            s90: 'http://images.gs-cdn.net/static/albums/90_2630650.jpg'
        } 
    },
    { 
        Url: 'http://tinysong.com/17HjJ',
        SongID: 8571369,
        SongName: 'Mmmm Mmmm Mmmm Mmmm',
        ArtistID: 3201,
        ArtistName: 'Crash Test Dummies',
        AlbumID: 155790,
        AlbumName: 'God Shuffled His Feet',
        AlbumCover:{
            s30: 'http://images.gs-cdn.net/static/albums/30_155790.jpg',
            s40: 'http://images.gs-cdn.net/static/albums/40_155790.jpg',
            s50: 'http://images.gs-cdn.net/static/albums/50_155790.jpg',
            s60: 'http://images.gs-cdn.net/static/albums/60_155790.jpg',
            s70: 'http://images.gs-cdn.net/static/albums/70_155790.jpg',
            s80: 'http://images.gs-cdn.net/static/albums/80_155790.jpg',
            s90: 'http://images.gs-cdn.net/static/albums/90_155790.jpg'
        }
    }
]   

note the addition of the AlbumCovers node, this is a pre processed list of album cover images. The key is s30 - s90 (s - size, 30-90 pixels)


Written with StackEdit.

npm loves you