zaf / asterisk-googletts

Asterisk AGI script that uses Google's translate text to speech service.
GNU General Public License v2.0
214 stars 125 forks source link

Same cache filename for different languages #15

Closed gianks closed 9 years ago

gianks commented 9 years ago

Hi all, even if not really applicable in the real world i've found a possible caveat in file caching: if you call the script twice with the same text but different languages (not very frequent but possible) the same file will be played back.

To avoid this i suggest to add language in cached file names as below:

    if ($usecache) {
            $filename = md5_hex($line) . "_$lang";

Regards Gianluca

zaf commented 9 years ago

Hello,

thank you for the suggestion. This is already taken care of in recent versions of the script. When we generate the md5 hash that is used as the cached file name we use as input the text, the language and the speed:

$filename = md5_hex("$line.$lang.$speed");

So we make sure to generate different file names regarding to language and also speed of the synthesized text.

gianks commented 9 years ago

Thank you. Simply great job!

On 27/11/2014 12:17, Lefteris Zafiris wrote:

Hello,

thank you for the suggestion. This is already taken care of in recent versions of the script. When we generate the md5 hash that is used as the cached file name we use as input the text, the language and the speed:

$filename = md5_hex("$line.$lang.$speed");

So we make sure to generate different file names regarding to language and also speed of the synthesized text.

— Reply to this email directly or view it on GitHub https://github.com/zaf/asterisk-googletts/issues/15#issuecomment-64777792.

zaf commented 9 years ago

Cheers!