diff --git a/info.plist b/info.plist index ce9d3a4..059790b 100644 --- a/info.plist +++ b/info.plist @@ -5638,7 +5638,7 @@ Search for entries with the given headword language version - 1.4.0 + 1.4.1 webaddress https://github.com/bikeNik/alfred-ldoce#readme diff --git a/src/api/body/index.js b/src/api/body/index.js index 9b4710b..2a25355 100644 --- a/src/api/body/index.js +++ b/src/api/body/index.js @@ -13,15 +13,14 @@ const {notFound} = require('../../utils/engine').warning const regularRender = require('./regular-senses') const {wordOfURL} = process.env -// Const wordOfURL = '/v2/dictionaries/entries/cqAFmvgmaf' const fileBody = './src/input/body.json' try { fs.unlinkSync(fileBody) - process.stdout.write('successfully deleted: fileBody') + // Process.stderr.write('successfully deleted: fileBody') } catch (error) { if (error.code !== 'ENOENT') { - process.stderr.write(error) + // Process.stderr.write(error) } } @@ -199,7 +198,6 @@ alfy.fetch(url).then(data => { items.push(item.getProperties()) } - // Const itemsResult = items.filter(item => item.title) const itemsResult = items.filter(item => item && item.title) alfy.input = alfy.input.replace(/.*?\u2023[\s]/gm, '') const variantsToSingleChoose = alfy.inputMatches(itemsResult, 'title').map(x => ({ diff --git a/src/api/body/internal-function.js b/src/api/body/internal-function.js deleted file mode 100644 index 162699c..0000000 --- a/src/api/body/internal-function.js +++ /dev/null @@ -1,9 +0,0 @@ -const typeOfAddition = sense => { - for (const key in sense) { - if (Object.prototype.hasOwnProperty.call(sense, key)) { - return key - } - } -} - -module.exports = {typeOfAddition} diff --git a/src/api/body/regular-senses.js b/src/api/body/regular-senses.js index 765fffa..55b195f 100644 --- a/src/api/body/regular-senses.js +++ b/src/api/body/regular-senses.js @@ -2,8 +2,6 @@ const Render = require('../../utils/engine') const {notFound} = require('../../utils/engine').warning -const {typeOfAddition} = require('./internal-function') - const objectOfSense = (sense, $) => { return { checkForEmpty: sense.examples || sense.definition, @@ -62,8 +60,7 @@ const grammaticalCom = obj => { const grammaticalSynAndOpp = (obj, $) => { const {sense, gramaticalExample, examples, quicklookurl} = obj let {item} = obj - const title = `${gramaticalExample.pattern || sense.signpost || $.headword || sense.definition[0]}\t 🔦 ${typeOfAddition(sense)}: ${sense.synonym || sense.opposite}` - + const title = `${gramaticalExample.pattern || sense.signpost || $.headword || sense.definition[0]}\t 🔦 ${sense.synonym ? 'SYN' : 'OPP'}: ${sense.synonym || sense.opposite}` item = new Render('Words with Synonyms & opposites', 'title', 'subtitle', 'sentence', 'icon', 'arg', 'mods') item.title = title @@ -90,7 +87,7 @@ const grammaticalSynAndOpp = (obj, $) => { const seeAlso = obj => { const {sense, examples, quicklookurl, $} = obj - const title = `${sense.signpost || $.headword || sense.definition[0]}\t 🔦 ${typeOfAddition(sense)}: ${sense.synonym || sense.opposite}` + const title = `${sense.signpost || $.headword || sense.definition[0]}\t 🔦 ${sense.synonym ? 'SYN' : 'OPP'}: ${sense.synonym || sense.opposite}` const item = new Render('words with synonyms & opposites case 2', 'title', 'subtitle', 'sentence', 'icon', 'arg', 'mods') item.title = title diff --git a/src/api/mydata.js b/src/api/mydata.js index 62e6711..f69df1b 100644 --- a/src/api/mydata.js +++ b/src/api/mydata.js @@ -5,7 +5,6 @@ const md5 = require('md5') const streamToPromise = require('stream-to-promise') const config = require('../config') -// eslint-disable-next-line import/no-unresolved const mainDataExp = require('../input/body.json') const header = require('../input/header.json') diff --git a/src/input/header.json b/src/input/header.json index 0ab0568..e7e17c1 100644 --- a/src/input/header.json +++ b/src/input/header.json @@ -1,3 +1,12 @@ [ - {} -] \ No newline at end of file + { + "Headword": "example", + "Brit_audio": "/v2/dictionaries/assets/ldoce/gb_pron/example0205.mp3", + "Amer_audio": "/v2/dictionaries/assets/ldoce/us_pron/example.mp3", + "Part_of_speech": "noun", + "Type_of_gramm": "countable", + "Inflections": { + "plural": "examples" + } + } +]