Skip to content

Instantly share code, notes, and snippets.

@pbuyle
Created December 26, 2008 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbuyle/40065 to your computer and use it in GitHub Desktop.
Save pbuyle/40065 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "tux-say",
icon: "http://tuxisalive.com/favicon.ico",
homepage: "http://www.tuxisalive.com/tux-droid-forum/scripts/673765359",
author: { name: "mongolito404", email: "mongolito404@gmail.com"},
license: "GPL",
description: "Read a text with your Tux Droid.",
help: "tux-say Hello World",
takes: {"input": noun_arb_text},
execute: function(msg) {
jQuery.get('http://127.0.0.1:270/0/tts/speak?text='+msg.text);
}
});
//Noun yype for Loccutors...
var noun_type_locutor = {
_name: 'Locutor',
_locutors: [],
suggest: function(text, html) {
var suggestions = [];
if (typeof text != "string") {
// Input undefined or not a string
return [];
}
for ( var x in this._locutors ) {
var word = this._locutors[x].toLowerCase();
if ( word.indexOf( text.toLowerCase() ) > -1 ) {
suggestions.push( CmdUtils.makeSugg(this._locutors[x]) );
}
}
return suggestions;
}
};
//Get available locutors
jQuery.get('http://127.0.0.1:270/0/tts/voices?', {},function(data){
noun_type_locutor._locutors = jQuery.map(jQuery(data).find("locutor"), function(locutor){
locutor = jQuery(locutor);
return locutor.text().replace('8k','');
});
});
CmdUtils.CreateCommand({
name: "tux-set-locutor",
icon: "http://tuxisalive.com/favicon.ico",
homepage: "http://www.tuxisalive.com/tux-droid-forum/scripts/673765359",
author: { name: "mongolito404", email: "mongolito404@gmail.com"},
license: "GPL",
description: "Set the <i>locutor</i> for your Tux Droid.",
takes: {"locutor": noun_type_locutor},
execute: function(input) {
jQuery.get('http://127.0.0.1:270/0/tts/locutor', {name: input.text});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment