soundcloudnodejs.js
function getPlaylist(options) {
    return new Promise(function (resolve, reject) {

        if (!options.oauth_token) {
            reject(new Error('Error oauth_token is required, but is null'));
        } else {
            var uri = 'https://api.soundcloud.com/me/playlists?format=json&oauth_token=' + options.oauth_token;
            request.getAsync(uri, {timeout: 10000}).spread(function (response, body) {
                try {
                    var tracks = _.map(JSON.parse(body.toString('utf8')), function (track) {
                        return track;
                    });
                    if (DEBUG_MODE_ON) {
                        console.log('getPlaylist successful');
                    }
                    resolve(tracks);
                } catch (e) {
                    if (DEBUG_MODE_ON) {
                        console.log('Error while getPlaylist track: ', e);
                    }
                    reject(e);
                }
            }).catch(function (e) {
                if (DEBUG_MODE_ON) {
                    console.log('Error while getPlaylist track: ' + e);
                }
                reject(e);
            })
        }
    });
}
function getPlaylist(options) {
    return new Promise(function (resolve, reject) {

        if (!options.oauth_token) {
            reject(new Error('Error oauth_token is required, but is null'));
        } else {
            var uri = 'https://api.soundcloud.com/me/playlists?format=json&oauth_token=' + options.oauth_token;
            request.getAsync(uri, {timeout: 10000}).spread(function (response, body) {
                try {
                    var tracks = _.map(JSON.parse(body.toString('utf8')), function (track) {
                        return track;
                    });
                    if (DEBUG_MODE_ON) {
                        console.log('getPlaylist successful');
                    }
                    resolve(tracks);
                } catch (e) {
                    if (DEBUG_MODE_ON) {
                        console.log('Error while getPlaylist track: ', e);
                    }
                    reject(e);
                }
            }).catch(function (e) {
                if (DEBUG_MODE_ON) {
                    console.log('Error while getPlaylist track: ' + e);
                }
                reject(e);
            })
        }
    });
}
function getPlaylist ( options ) { return new Promise ( function ( resolve , reject ) { if ( ! options . oauth_token ) { reject ( new Error ( 'Error oauth_token is required, but is null' ) ) ; } else { var uri = 'https://api.soundcloud.com/me/playlists?format=json&oauth_token=' + options . oauth_token ; request . getAsync ( uri , { timeout : 10000 } ) . spread ( function ( response , body ) { try { var tracks = _ . map ( JSON . parse ( body . toString ( 'utf8' ) ) , function ( track ) { return track ; } ) ; if ( DEBUG_MODE_ON ) { console . log ( 'getPlaylist successful' ) ; } resolve ( tracks ) ; } catch ( e ) { if ( DEBUG_MODE_ON ) { console . log ( 'Error while getPlaylist track: ' , e ) ; } reject ( e ) ; } } ) . catch ( function ( e ) { if ( DEBUG_MODE_ON ) { console . log ( 'Error while getPlaylist track: ' + e ) ; } reject ( e ) ; } ) } } ) ; }
Get a playlist
@param options
@returns {bluebird|exports|module.exports}
Get a playlist