voc-cli
Advanced tools
Comparing version 1.8.4 to 1.8.5-alpha
@@ -8,3 +8,3 @@ 'use strict'; | ||
var urlformat = require('url').format; | ||
var HOST = 'http://www.collinsdictionary.com'; | ||
var HOST = 'https://www.collinsdictionary.com'; | ||
@@ -11,0 +11,0 @@ // 1. search word |
@@ -17,3 +17,3 @@ 'use strict'; | ||
url = 'http://www.merriam-webster.com/dictionary/' + word; | ||
url = 'https://www.merriam-webster.com/dictionary/' + word; | ||
_context.next = 4; | ||
@@ -50,3 +50,3 @@ return fetch(url, { timeout: 10 * 1000 }); | ||
var file = ele.attr('data-file'); | ||
var audio = 'http://media.merriam-webster.com/audio/prons/' + lang + '/mp3/' + dir + '/' + file + '.mp3'; | ||
var audio = 'https://media.merriam-webster.com/audio/prons/' + lang + '/mp3/' + dir + '/' + file + '.mp3'; | ||
if (word === term) { | ||
@@ -53,0 +53,0 @@ set[audio] = true; |
@@ -18,3 +18,3 @@ 'use strict'; | ||
url = 'http://tw.dictionary.search.yahoo.com/search' + urlformat({ | ||
url = 'https://tw.dictionary.search.yahoo.com/search' + urlformat({ | ||
query: { | ||
@@ -21,0 +21,0 @@ fr2: 'dict', |
@@ -13,4 +13,2 @@ 'use strict'; | ||
var config = require('../config.json'); | ||
function exec(command) { | ||
@@ -29,9 +27,7 @@ return new Promise(function (resolve, reject) { | ||
function list() { | ||
for (var key in config) { | ||
console.log(key + ': "' + config[key] + '"'); | ||
} | ||
console.log(JSON.stringify(pkg.config, null, 2)); | ||
} | ||
function save() { | ||
fs.writeFileSync(path.resolve(__dirname, '../config.json'), JSON.stringify(config, null, 2) + '\n'); | ||
fs.writeFileSync(path.resolve(__dirname, '../package.json'), JSON.stringify(pkg, null, 2) + '\n'); | ||
list(); | ||
@@ -44,5 +40,5 @@ } | ||
case 'win32': | ||
config = { | ||
pkg.config = { | ||
directory: path.resolve(process.env.USERPROFILE, 'vocabulary'), | ||
audio_cli: 'dlc -p' | ||
audio_cli: path.resolve(__dirname, '../dlcplayer/dlc') + ' -p' | ||
}; | ||
@@ -53,3 +49,3 @@ break; | ||
case 'darwin': | ||
config = { | ||
pkg.config = { | ||
directory: path.resolve(process.env.HOME, 'vocabulary'), | ||
@@ -62,3 +58,3 @@ audio_cli: 'afplay' | ||
default: | ||
config = { | ||
pkg.config = { | ||
directory: path.resolve(process.env.HOME, 'vocabulary'), | ||
@@ -73,3 +69,3 @@ audio_cli: 'mpg123 -q' | ||
function setAudioCli(cli) { | ||
config.audio_cli = cli; | ||
pkg.config.audio_cli = cli; | ||
save(); | ||
@@ -79,3 +75,3 @@ } | ||
function setAudioDirectory(path) { | ||
config.directory = path; | ||
pkg.config.directory = path; | ||
save(); | ||
@@ -91,3 +87,3 @@ } | ||
// 1. init config | ||
if (config.directory === '') { | ||
if (pkg.config.directory === '') { | ||
reset(); | ||
@@ -107,3 +103,3 @@ } | ||
fs.mkdirSync(config.directory); | ||
fs.mkdirSync(pkg.config.directory); | ||
_context.next = 11; | ||
@@ -158,3 +154,3 @@ break; | ||
_context.next = 27; | ||
return getAudio(word, config.directory, service); | ||
return getAudio(word, pkg.config.directory, service); | ||
@@ -175,3 +171,3 @@ case 27: | ||
_context.next = 34; | ||
return exec(config.audio_cli + ' "' + audio + '"'); | ||
return exec(pkg.config.audio_cli + ' "' + audio + '"'); | ||
@@ -178,0 +174,0 @@ case 34: |
@@ -0,1 +1,6 @@ | ||
## 1.8.5 (Not yet to release) | ||
- using HTTPS for online dictionary webster, yahoo, and collins. | ||
- build in `dlc` command line for windows platform, so that users don't have to install command line by themselves. | ||
## 1.8.4 (Dec 8, 2016) | ||
@@ -2,0 +7,0 @@ |
{ | ||
"name": "voc-cli", | ||
"version": "1.8.4", | ||
"version": "1.8.5-alpha", | ||
"description": "download and play English vocabularies' audio via command line", | ||
@@ -10,2 +10,6 @@ "main": "bin/getAudio.js", | ||
}, | ||
"config": { | ||
"directory": "", | ||
"audio_cli": "" | ||
}, | ||
"scripts": { | ||
@@ -12,0 +16,0 @@ "prepublish": "npm run compile", |
@@ -84,2 +84,4 @@ # voc | ||
- `afplay` is build-in command line on macOS; you don't have to do anything for it. | ||
* __UNIX :__ `mpg123` | ||
@@ -97,3 +99,4 @@ | ||
- original download link has died, but you still can download from [here](https://github.com/zlargon/voc/raw/master/dlcplayer.zip). | ||
- `dlc` is build-in now, so you don't have to install command line by self. | ||
- You still can download dlcplayer from [here](https://github.com/zlargon/voc/raw/master/dlcplayer.zip) if you want. | ||
@@ -100,0 +103,0 @@ ## Configuration |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1781139
22
130
920
1