summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xoeddefine.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/oeddefine.sh b/oeddefine.sh
index 1c3ae8a..0208723 100755
--- a/oeddefine.sh
+++ b/oeddefine.sh
@@ -58,7 +58,7 @@ _define() {
# Return etymology if available
_etym() {
_getdata
- output=$(echo "${result}" | jq '.results[].lexicalEntries[0].entries[0].etymologies[0]')
+ output=$(echo "${result}" | jq '.results[].lexicalEntries[0].entries[0].etymologies[0]' | tr -d \")
if [ -z "$output" ]; then
echo "No etymology found."
else
@@ -83,8 +83,16 @@ _thes() {
exit 0
}
+# Get URL for first audio file in returned data
+_audio() {
+ _getdata
+ output=$(echo "${result}" | jq '.results[0].lexicalEntries[0].entries[0].pronunciations[0].audioFile' | tr -d \")
+ echo $output
+ exit 0
+}
+
_help() {
- echo "Usage: !oeddefine [option] [word]. Options: -h help -t thesaurus -e etymology -d define -s source"
+ echo "Usage: !oeddefine [option] [word]. Options: -h help -t thesaurus -e etymology -d define -a audio -s source"
exit 0
}
@@ -97,6 +105,8 @@ elif [[ ${word} =~ "-t" ]]; then
_thes
elif [[ ${word} =~ "-et" ]]; then
_etym
+elif [[ ${word} =~ "-a" ]]; then
+ _audio
else
_define
fi