This commit is contained in:
2022-09-30 05:39:11 +00:00
parent 41ee9463ae
commit 4687fa49bc
11418 changed files with 1312504 additions and 0 deletions

1
buildfiles/app/node_modules/lastfmapi/.npmignore generated vendored Normal file
View File

@ -0,0 +1 @@
node_modules

22
buildfiles/app/node_modules/lastfmapi/LICENSE generated vendored Normal file
View File

@ -0,0 +1,22 @@
Copyright (c) 2013 Max Kueng
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.

472
buildfiles/app/node_modules/lastfmapi/README.md generated vendored Normal file
View File

@ -0,0 +1,472 @@
LastfmAPI
=========
This is a wrapper library for James' [lastfm-node][lastfmnode] module, a
Last.fm API client for Node.js.
It aims to provide a simpler API for the Last.fm methods with one single
callback function instead of an options object with handler methods. It
also adds a signature to all methods that require signing automatically.
Getting Started
---------------
Install with npm
```sh
npm install lastfmapi
```
or add it to the `dependencies` array in your package.json file. This
module follows the [Semantic Versioning][semver] guidelines so you can
expect all sub-versions of the same major version to have a compatible
API.
Use `require` to load the module
```javascript
var LastfmAPI = require('lastfmapi');
```
and create a new instance as follows:
```javascript
var lfm = new LastfmAPI({
'api_key' : 'YOUR_API_KEY',
'secret' : 'YOUR_API_SECRET'
});
```
Try it out:
```javascript
lfm.track.getInfo({
'artist' : 'Poliça',
'track' : 'Wandering Star'
}, function (err, track) {
if (err) { throw err; }
console.log(track);
});
```
If you don't already have a Last.fm API account, you can get one
[here][register].
Examples
--------
### Authentication for Web Applications
_Check out the authentication example in the examples directory for a working example._
In order to make signed method calls or use write methods such das
scrobbling, you need to authenticate your application. Read more about
web application authentication [here][webauth].
To authenticate a user for a web application, first define a callback
URL (`cb`) that will handle the authentication token. Then create an
authentication URL and redirect the user to it.
```javascript
var authUrl = lfm.getAuthenticationUrl({ 'cb' : 'http://example.com/auth' });
console.log(authUrl); // redirect the user to this URL
```
The URL will look something like
"http://www.last.fm/api/auth/?api_key=YOUR_API_KEY&cb=http%3A%2F%2Fexample.com%2Fauth"
After the user has authorized your application, Last.fm will redirect
the user to your callback URL. Somethig like
"http://example.com/auth?token=THE_AUTHENTICATION_TOKEN"
Then use the `authenticate` method using the received authentication
token:
```javascript
lfm.authenticate('THE_AUTHENTICATION_TOKEN', function (err, session) {
if (err) { throw err; }
console.log(session); // {"name": "LASTFM_USERNAME", "key": "THE_USER_SESSION_KEY"}
});
```
The `authenticate` method is a short-hand function that does
`auth.getSession` and stores the session credentials in the `LastfmAPI`
object using the `setSessionCredentials` method. You could also do the
same things manually.
The method will give you an object containing the user's session
credentials. It is advised that you save this data to disc for later
use. Session keys do not expire.
To authenticate the user again at a later time, simply set the
credentials using `setSessionCredentials` and you are set to make
authenticated method calls:
```javascript
lfm.setSessionCredentials('LASTFM_USERNAME', 'THE_USER_SESSION_KEY');
```
### Authentication for Desktop Applications
_(Coming soon)_
### Authentication for Mobile Applications
_(Coming soon)_
### Scrobbling
This example requires authentication and assumes you have your session
credentials at-the-ready. Look at the
[authentication](#authentication-for-web-applications) example to see
how it works.
```javascript
var LastfmAPI = require('lastfmapi');
// Create a new instance
var lfm = new LastfmAPI({
'api_key' : 'YOUR_API_KEY',
'secret' : 'YOUR_API_SECRET'
});
var mySessionCreds = {
'username' : 'myLastFmUsername',
'key' : 'MY_LASTFM_SESSION_KEY'
};
lfm.setSessionCredentials(mySessionCreds.username, mySessionCreds.key);
// Scrobble 'Wandering Star' by 'Poliça', 5 minutes ago
lfm.track.scrobble({
'artist' : 'Poliça',
'track' : 'Wandering Star',
'timestamp' : Math.floor((new Date()).getTime() / 1000) - 300
}, function (err, scrobbles) {
if (err) { return console.log('We\'re in trouble', err); }
console.log('We have just scrobbled:', scrobbles);
});
```
_(More coming soon)_
Documentation
-------------
The rule of thumb is that when a method has only required parameters, or
one or more required and one optional parameter, they will be
represented in the API as regular function arguments. If the method
takes one or more required and multiple optional parameters, the
function will take a `params` object. If all parameters are optional,
the `params` object becomes optional.
The first argument of the callback is always `err`, which is an Error
object in case of an error or null if everything went well. The second
argument is the result.
The following documentation assumes that `lfm` is an instance of LastfmAPI.
##### `new LastfmAPI(options)`
The constructor takes an options object with 2 properties: The `api_key`
property contains your Last.fm API key and `secret` contains your
Last.fm API secret
##### `lfm.api`
Exposes the underlying [lastfm-node][lastfmnode] API client so you can
go "low-level" if you like
##### `lfm.getAuthenticationUrl(params)`
Constructs and returns an authentication URL. The params object has 2
optional properties: `cb` is the callback URL and `token` is an
authentication token
##### `lfm.authenticate(token, callback(err, sessionData))`
Fetches a Last.fm session and stores the session credentials in the
object
##### `lfm.setSessionCredentials(username, sessionToken)`
Stores session credentials that will be used to make API calls that
require authentication
##### `lfm.sessionCredentials`
Exposes the session credentials used to make authenticated API calls.
The object contains 2 properties: `username` is the Last.fm username and
`key` is the session key
Jump: [Album](#album) | [Artist](#artist) | [Auth](#auth) | [Chart](#chart) | [Geo](#geo) | [Library](#library) | [Tag](#tag) | [Track](#track) | [User](#user)
### Album
##### `lfm.album.addTags(artist, album, tags, callback(err))`
See [docs](http://www.last.fm/api/show/album.addTags). `tags` can be a string or an array.
##### `lfm.album.getInfo(params, callback(err, album))`
See [docs](http://www.last.fm/api/show/album.getInfo) for params.
##### `lfm.album.getTags(params, callback(err, tags))`
See [docs](http://www.last.fm/api/show/album.getTags) for params.
##### `lfm.album.getTopTags(params, callback(err, toptags))`
See [docs](http://www.last.fm/api/show/album.getTopTags) for params.
##### `lfm.album.removeTag(artist, album, tag, callback(err))`
See [docs](http://www.last.fm/api/show/album.removeTag).
##### `lfm.album.search(params, callback(err, results))`
See [docs](http://www.last.fm/api/show/album.search) for params.
### Artist
##### `lfm.artist.addTags(artist, tags, callback(err))`
See [docs](http://www.last.fm/api/show/artist.addTags). `tags` can be a string or an array.
##### `lfm.artist.getCorrection(artist, callback(err, corrections))`
See [docs](http://www.last.fm/api/show/artist.getCorrection).
##### `lfm.artist.getInfo(params, callback(err, artist))`
See [docs](http://www.last.fm/api/show/artist.getInfo) for params.
##### `lfm.artist.getSimilar(params, callback(err, similarArtists))`
See [docs](http://www.last.fm/api/show/artist.getSimilar) for params.
##### `lfm.artist.getTags(params, callback(err, tags))`
See [docs](http://www.last.fm/api/show/artist.getTags) for params.
##### `lfm.artist.getTopAlbums(params, callback(err, topAlbums))`
See [docs](http://www.last.fm/api/show/artist.getTopAlbums) for params.
##### `lfm.artist.getTopTags(params, callback(err, topTags))`
See [docs](http://www.last.fm/api/show/artist.getTopTags) for params.
##### `lfm.artist.getTopTracks(params, callback(err, topTracks))`
See [docs](http://www.last.fm/api/show/artist.getTopTracks) for params.
##### `lfm.artist.removeTag(artist, tag, callback(err))`
See [docs](http://www.last.fm/api/show/artist.removeTag).
##### `lfm.artist.search(params, callback(err, results))`
See [docs](http://www.last.fm/api/show/artist.search) for params.
### Auth
##### `lfm.auth.getMobileSession(username, password, callback(err, session))`
See [docs](http://www.last.fm/api/show/auth.getMobileSession).
##### `lfm.auth.getSession(token, callback(err, session))`
See [docs](http://www.last.fm/api/show/auth.getSession).
##### `lfm.auth.getToken(callback(err, token))`
See [docs](http://www.last.fm/api/show/auth.getToken).
###Chart
##### `lfm.chart.getTopArtists([params,] callback(err, artists))`
See [docs](http://www.last.fm/api/show/chart.getTopArtists) for params. `params` is optional.
##### `lfm.chart.getTopTags([params,] callback(err, tags))`
See [docs](http://www.last.fm/api/show/chart.getTopTags) for params. `params` is optional.
##### `lfm.chart.getTopTracks([params,] callback(err, tracks))`
See [docs](http://www.last.fm/api/show/chart.getTopTracks) for params. `params` is optional.
### Geo
##### `lfm.geo.getTopArtists(params, callback(err, topArtists))`
See [docs](http://www.last.fm/api/show/geo.getTopArtists) for params.
##### `lfm.geo.getTopTracks(params, callback(err, topTracks))`
See [docs](http://www.last.fm/api/show/geo.getTopTracks) for params.
### Library
##### `lfm.library.getArtists(params, callback(err, artists))`
See [docs](http://www.last.fm/api/show/library.getArtists) for params.
### Tag
##### `lfm.tag.getInfo(tag, [lang,] callback(err, tag))`
See [docs](http://www.last.fm/api/show/tag.getInfo). `lang` is optional and, if provided, must be an ISO 639 alpha-2 language code.
##### `lfm.tag.getSimilar(tag, callback(err, similarTags))`
See [docs](http://www.last.fm/api/show/tag.getSimilar).
##### `lfm.tag.getTopAlbums(params, callback(err, topAlbums))`
See [docs](http://www.last.fm/api/show/tag.getTopAlbums) for params.
##### `lfm.tag.getTopArtists(params, callback(err, topArtists))`
See [docs](http://www.last.fm/api/show/tag.getTopArtists) for params.
##### `lfm.tag.getTopTags(callback(err, topTags))`
See [docs](http://www.last.fm/api/show/tag.getTopTags).
##### `lfm.tag.getTopTracks(params, callback(err, topTracks))`
See [docs](http://www.last.fm/api/show/tag.getTopTracks) for params.
##### `lfm.tag.getWeeklyChartList(tag, callback(err, weeklyChartList))`
See [docs](http://www.last.fm/api/show/tag.getWeeklyChartList).
### Track
##### `lfm.track.addTags(artist, track, tags, callback(err))`
See [docs](http://www.last.fm/api/show/track.addTags). `tags` can be a string or an array.
##### `lfm.track.getCorrection(artist, track, callback(err, corrections))`
See [docs](http://www.last.fm/api/show/track.getCorrection).
##### `lfm.track.getInfo(params, callback(err, track))`
See [docs](http://www.last.fm/api/show/track.getInfo) for params.
##### `lfm.track.getSimilar(params, callback(err, similarTracks))`
See [docs](http://www.last.fm/api/show/track.getSimilar) for params.
##### `lfm.track.getTags(params, callback(err, tags))`
See [docs](http://www.last.fm/api/show/track.getTags) for params.
##### `lfm.track.getTopTags(params, callback(err, topTags))`
See [docs](http://www.last.fm/api/show/track.getTopTags) for params.
##### `lfm.track.love(params, callback(err))`
See [docs](http://www.last.fm/api/show/track.love) for params.
##### `lfm.track.removeTag(artist, track, tag, callback(err))`
See [docs](http://www.last.fm/api/show/track.removeTag).
##### `lfm.track.scrobble(params, callback(err, scrobbles))`
See [docs](http://www.last.fm/api/show/track.scrobble) for params.
`params` can be an array of scrobble parameters to scrobble multiple
tracks at once.
##### `lfm.track.search(params, callback(err, results))`
See [docs](http://www.last.fm/api/show/track.search) for params.
##### `lfm.track.unlove(artist, track, callback(err))`
See [docs](http://www.last.fm/api/show/track.unlove).
##### `lfm.track.updateNowPlaying(params, callback(err, nowPlaying))`
See [docs](http://www.last.fm/api/show/track.updateNowPlaying) for params.
### User
##### `lfm.user.getArtistTracks(params, callback(err, artistTracks))`
See [docs](http://www.last.fm/api/show/user.getArtistTracks) for params.
##### `lfm.user.getFriends(params, callback(err, friends))`
See [docs](http://www.last.fm/api/show/user.getFriends) for params.
##### `lfm.user.getInfo([user,] callback(err, info))`
See [docs](http://www.last.fm/api/show/user.getInfo). `user` is optional. However, authentication is required if omitted.
##### `lfm.user.getLovedTracks(params, callback(err, lovedTracks))`
See [docs](http://www.last.fm/api/show/user.getLovedTracks) for params.
##### `lfm.user.getPersonalTags(params, callback(err, taggings))`
See [docs](http://www.last.fm/api/show/user.getPersonalTags) for params.
##### `lfm.user.getRecentTracks(params, callback(err, recentTracks))`
See [docs](http://www.last.fm/api/show/user.getRecentTracks) for params.
##### `lfm.user.getTopAlbums(params, callback(err, topAlbums))`
See [docs](http://www.last.fm/api/show/user.getTopAlbums) for params.
##### `lfm.user.getTopArtists(params, callback(err, topArtists))`
See [docs](http://www.last.fm/api/show/user.getTopArtists) for params.
##### `lfm.user.getTopTags(user, [limit,] callback(err, topTags))`
See [docs](http://www.last.fm/api/show/user.getTopTags). `limit` is optional.
##### `lfm.user.getTopTracks(params, callback(err, topTracks))`
See [docs](http://www.last.fm/api/show/user.getTopTracks) for params.
##### `lfm.user.getWeeklyAlbumChart(params, callback(err, weeklyAlbumChart))`
See [docs](http://www.last.fm/api/show/user.getWeeklyAlbumChart) for params.
##### `lfm.user.getWeeklyArtistChart(params, callback(err, weeklyArtistChart))`
See [docs](http://www.last.fm/api/show/user.getWeeklyArtistChart) for params.
##### `lfm.user.getWeeklyChartList(user, callback(err, weeklyChartList))`
See [docs](http://www.last.fm/api/show/user.getWeeklyChartList).
##### `lfm.user.getWeeklyTrackChart(params, callback(err, weeklyTrackChart))`
See [docs](http://www.last.fm/api/show/user.getWeeklyTrackChart) for params.
Contributors
------------
- [Max Kueng](https://github.com/maxkueng)
- [Aliou Diallo](https://github.com/aliou)
- [Jiri Bakker](https://github.com/JiriBakker)
License
-------
Copyright (c) 2013 Max Kueng
Licensed under the MIT license.
[lastfmnode]: https://github.com/jammus/lastfm-node
[semver]: http://semver.org/
[register]: http://www.last.fm/api/account/create
[webauth]: http://www.last.fm/api/webauth

View File

@ -0,0 +1,71 @@
/**
* This example show how to authenticate with the Last.fm API.
* Authentication is only required to make signed method calls
* or use write methods.
*/
// ** BEGIN EDIT HERE **************************************************
var LASTFM_API_KEY = ''; // YOUR LASTFM API KEY HERE
var LASTFM_API_SECRET = ''; // YOUR LASTFM API SECRET HERE
var DEMO_PORT = 1337;
var DEMO_URL = 'http://127.0.0.1:' + DEMO_PORT;
// ** END EDIT HERE ****************************************************
if ( !LASTFM_API_KEY || !LASTFM_API_SECRET ) {
console.log('Please edit `LASTFM_API_KEY` and `LASTFM_API_SECRET` before running this example.');
console.log('If you don\'t have an API key, get one here: http://www.last.fm/api/account/create');
process.exit(1);
}
var http = require('http');
var url = require('url');
var LastfmAPI = require('../lib/lastfmapi');
var lfm = new LastfmAPI({
'api_key' : LASTFM_API_KEY,
'secret' : LASTFM_API_SECRET
});
http.createServer(function (req, res) {
var pathname = url.parse(req.url).pathname;
if (pathname === '/') {
var authUrl = lfm.getAuthenticationUrl({ 'cb' : DEMO_URL + '/auth' });
res.writeHead(200, { 'Content-Type' : 'text/html' });
res.end('<a href="' + authUrl + '">Authenticate</a>');
return;
}
if (pathname === '/auth') {
var token = url.parse(req.url, true).query.token;
lfm.authenticate(token, function (err, session) {
if (err) {
res.writeHead(401, { 'Content-Type' : 'text/plain' });
res.end('Unauthorized');
} else {
res.writeHead(200, { 'Content-Type' : 'text/html' });
res.write('<p>Authentication successful. You can now make authenticated method calls.</p>');
res.write('<pre>' + JSON.stringify(session, null, ' ') + '</pre>');
res.write('<p>Store this data for future authentication.</p>');
res.write('<p>Use <code>lfm.setSessionCredentials(\'' + session.username + '\', \'' + session.key + '\');</code> for automatic authentication in the future.</p>');
res.end('<pre>:)</pre>');
}
});
return;
}
res.writeHead(404, { 'Content-Type' : 'text/plain' });
res.end('Not found');
}).listen(DEMO_PORT);
console.log('Server running.');
console.log(DEMO_URL);

1
buildfiles/app/node_modules/lastfmapi/index.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('./lib/lastfmapi')

47
buildfiles/app/node_modules/lastfmapi/lib/album.js generated vendored Normal file
View File

@ -0,0 +1,47 @@
var defaults = require('./defaults');
var Album = module.exports = function (lastfm) {
this.lastfm = lastfm;
};
Album.prototype.addTags = function (artist, album, tags, callback) {
if (!Array.isArray(tags)) { tags = [ tags ]; }
var options = defaults.defaultOptions({
'artist' : artist,
'album' : album,
'tags' : tags.join(','),
'sk' : this.lastfm.sessionCredentials.key
}, callback);
this.lastfm.api.request('album.addTags', options);
};
Album.prototype.getInfo = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'album');
this.lastfm.api.request('album.getInfo', options);
};
Album.prototype.getTags = function (params, callback) {
if (!params.user) { params.user = this.lastfm.sessionCredentials.username; }
var options = defaults.defaultOptions(params, callback, 'tags');
this.lastfm.api.request('album.getTags', options);
};
Album.prototype.getTopTags = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'toptags');
this.lastfm.api.request('album.getTopTags', options);
};
Album.prototype.removeTag = function (artist, album, tag, callback) {
var options = defaults.defaultOptions({
'artist' : artist,
'album' : album,
'tag' : tag,
'sk' : this.lastfm.sessionCredentials.key
}, callback);
this.lastfm.api.request('album.removeTag', options);
};
Album.prototype.search = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'results');
this.lastfm.api.request('album.search', options);
};

65
buildfiles/app/node_modules/lastfmapi/lib/artist.js generated vendored Normal file
View File

@ -0,0 +1,65 @@
var defaults = require('./defaults');
var Artist = module.exports = function (lastfm) {
this.lastfm = lastfm;
};
Artist.prototype.addTags = function (artist, tags, callback) {
if (!Array.isArray(tags)) { tags = [ tags ]; }
var options = defaults.defaultOptions({
'artist' : artist,
'tags' : tags.join(','),
'sk' : this.lastfm.sessionCredentials.key
}, callback);
this.lastfm.api.request('artist.addTags', options);
};
Artist.prototype.getCorrection = function (artist, callback) {
var options = defaults.defaultOptions({ 'artist' : artist }, callback, 'corrections');
this.lastfm.api.request('artist.getCorrection', options);
};
Artist.prototype.getInfo = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'artist');
this.lastfm.api.request('artist.getInfo', options);
};
Artist.prototype.getSimilar = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'similarartists');
this.lastfm.api.request('artist.getSimilar', options);
};
Artist.prototype.getTags = function (params, callback) {
if (!params.user) { params.user = this.lastfm.sessionCredentials.username; }
var options = defaults.defaultOptions(params, callback, 'tags');
this.lastfm.api.request('artist.getTags', options);
};
Artist.prototype.getTopAlbums = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'topalbums');
this.lastfm.api.request('artist.getTopAlbums', options);
};
Artist.prototype.getTopTags = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'toptags');
this.lastfm.api.request('artist.getTopTags', options);
};
Artist.prototype.getTopTracks = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'toptracks');
this.lastfm.api.request('artist.getTopTracks', options);
};
Artist.prototype.removeTag = function (artist, tag, callback) {
var options = defaults.defaultOptions({
'artist' : artist,
'tag' : tag,
'sk' : this.lastfm.sessionCredentials.key
}, callback);
this.lastfm.api.request('artist.removeTag', options);
};
Artist.prototype.search = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'results');
this.lastfm.api.request('artist.search', options);
};

23
buildfiles/app/node_modules/lastfmapi/lib/auth.js generated vendored Normal file
View File

@ -0,0 +1,23 @@
var defaults = require('./defaults');
var Auth = module.exports = function (lastfm) {
this.lastfm = lastfm;
};
Auth.prototype.getMobileSession = function (username, password, callback) {
var options = defaults.defaultOptions({
'username' : username,
'password' : password
}, callback, 'session');
this.lastfm.api.request('auth.getMobileSession', options);
};
Auth.prototype.getSession = function (token, callback) {
var options = defaults.defaultOptions({ 'token' : token }, callback, 'session');
this.lastfm.api.request('auth.getSession', options);
};
Auth.prototype.getToken = function (callback) {
var options = defaults.defaultOptions({}, callback, 'token');
this.lastfm.api.request('auth.getToken', options);
};

29
buildfiles/app/node_modules/lastfmapi/lib/chart.js generated vendored Normal file
View File

@ -0,0 +1,29 @@
var defaults = require('./defaults');
var Chart = module.exports = function (lastfm) {
this.lastfm = lastfm;
};
Chart.prototype.getLovedTracks = function (params, callback) {
if (typeof callback === 'undefined') { callback = params; params = null; }
var options = defaults.defaultOptions(params, callback, 'tracks');
this.lastfm.api.request('chart.getLovedTracks', options);
};
Chart.prototype.getTopArtists = function (params, callback) {
if (typeof callback === 'undefined') { callback = params; params = null; }
var options = defaults.defaultOptions(params, callback, 'artists');
this.lastfm.api.request('chart.getTopArtists', options);
};
Chart.prototype.getTopTags = function (params, callback) {
if (typeof callback === 'undefined') { callback = params; params = null; }
var options = defaults.defaultOptions(params, callback, 'tags');
this.lastfm.api.request('chart.getTopTags', options);
};
Chart.prototype.getTopTracks = function (params, callback) {
if (typeof callback === 'undefined') { callback = params; params = null; }
var options = defaults.defaultOptions(params, callback, 'tracks');
this.lastfm.api.request('chart.getTopTracks', options);
};

24
buildfiles/app/node_modules/lastfmapi/lib/defaults.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
var defaultOptions = function (params, callback, key) {
var options = params || {};
options.handlers = {
'success' : function (rsp) {
if (key) { rsp = rsp[key]; }
if (rsp && typeof callback === 'function') {
callback(null, rsp);
} else {
callback(new Error("Not found"));
}
},
'error' : function (err) {
if (typeof callback === 'function') {
callback(err);
}
}
};
return options;
};
exports.defaultOptions = defaultOptions;

13
buildfiles/app/node_modules/lastfmapi/lib/geo.js generated vendored Normal file
View File

@ -0,0 +1,13 @@
var defaults = require('./defaults');
var Geo = module.exports = function (lastfm) { this.lastfm = lastfm; };
Geo.prototype.getTopArtists = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'topartists');
this.lastfm.api.request('geo.getTopArtists', options);
};
Geo.prototype.getTopTracks = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'tracks');
this.lastfm.api.request('geo.getTopTracks', options);
};

62
buildfiles/app/node_modules/lastfmapi/lib/lastfmapi.js generated vendored Normal file
View File

@ -0,0 +1,62 @@
var url = require('url');
var defaults = require('./defaults');
var lastfm = require('lastfm');
var LastFmNode = require('lastfm').LastFmNode;
var Album = require('./album');
var Artist = require('./artist');
var Auth = require('./auth');
var Chart = require('./chart');
var Geo = require('./geo');
var Library = require('./library');
var Tag = require('./tag');
var Track = require('./track');
var User = require('./user');
var LastfmAPI = module.exports = function (options) {
this.api = new LastFmNode(options);
this.sessionCredentials = null;
this.album = new Album(this);
this.artist = new Artist(this);
this.auth = new Auth(this);
this.chart = new Chart(this);
this.geo = new Geo(this);
this.library = new Library(this);
this.tag = new Tag(this);
this.track = new Track(this);
this.user = new User(this);
};
LastfmAPI.prototype.getAuthenticationUrl = function (params) {
if (!params) params = {};
var baseUrl = 'http://www.last.fm/api/auth',
urlParts = url.parse(baseUrl);
urlParts.query = {};;
urlParts.query.api_key = this.api.api_key;
if (params.cb) { urlParts.query.cb = params.cb; }
if (params.token) { urlParts.query.token = params.token; }
return url.format(urlParts);
};
LastfmAPI.prototype.setSessionCredentials = function (username, key) {
this.sessionCredentials = {
'username' : username,
'key' : key
};
};
LastfmAPI.prototype.authenticate = function (token, callback) {
if (typeof callback !== 'function') { callback = function () {}; }
var self = this;
this.auth.getSession(token, function (err, session) {
if (err) { return callback(err); }
if (!session.key) { return callback(new Error('Something fishy')); }
self.setSessionCredentials(session.name, session.key);
callback(null, self.sessionCredentials);
});
};

10
buildfiles/app/node_modules/lastfmapi/lib/library.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
var defaults = require('./defaults');
var Library = module.exports = function (lastfm) {
this.lastfm = lastfm;
};
Library.prototype.getArtists = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'artists');
this.lastfm.api.request('library.getArtists', options);
};

44
buildfiles/app/node_modules/lastfmapi/lib/tag.js generated vendored Normal file
View File

@ -0,0 +1,44 @@
var defaults = require('./defaults');
var Tag = module.exports = function (lastfm) {
this.lastfm = lastfm;
};
Tag.prototype.getInfo = function (tag, lang, callback) {
if (typeof callback !== 'function') { callback = lang; lang = null; }
var options = defaults.defaultOptions({
'tag' : tag,
'lang' : lang
}, callback, 'tag');
this.lastfm.api.request('tag.getInfo', options);
};
Tag.prototype.getSimilar = function (tag, callback) {
var options = defaults.defaultOptions({ 'tag' : tag }, callback, 'similartags');
this.lastfm.api.request('tag.getSimilar', options);
};
Tag.prototype.getTopAlbums = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'topalbums');
this.lastfm.api.request('tag.getTopAlbums', options);
};
Tag.prototype.getTopArtists = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'topartists');
this.lastfm.api.request('tag.getTopArtists', options);
};
Tag.prototype.getTopTags = function (callback) {
var options = defaults.defaultOptions(null, callback, 'toptags');
this.lastfm.api.request('tag.getTopTags', options);
};
Tag.prototype.getTopTracks = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'toptracks');
this.lastfm.api.request('tag.getTopTracks', options);
};
Tag.prototype.getWeeklyChartList = function (tag, callback) {
var options = defaults.defaultOptions({ 'tag' : tag }, callback, 'weeklychartlist');
this.lastfm.api.request('tag.getWeeklyChartList', options);
};

95
buildfiles/app/node_modules/lastfmapi/lib/track.js generated vendored Normal file
View File

@ -0,0 +1,95 @@
var defaults = require('./defaults');
var Track = module.exports = function (lastfm) {
this.lastfm = lastfm;
};
Track.prototype.addTags = function (artist, track, tags, callback) {
if (!Array.isArray(tags)) { tags = [ tags ]; }
var options = defaults.defaultOptions({
'artist' : artist,
'track' : track,
'tags' : tags.join(','),
'sk' : this.lastfm.sessionCredentials.key
}, callback);
this.lastfm.api.request('track.addTags', options);
};
Track.prototype.getCorrection = function (artist, track, callback) {
var options = defaults.defaultOptions({
'artist' : artist,
'track' : track
}, callback, 'corrections');
this.lastfm.api.request('track.getCorrection', options);
};
Track.prototype.getInfo = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'track');
this.lastfm.api.request('track.getInfo', options);
};
Track.prototype.getSimilar = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'similartracks');
this.lastfm.api.request('track.getSimilar', options);
};
Track.prototype.getTags = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'tags');
this.lastfm.api.request('track.getTags', options);
};
Track.prototype.getTopTags = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'toptags');
this.lastfm.api.request('track.getTopTags', options);
};
Track.prototype.love = function (params, callback) {
var options = defaults.defaultOptions(params, callback);
options.sk = this.lastfm.sessionCredentials.key;
this.lastfm.api.request('track.love', options);
};
Track.prototype.removeTag = function (artist, track, tag, callback) {
var options = defaults.defaultOptions({
'artist' : artist,
'track' : track,
'tag' : tag,
'sk' : this.lastfm.sessionCredentials.key
}, callback);
this.lastfm.api.request('track.removeTag', options);
};
Track.prototype.scrobble = function (params, callback) {
var i, len, key, newParams = {};
if (Array.isArray(params)) {
for (i = 0, len = params.length; i < len; i++) {
for (key in params[i]) {
newParams[key + '[' + i + ']'] = params[i][key];
}
}
params = newParams;
}
var options = defaults.defaultOptions(params, callback, 'scrobbles');
options.sk = this.lastfm.sessionCredentials.key;
this.lastfm.api.request('track.scrobble', options);
};
Track.prototype.search = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'results');
this.lastfm.api.request('track.search', options);
};
Track.prototype.unlove = function (artist, track, callback) {
var options = defaults.defaultOptions({
'artist' : artist,
'track' : track,
'sk' : this.lastfm.sessionCredentials.key
}, callback);
this.lastfm.api.request('track.unlove', options);
};
Track.prototype.updateNowPlaying = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'nowplaying');
options.sk = this.lastfm.sessionCredentials.key;
this.lastfm.api.request('track.updateNowPlaying', options);
};

82
buildfiles/app/node_modules/lastfmapi/lib/user.js generated vendored Normal file
View File

@ -0,0 +1,82 @@
var defaults = require('./defaults');
var User = module.exports = function (lastfm) {
this.lastfm = lastfm;
};
User.prototype.getArtistTracks = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'artisttracks');
this.lastfm.api.request('user.getArtistTracks', options);
};
User.prototype.getFriends = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'friends');
this.lastfm.api.request('user.getFriends', options);
};
User.prototype.getInfo = function (user, callback) {
if (typeof callback !== 'function') { callback = user; user = null; }
var params = (user) ? { 'user' : user } : null;
var options = defaults.defaultOptions(params, callback, 'user');
if (!params) { options.sk = this.lastfm.sessionCredentials.key; }
this.lastfm.api.request('user.getInfo', options);
};
User.prototype.getLovedTracks = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'lovedtracks');
this.lastfm.api.request('user.getLovedTracks', options);
};
User.prototype.getPersonalTags = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'taggings');
this.lastfm.api.request('user.getPersonalTags', options);
};
User.prototype.getRecentTracks = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'recenttracks');
this.lastfm.api.request('user.getRecentTracks', options);
};
User.prototype.getTopAlbums = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'topalbums');
this.lastfm.api.request('user.getTopAlbums', options);
};
User.prototype.getTopArtists = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'topartists');
this.lastfm.api.request('user.getTopArtists', options);
};
User.prototype.getTopTags = function (user, limit, callback) {
if (typeof callback !== 'function') { callback = limit; limit = null; }
var options = defaults.defaultOptions({
'user' : user,
'limit' : limit
}, callback, 'toptags');
this.lastfm.api.request('user.getTopTags', options);
};
User.prototype.getTopTracks = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'toptracks');
this.lastfm.api.request('user.getTopTracks', options);
};
User.prototype.getWeeklyAlbumChart = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'weeklyalbumchart');
this.lastfm.api.request('user.getWeeklyAlbumChart', options);
};
User.prototype.getWeeklyArtistChart = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'weeklyartistchart');
this.lastfm.api.request('user.getWeeklyArtistChart', options);
};
User.prototype.getWeeklyChartList = function (user, callback) {
var options = defaults.defaultOptions({ 'user' : user }, callback, 'weeklychartlist');
this.lastfm.api.request('user.getWeeklyChartList', options);
};
User.prototype.getWeeklyTrackChart = function (params, callback) {
var options = defaults.defaultOptions(params, callback, 'weeklytrackchart');
this.lastfm.api.request('user.getWeeklyTrackChart', options);
};

76
buildfiles/app/node_modules/lastfmapi/package.json generated vendored Normal file
View File

@ -0,0 +1,76 @@
{
"_args": [
[
"lastfmapi@0.1.1",
"/home/shihaam/www/freezer.shihaam.me/app"
]
],
"_from": "lastfmapi@0.1.1",
"_id": "lastfmapi@0.1.1",
"_inBundle": false,
"_integrity": "sha1-zjNtz3zIGCDCLcQCR8l7MRM0hvo=",
"_location": "/lastfmapi",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "lastfmapi@0.1.1",
"name": "lastfmapi",
"escapedName": "lastfmapi",
"rawSpec": "0.1.1",
"saveSpec": null,
"fetchSpec": "0.1.1"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/lastfmapi/-/lastfmapi-0.1.1.tgz",
"_spec": "0.1.1",
"_where": "/home/shihaam/www/freezer.shihaam.me/app",
"author": {
"name": "Max Kueng",
"email": "me@maxkueng.com",
"url": "http://maxkueng.com/"
},
"bugs": {
"url": "https://github.com/maxkueng/node-lastfmapi/issues"
},
"contributors": [
{
"name": "Aliou Diallo",
"url": "https://github.com/aliou"
},
{
"name": "Jiri Bakker",
"url": "https://github.com/JiriBakker"
}
],
"dependencies": {
"lastfm": "0.8.x"
},
"description": "A Last.fm API client library wrapper with a simple and clean interface.",
"engines": {
"node": ">=0.6.0"
},
"homepage": "https://github.com/maxkueng/node-lastfmapi",
"keywords": [
"lastfm",
"audioscrobbler",
"scrobbling",
"scrobble",
"api"
],
"licenses": [
{
"type": "MIT",
"url": "https://github.com/maxkueng/node-lastfmapi/blob/master/LICENSE"
}
],
"main": "index",
"name": "lastfmapi",
"repository": {
"type": "git",
"url": "git://github.com/maxkueng/node-lastfmapi.git"
},
"version": "0.1.1"
}