Skip to content

Commit

Permalink
Notify user if there's an update
Browse files Browse the repository at this point in the history
  • Loading branch information
vishaltelangre committed Jun 20, 2017
1 parent c903e9c commit 4bf9134
Show file tree
Hide file tree
Showing 3 changed files with 325 additions and 9 deletions.
15 changes: 11 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
const _ = require('lodash');
const cli = require('cli');
const colors = require('colors');
const updateNotifier = require('update-notifier');

const {name, version} = require('./package.json');
const { name, version } = require('./package.json');

const { Settings, SettingsManifestPath} = require('./lib/settings');
const { Settings, SettingsManifestPath } = require('./lib/settings');
const Saavn = require('./lib/providers/saavn');
const Gaana = require('./lib/providers/gaana');

const supportedProviders = [ Saavn, Gaana ];

updateNotifier({
pkg: { name, version },
updateCheckInterval: 1000 * 60 * 60 * 24 * 1 // Every day
}).notify();

cli.enable('version');
cli.setApp(name, version);

Expand All @@ -26,7 +32,8 @@ if (!!options.api_key) {
}

if (!Settings.getYouTubeApiKey()) {
cli.fatal("Please set the YouTube API key. Check --help for usage.");
cli.error("Please set the YouTube API key. Check --help for usage.");
return;
}

if (!cli.args[0]) {
Expand All @@ -47,5 +54,5 @@ const matchedProvider = _.find(supportedProviders, providerKlass => {
if (matchedProvider) {
(new matchedProvider(tracklistUrl)).downloadTracks();
} else {
cli.fatal(`Couldn't identify the provided playlist/album URL: "${tracklistUrl}"`);
cli.error(`Couldn't identify the provided playlist/album URL: "${tracklistUrl}"`);
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"node-id3": "^0.0.9",
"osmosis": "^1.1.4",
"promise": "^7.3.0",
"update-notifier": "^2.2.0",
"youtube-search": "^1.0.10",
"ytdl-core": "^0.14.4"
}
Expand Down
Loading

0 comments on commit 4bf9134

Please sign in to comment.