From 67a7a6a6beeae2b36de38c4dd59d4895b6a188bc Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 5 Mar 2015 17:16:19 +0100 Subject: utils: normalize naming of google wrappers --- util/bin/currency.google | 28 ---------------------------- util/bin/google.currency | 28 ++++++++++++++++++++++++++++ util/bin/google.text2speech | 24 ++++++++++++++++++++++++ util/bin/google.translate | 27 +++++++++++++++++++++++++++ util/bin/text2speech.google | 24 ------------------------ util/bin/translate.google | 27 --------------------------- 6 files changed, 79 insertions(+), 79 deletions(-) delete mode 100755 util/bin/currency.google create mode 100755 util/bin/google.currency create mode 100755 util/bin/google.text2speech create mode 100755 util/bin/google.translate delete mode 100755 util/bin/text2speech.google delete mode 100755 util/bin/translate.google (limited to 'util') diff --git a/util/bin/currency.google b/util/bin/currency.google deleted file mode 100755 index 8219a866..00000000 --- a/util/bin/currency.google +++ /dev/null @@ -1,28 +0,0 @@ -#! /bin/sh -set -euf - -tc=${TC:="usd"} -sc=${SC:="eur"} - -usage(){ - echo 'TC= targetcurrency, valid strings are in the style of "usd", "eur" or "sgd". default "usd"' - echo 'SC= sourcecurrency, same TC, default is eur' - echo 'Example: TC="sgd" ./currency.google 11' - - exit 0 -} - -currency_convert(){ - text=$* - url="http://www.google.com/finance/converter?a=$1&from=$sc&to=$tc" - curl -A "Mozilla/5.0" -Ss "$url" | - sed '/res/!d;s/<[^>]*>//g' | - #sed 's/\[\[\[\"//' | - awk '{print $4}' -} - -if [ $# -eq 0 ]; then - usage -fi - -currency_convert $* diff --git a/util/bin/google.currency b/util/bin/google.currency new file mode 100755 index 00000000..8219a866 --- /dev/null +++ b/util/bin/google.currency @@ -0,0 +1,28 @@ +#! /bin/sh +set -euf + +tc=${TC:="usd"} +sc=${SC:="eur"} + +usage(){ + echo 'TC= targetcurrency, valid strings are in the style of "usd", "eur" or "sgd". default "usd"' + echo 'SC= sourcecurrency, same TC, default is eur' + echo 'Example: TC="sgd" ./currency.google 11' + + exit 0 +} + +currency_convert(){ + text=$* + url="http://www.google.com/finance/converter?a=$1&from=$sc&to=$tc" + curl -A "Mozilla/5.0" -Ss "$url" | + sed '/res/!d;s/<[^>]*>//g' | + #sed 's/\[\[\[\"//' | + awk '{print $4}' +} + +if [ $# -eq 0 ]; then + usage +fi + +currency_convert $* diff --git a/util/bin/google.text2speech b/util/bin/google.text2speech new file mode 100755 index 00000000..061bb1c8 --- /dev/null +++ b/util/bin/google.text2speech @@ -0,0 +1,24 @@ +#!/bin/sh +set -euf + +TL=${TL:="en"} + +usage(){ + echo 'TL= can specifiy which language to use, default is "en"' + echo 'Example: TL="de" ./text2speech.google "whats up?" | mpv -' + exit 0 +} + +text2speech(){ + text=$* + url="http://translate.google.com/translate_tts?ie=UTF-8&tl=$TL" + + curl -A "Mozilla/5.0" -Ss "$url" --data-urlencode "q=$text" +} + +if [ $# -eq 0 ]; then + usage +fi + +text2speech $* + diff --git a/util/bin/google.translate b/util/bin/google.translate new file mode 100755 index 00000000..06c6a5a8 --- /dev/null +++ b/util/bin/google.translate @@ -0,0 +1,27 @@ +#! /bin/sh +set -euf + +sl=${SL:="auto"} +tl=${TL:="en"} + +usage(){ + echo 'TL= targetlanguage, valid strings are in the style of "en", "pl" or "de". default "en"' + echo 'SL= sourcelanguage, same TL, default is auto' + echo 'Example: TL="de" ./translate.google "whats up?"' + + exit 0 +} + +translate(){ + text=$* + url="http://translate.google.com/translate_a/t?client=t&sl=$sl&tl=$tl" + curl -A "Mozilla/5.0" -Ss "$url" --data-urlencode "text=$text" | + sed 's/\[\[\[\"//' | + cut -d \" -f 1 +} + +if [ $# -eq 0 ]; then + usage +fi + +translate $* diff --git a/util/bin/text2speech.google b/util/bin/text2speech.google deleted file mode 100755 index 061bb1c8..00000000 --- a/util/bin/text2speech.google +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -euf - -TL=${TL:="en"} - -usage(){ - echo 'TL= can specifiy which language to use, default is "en"' - echo 'Example: TL="de" ./text2speech.google "whats up?" | mpv -' - exit 0 -} - -text2speech(){ - text=$* - url="http://translate.google.com/translate_tts?ie=UTF-8&tl=$TL" - - curl -A "Mozilla/5.0" -Ss "$url" --data-urlencode "q=$text" -} - -if [ $# -eq 0 ]; then - usage -fi - -text2speech $* - diff --git a/util/bin/translate.google b/util/bin/translate.google deleted file mode 100755 index 06c6a5a8..00000000 --- a/util/bin/translate.google +++ /dev/null @@ -1,27 +0,0 @@ -#! /bin/sh -set -euf - -sl=${SL:="auto"} -tl=${TL:="en"} - -usage(){ - echo 'TL= targetlanguage, valid strings are in the style of "en", "pl" or "de". default "en"' - echo 'SL= sourcelanguage, same TL, default is auto' - echo 'Example: TL="de" ./translate.google "whats up?"' - - exit 0 -} - -translate(){ - text=$* - url="http://translate.google.com/translate_a/t?client=t&sl=$sl&tl=$tl" - curl -A "Mozilla/5.0" -Ss "$url" --data-urlencode "text=$text" | - sed 's/\[\[\[\"//' | - cut -d \" -f 1 -} - -if [ $# -eq 0 ]; then - usage -fi - -translate $* -- cgit v1.2.3