-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp.js
33 lines (28 loc) · 788 Bytes
/
app.js
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
"use strict";
require("dotenv").load();
var spotify = require("node-spotify")({
appkeyFile: "./spotify_appkey.key",
cacheFolder: "cache",
settingsFolder: "settings"
});
var queue = require("./lib/queue")(spotify);
var playlist = require("./lib/playlist")(spotify);
var player = require("./lib/player")(spotify, queue, playlist);
process.on("SIGINT", function () {
player.stop();
console.log("Logging out");
spotify.logout();
});
var ready = function() {
console.log("Logged in");
player.start();
};
spotify.on({
ready: ready,
logout: function(){
console.log("Logged out");
process.exit(0);
}
});
console.log("Logging in as:", process.env.SPOTIFY_USERNAME);
spotify.login(process.env.SPOTIFY_USERNAME, process.env.SPOTIFY_PASSWORD, false, false);