File: lastfm-repl.js

package info (click to toggle)
node-lastfm 0.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 248 kB
  • ctags: 212
  • sloc: sh: 17; makefile: 4
file content (41 lines) | stat: -rw-r--r-- 949 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var LastFmNode = require('./lib/lastfm').LastFmNode,
    repl = require('repl'),
    config = require('./config'),
    _ = require('underscore');

var echoHandler = function() {
    _(arguments).each(function(arg) {
        console.log(arg);
    });
};

var errorHandler = function(error) {
    console.log('Error: ' + error.message);
};

var quietHandler = function() { };

var _echoHandlers = {
    error: errorHandler,
    success: echoHandler,
    lastPlayed: echoHandler,
    nowPlaying: echoHandler,
    scrobbled: echoHandler,
    stoppedPlaying: echoHandler
};

var _quietHandlers = {
    error: errorHandler,
    success: quietHandler,
    lastPlayed: quietHandler,
    nowPlaying: quietHandler,
    scrobbled: quietHandler,
    stoppedPlaying: quietHandler
}

var lastfm = new LastFmNode(config);

var context = repl.start().context;
context.lastfm = lastfm;
context._echoHandlers = _echoHandlers;
context._quietHandlers = _quietHandlers;