forked from serjum/spotify-playlist-downloader
-
Notifications
You must be signed in to change notification settings - Fork 52
/
main.js
57 lines (38 loc) · 1.67 KB
/
main.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Generated by CoffeeScript 1.10.0
(function() {
var Colors, DIRECTORY, DL, Downloader, FOLDER, GENERATE, PASSWORD, PLAYLIST, Program, USERNAME, getUserHome;
require('coffee-script');
Colors = require('colors');
Program = require('commander');
Downloader = require('./lib/downloader');
getUserHome = (function(_this) {
return function() {
if (process.platform === 'win32') {
return process.env['USERPROFILE'];
}
return process.env['HOME'];
};
})(this);
Program.version('0.0.2').option('-u, --username [username]', 'Spotify Playlist Username (required)', null).option('-p, --playlist [playlist]', 'Spotify Playlist (required)', null).option('-d, --directory [directory]', "Directory you want to save the mp3s to, default: " + (getUserHome()) + "/Music", (getUserHome()) + "/Music").option('-f, --folder', "create folder for playlist", null).option('-g, --generate', "generate file for playlist", null).parse(process.argv);
USERNAME = "USERNAME"; //Program.username;
PASSWORD = "PASSWORD"; //Program.password;
PLAYLIST_USER = Program.username;
PLAYLIST_LIST = Program.playlist;
//PLAYLIST = Program.playlist;
DIRECTORY = Program.directory;
FOLDER = Program.folder;
GENERATE = Program.generate;
if ((PLAYLIST_USER == null) || (PLAYLIST_LIST == null)) {
console.log('!!! MUST SPECIFY USERNAME & PLAYLIST !!!'.red);
return Program.outputHelp();
}
DL = new Downloader(USERNAME, PASSWORD, "spotify:user:" + PLAYLIST_USER + ":playlist:" + PLAYLIST_LIST, DIRECTORY);
if (FOLDER) {
DL.makeFolder = true;
}
if (GENERATE) {
DL.generatePlaylist = 1;
}
DL.run();
}).call(this);
//# sourceMappingURL=main.js.map