]> gitweb.factorcode.org Git - factor.git/commitdiff
google.translate: using download-to.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 20 Oct 2013 15:52:13 +0000 (08:52 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 20 Oct 2013 15:52:13 +0000 (08:52 -0700)
extra/google/translate/translate.factor

index 26fbbbbb577ee883855bba51676cb687fe6662d7..40f810a6400821a2e4889729888f6ed89de0c830 100644 (file)
@@ -53,9 +53,8 @@ ERROR: response-error response error ;
 
 : translate-tts ( text -- file )
     "http://translate.google.com/translate_tts?tl=en" >url
-    swap "q" set-query-param http-get*
-    temporary-file ".mp3" append
-    [ binary set-file-contents ] keep ;
+    swap "q" set-query-param "" ".mp3" make-unique-file
+    [ download-to ] keep ;
 
 ! Example:
 ! "dog" "en" "de" translate .