{"action":"created","comment":{"url":"https://api.github.com/repos/freedomotic/freedomotic/pulls/comments/22759293","id":22759293,"diff_hunk":"@@ -0,0 +1,175 @@\n+/**\n+ *\n+ * Copyright (c) 2009-2015 Freedomotic team http://freedomotic.com\n+ * \n+* This file is part of Freedomotic\n+ * \n+* This Program is free software; you can redistribute it and/or modify it under\n+ * the terms of the GNU General Public License as published by the Free Software\n+ * Foundation; either version 2, or (at your option) any later version.\n+ * \n+* This Program is distributed in the hope that it will be useful, but WITHOUT\n+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n+ * details.\n+ * \n+* You should have received a copy of the GNU General Public License along with\n+ * Freedomotic; see the file COPYING. If not, see\n+ * <http://www.gnu.org/licenses/>.\n+ */\n+\n+/**\n+ * @author Mauro Cicolella\n+ */\n+\n+package com.freedomotic.plugins.marytts;\n+\n+import com.freedomotic.api.EventTemplate;\n+import com.freedomotic.api.Protocol;\n+import com.freedomotic.app.Freedomotic;\n+import com.freedomotic.exceptions.PluginStartupException;\n+import com.freedomotic.exceptions.UnableToExecuteException;\n+import com.freedomotic.reactions.Command;\n+import com.freedomotic.util.Info;\n+import java.io.File;\n+import java.io.IOException;\n+import java.lang.reflect.Method;\n+import java.net.URI;\n+import java.net.URL;\n+import java.net.URLClassLoader;\n+import java.util.Set;\n+import java.util.logging.Level;\n+import java.util.logging.Logger;\n+import javax.sound.sampled.AudioInputStream;\n+\n+import marytts.LocalMaryInterface;\n+import marytts.MaryInterface;\n+import marytts.exceptions.MaryConfigurationException;\n+import marytts.exceptions.SynthesisException;\n+import marytts.modules.synthesis.Voice;\n+import marytts.util.data.audio.AudioPlayer;\n+\n+public class MaryTTS extends Protocol {\n+\n+    private static final Logger LOG = Logger.getLogger(MaryTTS.class.getName());\n+    private MaryInterface marytts;\n+    private Voice defaultVoice;\n+    private Voice voice;\n+    private AudioInputStream audio;\n+    private String VOICE_JAR_FILE = configuration.getProperty(\"voice-jar-file\");\n+    private String VOICE = configuration.getProperty(\"voice\");\n+\n+    public MaryTTS() {\n+        super(\"MaryTTS\", \"/marytts/marytts-manifest.xml\");\n+    }\n+\n+    @Override\n+    protected void onStart() throws PluginStartupException {\n+        try {\n+            //add voices folder to classpath\n+            addPath(Info.PATHS.PATH_DEVICES_FOLDER + System.getProperty(\"file.separator\") + \"marytts/lib/\" + VOICE_JAR_FILE);\n+            System.setProperty(\"mary.base\", Info.PATHS.PATH_DEVICES_FOLDER + System.getProperty(\"file.separator\") + \"marytts\");\n+            marytts = new LocalMaryInterface();\n+            // print available voices and languages\n+            getInfo();\n+            // set default voice\n+            defaultVoice = Voice.getVoice(\"cmu-slt-hsmm\");\n+        } catch (MaryConfigurationException ex) {\n+            throw new PluginStartupException(\"Plugin can't start for \" + ex.getMessage());\n+        } catch (Exception ex) {\n+            LOG.log(Level.SEVERE, \"Impossible to modify classpath for ''{0}''\", Freedomotic.getStackTraceInfo(ex));\n+        }\n+    }\n+\n+    @Override\n+    protected void onShowGui() {\n+        bindGuiToPlugin(new MaryTTSGui(this));\n+    }\n+\n+    public void say(String message) {\n+        try {","path":"plugins/devices/marytts/src/main/java/com/freedomotic/plugins/marytts/MaryTTS.java","position":90,"original_position":90,"commit_id":"0907d5ddeb53a1cc9924e9897d0f0890981e8eb5","original_commit_id":"0907d5ddeb53a1cc9924e9897d0f0890981e8eb5","user":{"login":"enriconicoletti","id":5609287,"avatar_url":"https://avatars.githubusercontent.com/u/5609287?v=3","gravatar_id":"","url":"https://api.github.com/users/enriconicoletti","html_url":"https://github.com/enriconicoletti","followers_url":"https://api.github.com/users/enriconicoletti/followers","following_url":"https://api.github.com/users/enriconicoletti/following{/other_user}","gists_url":"https://api.github.com/users/enriconicoletti/gists{/gist_id}","starred_url":"https://api.github.com/users/enriconicoletti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enriconicoletti/subscriptions","organizations_url":"https://api.github.com/users/enriconicoletti/orgs","repos_url":"https://api.github.com/users/enriconicoletti/repos","events_url":"https://api.github.com/users/enriconicoletti/events{/privacy}","received_events_url":"https://api.github.com/users/enriconicoletti/received_events","type":"User","site_admin":false},"body":"check if message it's a valid string","created_at":"2015-01-10T14:29:39Z","updated_at":"2015-01-10T14:29:39Z","html_url":"https://github.com/freedomotic/freedomotic/pull/65#discussion_r22759293","pull_request_url":"https://api.github.com/repos/freedomotic/freedomotic/pulls/65","_links":{"self":{"href":"https://api.github.com/repos/freedomotic/freedomotic/pulls/comments/22759293"},"html":{"href":"https://github.com/freedomotic/freedomotic/pull/65#discussion_r22759293"},"pull_request":{"href":"https://api.github.com/repos/freedomotic/freedomotic/pulls/65"}}},"pull_request":{"url":"https://api.github.com/repos/freedomotic/freedomotic/pulls/65","id":27058360,"html_url":"https://github.com/freedomotic/freedomotic/pull/65","diff_url":"https://github.com/freedomotic/freedomotic/pull/65.diff","patch_url":"https://github.com/freedomotic/freedomotic/pull/65.patch","issue_url":"https://api.github.com/repos/freedomotic/freedomotic/issues/65","number":65,"state":"open","locked":false,"title":"Add MaryTTS Text To Speech plugin ","user":{"login":"mcicolella","id":4079634,"avatar_url":"https://avatars.githubusercontent.com/u/4079634?v=3","gravatar_id":"","url":"https://api.github.com/users/mcicolella","html_url":"https://github.com/mcicolella","followers_url":"https://api.github.com/users/mcicolella/followers","following_url":"https://api.github.com/users/mcicolella/following{/other_user}","gists_url":"https://api.github.com/users/mcicolella/gists{/gist_id}","starred_url":"https://api.github.com/users/mcicolella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcicolella/subscriptions","organizations_url":"https://api.github.com/users/mcicolella/orgs","repos_url":"https://api.github.com/users/mcicolella/repos","events_url":"https://api.github.com/users/mcicolella/events{/privacy}","received_events_url":"https://api.github.com/users/mcicolella/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-08T20:46:49Z","updated_at":"2015-01-10T14:29:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74957b522d1e939ea6037d9e0b4286150167c729","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/freedomotic/freedomotic/pulls/65/commits","review_comments_url":"https://api.github.com/repos/freedomotic/freedomotic/pulls/65/comments","review_comment_url":"https://api.github.com/repos/freedomotic/freedomotic/pulls/comments/{number}","comments_url":"https://api.github.com/repos/freedomotic/freedomotic/issues/65/comments","statuses_url":"https://api.github.com/repos/freedomotic/freedomotic/statuses/0907d5ddeb53a1cc9924e9897d0f0890981e8eb5","head":{"label":"mcicolella:marytts","ref":"marytts","sha":"0907d5ddeb53a1cc9924e9897d0f0890981e8eb5","user":{"login":"mcicolella","id":4079634,"avatar_url":"https://avatars.githubusercontent.com/u/4079634?v=3","gravatar_id":"","url":"https://api.github.com/users/mcicolella","html_url":"https://github.com/mcicolella","followers_url":"https://api.github.com/users/mcicolella/followers","following_url":"https://api.github.com/users/mcicolella/following{/other_user}","gists_url":"https://api.github.com/users/mcicolella/gists{/gist_id}","starred_url":"https://api.github.com/users/mcicolella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcicolella/subscriptions","organizations_url":"https://api.github.com/users/mcicolella/orgs","repos_url":"https://api.github.com/users/mcicolella/repos","events_url":"https://api.github.com/users/mcicolella/events{/privacy}","received_events_url":"https://api.github.com/users/mcicolella/received_events","type":"User","site_admin":false},"repo":{"id":17023674,"name":"freedomotic","full_name":"mcicolella/freedomotic","owner":{"login":"mcicolella","id":4079634,"avatar_url":"https://avatars.githubusercontent.com/u/4079634?v=3","gravatar_id":"","url":"https://api.github.com/users/mcicolella","html_url":"https://github.com/mcicolella","followers_url":"https://api.github.com/users/mcicolella/followers","following_url":"https://api.github.com/users/mcicolella/following{/other_user}","gists_url":"https://api.github.com/users/mcicolella/gists{/gist_id}","starred_url":"https://api.github.com/users/mcicolella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcicolella/subscriptions","organizations_url":"https://api.github.com/users/mcicolella/orgs","repos_url":"https://api.github.com/users/mcicolella/repos","events_url":"https://api.github.com/users/mcicolella/events{/privacy}","received_events_url":"https://api.github.com/users/mcicolella/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mcicolella/freedomotic","description":"Freedomotic - Smart Spaces Framework","fork":true,"url":"https://api.github.com/repos/mcicolella/freedomotic","forks_url":"https://api.github.com/repos/mcicolella/freedomotic/forks","keys_url":"https://api.github.com/repos/mcicolella/freedomotic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mcicolella/freedomotic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mcicolella/freedomotic/teams","hooks_url":"https://api.github.com/repos/mcicolella/freedomotic/hooks","issue_events_url":"https://api.github.com/repos/mcicolella/freedomotic/issues/events{/number}","events_url":"https://api.github.com/repos/mcicolella/freedomotic/events","assignees_url":"https://api.github.com/repos/mcicolella/freedomotic/assignees{/user}","branches_url":"https://api.github.com/repos/mcicolella/freedomotic/branches{/branch}","tags_url":"https://api.github.com/repos/mcicolella/freedomotic/tags","blobs_url":"https://api.github.com/repos/mcicolella/freedomotic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mcicolella/freedomotic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mcicolella/freedomotic/git/refs{/sha}","trees_url":"https://api.github.com/repos/mcicolella/freedomotic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mcicolella/freedomotic/statuses/{sha}","languages_url":"https://api.github.com/repos/mcicolella/freedomotic/languages","stargazers_url":"https://api.github.com/repos/mcicolella/freedomotic/stargazers","contributors_url":"https://api.github.com/repos/mcicolella/freedomotic/contributors","subscribers_url":"https://api.github.com/repos/mcicolella/freedomotic/subscribers","subscription_url":"https://api.github.com/repos/mcicolella/freedomotic/subscription","commits_url":"https://api.github.com/repos/mcicolella/freedomotic/commits{/sha}","git_commits_url":"https://api.github.com/repos/mcicolella/freedomotic/git/commits{/sha}","comments_url":"https://api.github.com/repos/mcicolella/freedomotic/comments{/number}","issue_comment_url":"https://api.github.com/repos/mcicolella/freedomotic/issues/comments/{number}","contents_url":"https://api.github.com/repos/mcicolella/freedomotic/contents/{+path}","compare_url":"https://api.github.com/repos/mcicolella/freedomotic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mcicolella/freedomotic/merges","archive_url":"https://api.github.com/repos/mcicolella/freedomotic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mcicolella/freedomotic/downloads","issues_url":"https://api.github.com/repos/mcicolella/freedomotic/issues{/number}","pulls_url":"https://api.github.com/repos/mcicolella/freedomotic/pulls{/number}","milestones_url":"https://api.github.com/repos/mcicolella/freedomotic/milestones{/number}","notifications_url":"https://api.github.com/repos/mcicolella/freedomotic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mcicolella/freedomotic/labels{/name}","releases_url":"https://api.github.com/repos/mcicolella/freedomotic/releases{/id}","created_at":"2014-02-20T14:49:10Z","updated_at":"2014-07-17T17:04:21Z","pushed_at":"2015-01-09T11:14:55Z","git_url":"git://github.com/mcicolella/freedomotic.git","ssh_url":"git@github.com:mcicolella/freedomotic.git","clone_url":"https://github.com/mcicolella/freedomotic.git","svn_url":"https://github.com/mcicolella/freedomotic","homepage":"http://freedomotic.com","size":55550,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":0,"forks":4,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"freedomotic:master","ref":"master","sha":"17280798e5b5b7c819b3d195f62f8f746b3d4e7e","user":{"login":"freedomotic","id":5622993,"avatar_url":"https://avatars.githubusercontent.com/u/5622993?v=3","gravatar_id":"","url":"https://api.github.com/users/freedomotic","html_url":"https://github.com/freedomotic","followers_url":"https://api.github.com/users/freedomotic/followers","following_url":"https://api.github.com/users/freedomotic/following{/other_user}","gists_url":"https://api.github.com/users/freedomotic/gists{/gist_id}","starred_url":"https://api.github.com/users/freedomotic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freedomotic/subscriptions","organizations_url":"https://api.github.com/users/freedomotic/orgs","repos_url":"https://api.github.com/users/freedomotic/repos","events_url":"https://api.github.com/users/freedomotic/events{/privacy}","received_events_url":"https://api.github.com/users/freedomotic/received_events","type":"Organization","site_admin":false},"repo":{"id":13363729,"name":"freedomotic","full_name":"freedomotic/freedomotic","owner":{"login":"freedomotic","id":5622993,"avatar_url":"https://avatars.githubusercontent.com/u/5622993?v=3","gravatar_id":"","url":"https://api.github.com/users/freedomotic","html_url":"https://github.com/freedomotic","followers_url":"https://api.github.com/users/freedomotic/followers","following_url":"https://api.github.com/users/freedomotic/following{/other_user}","gists_url":"https://api.github.com/users/freedomotic/gists{/gist_id}","starred_url":"https://api.github.com/users/freedomotic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freedomotic/subscriptions","organizations_url":"https://api.github.com/users/freedomotic/orgs","repos_url":"https://api.github.com/users/freedomotic/repos","events_url":"https://api.github.com/users/freedomotic/events{/privacy}","received_events_url":"https://api.github.com/users/freedomotic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/freedomotic/freedomotic","description":"Open Internet of Things Framework - ThinG Wider!","fork":false,"url":"https://api.github.com/repos/freedomotic/freedomotic","forks_url":"https://api.github.com/repos/freedomotic/freedomotic/forks","keys_url":"https://api.github.com/repos/freedomotic/freedomotic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/freedomotic/freedomotic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/freedomotic/freedomotic/teams","hooks_url":"https://api.github.com/repos/freedomotic/freedomotic/hooks","issue_events_url":"https://api.github.com/repos/freedomotic/freedomotic/issues/events{/number}","events_url":"https://api.github.com/repos/freedomotic/freedomotic/events","assignees_url":"https://api.github.com/repos/freedomotic/freedomotic/assignees{/user}","branches_url":"https://api.github.com/repos/freedomotic/freedomotic/branches{/branch}","tags_url":"https://api.github.com/repos/freedomotic/freedomotic/tags","blobs_url":"https://api.github.com/repos/freedomotic/freedomotic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/freedomotic/freedomotic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/freedomotic/freedomotic/git/refs{/sha}","trees_url":"https://api.github.com/repos/freedomotic/freedomotic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/freedomotic/freedomotic/statuses/{sha}","languages_url":"https://api.github.com/repos/freedomotic/freedomotic/languages","stargazers_url":"https://api.github.com/repos/freedomotic/freedomotic/stargazers","contributors_url":"https://api.github.com/repos/freedomotic/freedomotic/contributors","subscribers_url":"https://api.github.com/repos/freedomotic/freedomotic/subscribers","subscription_url":"https://api.github.com/repos/freedomotic/freedomotic/subscription","commits_url":"https://api.github.com/repos/freedomotic/freedomotic/commits{/sha}","git_commits_url":"https://api.github.com/repos/freedomotic/freedomotic/git/commits{/sha}","comments_url":"https://api.github.com/repos/freedomotic/freedomotic/comments{/number}","issue_comment_url":"https://api.github.com/repos/freedomotic/freedomotic/issues/comments/{number}","contents_url":"https://api.github.com/repos/freedomotic/freedomotic/contents/{+path}","compare_url":"https://api.github.com/repos/freedomotic/freedomotic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/freedomotic/freedomotic/merges","archive_url":"https://api.github.com/repos/freedomotic/freedomotic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/freedomotic/freedomotic/downloads","issues_url":"https://api.github.com/repos/freedomotic/freedomotic/issues{/number}","pulls_url":"https://api.github.com/repos/freedomotic/freedomotic/pulls{/number}","milestones_url":"https://api.github.com/repos/freedomotic/freedomotic/milestones{/number}","notifications_url":"https://api.github.com/repos/freedomotic/freedomotic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/freedomotic/freedomotic/labels{/name}","releases_url":"https://api.github.com/repos/freedomotic/freedomotic/releases{/id}","created_at":"2013-10-06T14:53:16Z","updated_at":"2015-01-10T04:56:10Z","pushed_at":"2015-01-09T23:47:45Z","git_url":"git://github.com/freedomotic/freedomotic.git","ssh_url":"git@github.com:freedomotic/freedomotic.git","clone_url":"https://github.com/freedomotic/freedomotic.git","svn_url":"https://github.com/freedomotic/freedomotic","homepage":"http://freedomotic.com","size":57497,"stargazers_count":52,"watchers_count":52,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":105,"mirror_url":null,"open_issues_count":3,"forks":105,"open_issues":3,"watchers":52,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/freedomotic/freedomotic/pulls/65"},"html":{"href":"https://github.com/freedomotic/freedomotic/pull/65"},"issue":{"href":"https://api.github.com/repos/freedomotic/freedomotic/issues/65"},"comments":{"href":"https://api.github.com/repos/freedomotic/freedomotic/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/freedomotic/freedomotic/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/freedomotic/freedomotic/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/freedomotic/freedomotic/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/freedomotic/freedomotic/statuses/0907d5ddeb53a1cc9924e9897d0f0890981e8eb5"}}}}