Comparing version 0.0.5 to 0.0.6
var pkg = require('../package.json'), | ||
sh = require('shelljs'), | ||
request = require('request'), | ||
rdioNames = ['Rdio', 'Oi Rdio'], | ||
rdioName, | ||
appNames = ['Rdio', 'Oi Rdio', 'Spotify', 'iTunes'], | ||
appName, | ||
track; | ||
@@ -10,7 +10,7 @@ | ||
rdioNames.every(function(name) { | ||
appNames.every(function(name) { | ||
track = sh.exec('osascript -e \'tell app "' + name + '" to get the name of the current track\'', {silent: true}); | ||
if (track.code === 0) { | ||
rdioName = name; | ||
return false | ||
appName = name; | ||
return false; | ||
} | ||
@@ -20,9 +20,14 @@ return true; | ||
if (rdioName === undefined) { | ||
console.log('Unable to find Rdio or Oi Rdio'); | ||
if (appName === undefined) { | ||
console.log('Unable to find Rdio, Oi Rdio, Spotify or iTunes'); | ||
process.exit(1); | ||
} | ||
console.log(''); | ||
console.log('(' + appName + ' encontrado)'); | ||
console.log(''); | ||
console.log('---'); | ||
track = track.output; | ||
var artist = sh.exec('osascript -e \'tell app "' + rdioName + '" to get the artist of the current track\'', {silent: true}).output; | ||
var artist = sh.exec('osascript -e \'tell app "' + appName + '" to get the artist of the current track\'', {silent: true}).output; | ||
@@ -39,10 +44,10 @@ track = track.replace('\n', ''); | ||
if(data.mus && data.mus.length > 0) { | ||
console.log(data.mus[0].text) | ||
console.log(data.mus[0].text); | ||
if(data.mus[0].translate && data.mus[0].translate.length > 0) { | ||
console.log('') | ||
console.log('---') | ||
console.log('') | ||
console.log(data.mus[0].translate[0].text) | ||
console.log(''); | ||
console.log('---'); | ||
console.log(''); | ||
console.log(data.mus[0].translate[0].text); | ||
} | ||
} | ||
}); |
{ | ||
"name": "rdiojs", | ||
"version": "0.0.5", | ||
"description": "Rdio NodeJS Cli", | ||
"version": "0.0.6", | ||
"description": "Rdio/Spotify/iTunes NodeJS Cli", | ||
"main": "app.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -1,2 +0,2 @@ | ||
#rdiojs -- Rdio NodeJS Cli | ||
#rdiojs -- Rdio/Spotify/iTunes NodeJS Cli | ||
@@ -3,0 +3,0 @@ [![NPM](https://nodei.co/npm/rdiojs.png?downloads=true&stars=true)](https://nodei.co/npm/rdiojs/) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3378
42