Skip to content

Commit

Permalink
Merge pull request #148 from cis3296f23/WordChanges
Browse files Browse the repository at this point in the history
Word changes
  • Loading branch information
mustafamalik-tu authored Dec 11, 2023
2 parents c53f86b + 604906e commit dc07764
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
46 changes: 33 additions & 13 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,39 @@ async function retrieveAudioFileForWord(event, word) {
// const url = `https://dictionaryapi.com/api/v3/references/collegiate/json/${word}?key=fa42b88d-7476-4683-8554-836973c63ab2`;
const filename = path.join(userpath, `${word}.mp3`);

if(fs.existsSync(filename)) {
console.log("Audio file has already been downloaded.");
event.reply("dictionary-data-response", filename);
return;
}

try {
const audioStream = await axios.get(url, { responseType: 'stream' });
await download(audioStream, filename);
// await audioStream.data.pipe(fs.createWriteStream(filename));
event.reply("dictionary-data-response", filename);
} catch(err) {
console.error(err);
event.reply("dictionary-error-response", JSON.stringify(err));
await axios.get(url);

if(fs.existsSync(filename)) {
console.log("Audio file has already been downloaded.");
event.reply("dictionary-data-response", filename);
return;
}



try {

const audioStream = await axios.get(url, { responseType: 'stream' });

download(audioStream, filename)
.then((_) => {

// await audioStream.data.pipe(fs.createWriteStream(filename));
event.reply("dictionary-data-response", filename);
})
.catch((err) => {
console.err("dL ERR");
})

} catch(err) {
console.error(err);
console.log("AUD ERR", err)
event.reply("dictionary-error-response", JSON.stringify(err));
}

} catch(e) {
event.reply("dictionary-error-response", "404, word not found");
}
}

Expand All @@ -100,6 +119,7 @@ async function retrieveDefinitionFileForWord(event, word) {
event.reply("definition-data-response", JSON.stringify(def.data));
} catch(err) {
console.error(err);
console.log("DEF ERR", err);
event.reply("defintion-error-response", JSON.stringify(err));
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/public/word-sets/medical.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
anatomy,physiology,pathology,diagnosis,treatment,symptoms,prognosis,syndrome,medication,prescription,immunization,vaccine,allergen,antigen,antibody,infection,inflammation,microorganism,bacteria,virus,fungi,parasite,immune,chronic,acute,surgery,anesthesia,biopsy,radiology,radiography,ultrasound,pulse,respiration,hematology,hemoglobin,platelet,hematocrit,diabetes,hypertension,hyperlipidemia,arthritis,osteoporosis,neurology,cardiology,gastroenterology,nephrology,dermatology,psychiatry,pediatric,obstetric,gynecology,endocrinology,oncology,rheumatology,urology,pulmonology,rehabilitation,anesthesiology,gastrointestinal,respiratory,cardiovascular,musculoskeletal,glands,congenital,hereditary,autoimmune,metabolism,digestion,absorption,excretion,rehabilitation,prosthesis,
anatomy,physiology,pathology,diagnosis,treatment,symptoms,prognosis,syndrome,medication,prescription,immunization,vaccine,allergen,antigen,antibody,infection,inflammation,microorganism,bacteria,virus,fungi,parasite,immune,chronic,acute,surgery,anesthesia,biopsy,radiology,radiography,ultrasound,pulse,respiration,hematology,hemoglobin,platelet,hematocrit,diabetes,hypertension,hyperlipidemia,arthritis,osteoporosis,ne,cardiology,gastroenterology,nephrology,dermatology,psychiatry,pediatric,obstetric,gynecology,endocrinology,oncology,rheumatology,pulmonology,rehabilitation,anesthesiology,gastrointestinal,respiratory,cardiovascular,musculoskeletal,glands,congenital,hereditary,autoimmune,metabolism,digestion,absorption,excretion,rehabilitation,prosthesis
2 changes: 1 addition & 1 deletion client/public/word-sets/words.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
wide,part,mink,tummy,good,nook,jelly,slow,tuft,cold,lane,son,same,much,deer,silk,cove,thing,try,duckling,mask,hike,car,rage,gift,very,last,well,mess,left,rush,gone,drill,meet,lid,lisp,post,bent,mouse,rope,log,hat,swim,read,upon,idea,sing,kite,foot,must,turn,want,canopy,scrawny,classified,telescope,fidget,mulberry,surround,associate,furthermore,weird,dependable,summit,conker,mutual,dormitory,tuxedo,decimal,alibi,orientation,inlaid,cobblestone,devious,sardine,contraption,technique,flaxen,gauze,exception,cavity,Neptune,notification,ogre,simplicity,lavish,archduke,dingo,passersby,nada,Juneteenth,parsnip,curtain,adorn,lonely,caverns,novice,invasion,dedicate,symbol,reduce,destination,ostrich,grudging,imaret,cornichon,Mediterranean,longevous,digerati,solecism,hypertrophy,inchoate,judoka,Adelaide,unwonted,tazza,damson,pelisse,tumulus,dorsiflexor,profiterole,valetudinary,vireo,rococo,wakame,bathos,nihilism,morel,abeyance,rongeur,mountebank,cinerarium,polemic,paladin,totipotent,agnomen,Bauhaus,sacerdotal,lipophilic,codicil,coulomb,violaceous,Rorschach,arthralgia,jacaranda,predilection,entomophagy,paronomasia,facsimile,renminbi,interferon,sedulous,veloute,Aesopian,frigate,satiety,perorate,danseur,chevalier,taurine
wide,part,mink,tummy,good,nook,jelly,slow,tuft,cold,lane,son,same,much,deer,silk,cove,thing,try,duckling,mask,hike,car,rage,gift,very,last,well,mess,left,rush,gone,drill,meet,lid,lisp,post,bent,mouse,rope,log,hat,swim,read,upon,idea,sing,kite,foot,must,turn,want,canopy,scrawny,classified,telescope,fidget,mulberry,surround,associate,furthermore,weird,dependable,summit,conker,mutual,dormitory,tuxedo,decimal,alibi,orientation,inlaid,cobblestone,devious,sardine,contraption,technique,flaxen,gauze,exception,cavity,notification,ogre,simplicity,lavish,archduke,dingo,passersby,nada,parsnip,curtain,adorn,lonely,caverns,novice,invasion,dedicate,symbol,reduce,destination,ostrich,grudging,imaret,cornichon,longevous,digerati,solecism,hypertrophy,inchoate,judoka,tazza,damson,pelisse,tumulus,profiterole,valetudinary,vireo,rococo,wakame,bathos,nihilism,morel,abeyance,mountebank,cinerarium,polemic,paladin,totipotent,agnomen,Bauhaus,sacerdotal,lipophilic,codicil,coulomb,violaceous,arthralgia,jacaranda,predilection,entomophagy,paronomasia,facsimile,renminbi,interferon,sedulous,veloute,frigate,satiety,perorate,danseur,chevalier,taurine
4 changes: 2 additions & 2 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class FeatureServer {
res.sendFile(filename);
})
.catch((err) => {
res.send(err);
res.status(404).send(err);
})
})
app.get('/def/:word', (req, res) => {
Expand All @@ -132,7 +132,7 @@ class FeatureServer {
})
})
.catch((err) => {
res.send(err);
res.status(404).send(err);
})
})
}
Expand Down

0 comments on commit dc07764

Please sign in to comment.