-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathmain.js
46 lines (31 loc) · 1.4 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
#!/usr/bin/env node
// Generated by CoffeeScript 1.7.1
(function() {
var Colors, DIRECTORY, DL, Downloader, 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.1').option('-u, --username [username]', 'Spotify Username (required)', null).option('-p, --password [password]', 'Spotify Password (required)', null).option('-l, --playlist [playlist]', 'Spotify URI for playlist', null).option('-d, --directory [directory]', "Directory you want to save the mp3s to, default: " + (getUserHome()) + "/spotify-mp3s", "" + (getUserHome()) + "/spotify-mp3s").parse(process.argv);
USERNAME = Program.username;
PASSWORD = Program.password;
PLAYLIST = Program.playlist;
DIRECTORY = Program.directory;
if ((PASSWORD == null) || (USERNAME == null)) {
console.log('!!! MUST SPECIFY USERNAME & PASSWORD !!!'.red);
return Program.outputHelp();
}
if (PLAYLIST == null) {
console.log('!!! MUST SPECIFY A SPOTIFY PLAYLIST !!!'.red);
return Program.outputHelp();
}
DL = new Downloader(USERNAME, PASSWORD, PLAYLIST, DIRECTORY);
}).call(this);