{"action":"created","comment":{"url":"https://api.github.com/repos/uzyovoys/aggregate/pulls/comments/56857329","id":56857329,"diff_hunk":"@@ -0,0 +1,74 @@\n+package com.popov.screenshotmaker;\n+\n+import io.vertx.core.AbstractVerticle;\n+import io.vertx.core.eventbus.Message;\n+import io.vertx.core.logging.Logger;\n+import io.vertx.core.logging.LoggerFactory;\n+\n+import javax.imageio.ImageIO;\n+import java.awt.*;\n+import java.awt.image.BufferedImage;\n+import java.io.File;\n+import java.io.IOException;\n+import java.text.SimpleDateFormat;\n+import java.util.Date;\n+\n+/**\n+ * Created by AntonPopov on 05.03.16.\n+ */\n+public class ScreenShotMaker extends AbstractVerticle {\n+    public static final String TEMP_PATH = System.getProperty(\"java.io.tmpdir\");\n+    private static Logger log = LoggerFactory.getLogger(ScreenShotMaker.class);\n+\n+    @Override\n+    public void start() throws Exception {\n+        vertx.eventBus().consumer(\"cmd.makeScreenshot\", m -> captureScreen(m));\n+\n+    }\n+\n+    private void captureScreen(Message m) {\n+\n+        String fileName = \"ScreenShot_\" + new SimpleDateFormat(\"yyyy-MM-dd--HH-mm-ss\").format(new Date()) + \".jpg\";\n+        Robot robot;\n+        try {\n+            robot = new Robot();\n+        } catch (AWTException e) {\n+            log.error(e);\n+            return;\n+        }\n+\n+        BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));\n+\n+        File path;\n+        path = new File(TEMP_PATH, \"ScreenShot\");\n+        File screenShotPathToFile;\n+        screenShotPathToFile = new File(path, fileName);\n+\n+        try {\n+            if (!path.mkdirs()) log.error(\"Can not create directory for screenshots\");\n+            ImageIO.write(screenShot, \"jpg\", screenShotPathToFile);\n+        } catch (IOException e) {\n+            log.error(e);\n+            return;\n+        }\n+\n+        openScreenShotFolder(path);\n+\n+    }\n+\n+    public void openScreenShotFolder(File path) {\n+        Desktop desktop;\n+        if (Desktop.isDesktopSupported()) {\n+            desktop = Desktop.getDesktop();\n+        } else {\n+            log.warn(\"Desktop is not supported\");\n+            return;\n+        }\n+        try {\n+            desktop.open(new File(path + \"ScreenShot\"));","path":"modules/screenshotmaker/src/main/java/com/popov/screenshotmaker/ScreenShotMaker.java","position":68,"original_position":68,"commit_id":"5132ac70baf02cce5b7d49bf13ccb4ff45be7c3a","original_commit_id":"5132ac70baf02cce5b7d49bf13ccb4ff45be7c3a","user":{"login":"Morfeusys","id":1058127,"avatar_url":"https://avatars.githubusercontent.com/u/1058127?v=3","gravatar_id":"","url":"https://api.github.com/users/Morfeusys","html_url":"https://github.com/Morfeusys","followers_url":"https://api.github.com/users/Morfeusys/followers","following_url":"https://api.github.com/users/Morfeusys/following{/other_user}","gists_url":"https://api.github.com/users/Morfeusys/gists{/gist_id}","starred_url":"https://api.github.com/users/Morfeusys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morfeusys/subscriptions","organizations_url":"https://api.github.com/users/Morfeusys/orgs","repos_url":"https://api.github.com/users/Morfeusys/repos","events_url":"https://api.github.com/users/Morfeusys/events{/privacy}","received_events_url":"https://api.github.com/users/Morfeusys/received_events","type":"User","site_admin":false},"body":"Тут `path` вроде не `String`, так что правильно будет `new File(path, \"ScreenShot\")`","created_at":"2016-03-21T16:56:46Z","updated_at":"2016-03-21T16:56:46Z","html_url":"https://github.com/uzyovoys/aggregate/pull/49#discussion_r56857329","pull_request_url":"https://api.github.com/repos/uzyovoys/aggregate/pulls/49","_links":{"self":{"href":"https://api.github.com/repos/uzyovoys/aggregate/pulls/comments/56857329"},"html":{"href":"https://github.com/uzyovoys/aggregate/pull/49#discussion_r56857329"},"pull_request":{"href":"https://api.github.com/repos/uzyovoys/aggregate/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/uzyovoys/aggregate/pulls/49","id":62027280,"html_url":"https://github.com/uzyovoys/aggregate/pull/49","diff_url":"https://github.com/uzyovoys/aggregate/pull/49.diff","patch_url":"https://github.com/uzyovoys/aggregate/pull/49.patch","issue_url":"https://api.github.com/repos/uzyovoys/aggregate/issues/49","number":49,"state":"open","locked":false,"title":"New Модуль для создания скриншотов","user":{"login":"popovanton0","id":15000556,"avatar_url":"https://avatars.githubusercontent.com/u/15000556?v=3","gravatar_id":"","url":"https://api.github.com/users/popovanton0","html_url":"https://github.com/popovanton0","followers_url":"https://api.github.com/users/popovanton0/followers","following_url":"https://api.github.com/users/popovanton0/following{/other_user}","gists_url":"https://api.github.com/users/popovanton0/gists{/gist_id}","starred_url":"https://api.github.com/users/popovanton0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/popovanton0/subscriptions","organizations_url":"https://api.github.com/users/popovanton0/orgs","repos_url":"https://api.github.com/users/popovanton0/repos","events_url":"https://api.github.com/users/popovanton0/events{/privacy}","received_events_url":"https://api.github.com/users/popovanton0/received_events","type":"User","site_admin":false},"body":"Теперь ничего не удалено","created_at":"2016-03-08T05:41:18Z","updated_at":"2016-03-21T16:56:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"70fcf41509c7b461a5d6b480c2bdc1ab3e80b810","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/uzyovoys/aggregate/pulls/49/commits","review_comments_url":"https://api.github.com/repos/uzyovoys/aggregate/pulls/49/comments","review_comment_url":"https://api.github.com/repos/uzyovoys/aggregate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uzyovoys/aggregate/issues/49/comments","statuses_url":"https://api.github.com/repos/uzyovoys/aggregate/statuses/5132ac70baf02cce5b7d49bf13ccb4ff45be7c3a","head":{"label":"popovanton0:master","ref":"master","sha":"5132ac70baf02cce5b7d49bf13ccb4ff45be7c3a","user":{"login":"popovanton0","id":15000556,"avatar_url":"https://avatars.githubusercontent.com/u/15000556?v=3","gravatar_id":"","url":"https://api.github.com/users/popovanton0","html_url":"https://github.com/popovanton0","followers_url":"https://api.github.com/users/popovanton0/followers","following_url":"https://api.github.com/users/popovanton0/following{/other_user}","gists_url":"https://api.github.com/users/popovanton0/gists{/gist_id}","starred_url":"https://api.github.com/users/popovanton0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/popovanton0/subscriptions","organizations_url":"https://api.github.com/users/popovanton0/orgs","repos_url":"https://api.github.com/users/popovanton0/repos","events_url":"https://api.github.com/users/popovanton0/events{/privacy}","received_events_url":"https://api.github.com/users/popovanton0/received_events","type":"User","site_admin":false},"repo":{"id":53385558,"name":"aggregate","full_name":"popovanton0/aggregate","owner":{"login":"popovanton0","id":15000556,"avatar_url":"https://avatars.githubusercontent.com/u/15000556?v=3","gravatar_id":"","url":"https://api.github.com/users/popovanton0","html_url":"https://github.com/popovanton0","followers_url":"https://api.github.com/users/popovanton0/followers","following_url":"https://api.github.com/users/popovanton0/following{/other_user}","gists_url":"https://api.github.com/users/popovanton0/gists{/gist_id}","starred_url":"https://api.github.com/users/popovanton0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/popovanton0/subscriptions","organizations_url":"https://api.github.com/users/popovanton0/orgs","repos_url":"https://api.github.com/users/popovanton0/repos","events_url":"https://api.github.com/users/popovanton0/events{/privacy}","received_events_url":"https://api.github.com/users/popovanton0/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/popovanton0/aggregate","description":"Voice assistant constructor","fork":true,"url":"https://api.github.com/repos/popovanton0/aggregate","forks_url":"https://api.github.com/repos/popovanton0/aggregate/forks","keys_url":"https://api.github.com/repos/popovanton0/aggregate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/popovanton0/aggregate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/popovanton0/aggregate/teams","hooks_url":"https://api.github.com/repos/popovanton0/aggregate/hooks","issue_events_url":"https://api.github.com/repos/popovanton0/aggregate/issues/events{/number}","events_url":"https://api.github.com/repos/popovanton0/aggregate/events","assignees_url":"https://api.github.com/repos/popovanton0/aggregate/assignees{/user}","branches_url":"https://api.github.com/repos/popovanton0/aggregate/branches{/branch}","tags_url":"https://api.github.com/repos/popovanton0/aggregate/tags","blobs_url":"https://api.github.com/repos/popovanton0/aggregate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/popovanton0/aggregate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/popovanton0/aggregate/git/refs{/sha}","trees_url":"https://api.github.com/repos/popovanton0/aggregate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/popovanton0/aggregate/statuses/{sha}","languages_url":"https://api.github.com/repos/popovanton0/aggregate/languages","stargazers_url":"https://api.github.com/repos/popovanton0/aggregate/stargazers","contributors_url":"https://api.github.com/repos/popovanton0/aggregate/contributors","subscribers_url":"https://api.github.com/repos/popovanton0/aggregate/subscribers","subscription_url":"https://api.github.com/repos/popovanton0/aggregate/subscription","commits_url":"https://api.github.com/repos/popovanton0/aggregate/commits{/sha}","git_commits_url":"https://api.github.com/repos/popovanton0/aggregate/git/commits{/sha}","comments_url":"https://api.github.com/repos/popovanton0/aggregate/comments{/number}","issue_comment_url":"https://api.github.com/repos/popovanton0/aggregate/issues/comments{/number}","contents_url":"https://api.github.com/repos/popovanton0/aggregate/contents/{+path}","compare_url":"https://api.github.com/repos/popovanton0/aggregate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/popovanton0/aggregate/merges","archive_url":"https://api.github.com/repos/popovanton0/aggregate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/popovanton0/aggregate/downloads","issues_url":"https://api.github.com/repos/popovanton0/aggregate/issues{/number}","pulls_url":"https://api.github.com/repos/popovanton0/aggregate/pulls{/number}","milestones_url":"https://api.github.com/repos/popovanton0/aggregate/milestones{/number}","notifications_url":"https://api.github.com/repos/popovanton0/aggregate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/popovanton0/aggregate/labels{/name}","releases_url":"https://api.github.com/repos/popovanton0/aggregate/releases{/id}","deployments_url":"https://api.github.com/repos/popovanton0/aggregate/deployments","created_at":"2016-03-08T05:35:23Z","updated_at":"2016-03-08T05:40:02Z","pushed_at":"2016-03-21T14:40:07Z","git_url":"git://github.com/popovanton0/aggregate.git","ssh_url":"git@github.com:popovanton0/aggregate.git","clone_url":"https://github.com/popovanton0/aggregate.git","svn_url":"https://github.com/popovanton0/aggregate","homepage":null,"size":52856,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"uzyovoys:master","ref":"master","sha":"27d340bc031141ccca89dfa50737b5f0bac255a4","user":{"login":"uzyovoys","id":17474985,"avatar_url":"https://avatars.githubusercontent.com/u/17474985?v=3","gravatar_id":"","url":"https://api.github.com/users/uzyovoys","html_url":"https://github.com/uzyovoys","followers_url":"https://api.github.com/users/uzyovoys/followers","following_url":"https://api.github.com/users/uzyovoys/following{/other_user}","gists_url":"https://api.github.com/users/uzyovoys/gists{/gist_id}","starred_url":"https://api.github.com/users/uzyovoys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uzyovoys/subscriptions","organizations_url":"https://api.github.com/users/uzyovoys/orgs","repos_url":"https://api.github.com/users/uzyovoys/repos","events_url":"https://api.github.com/users/uzyovoys/events{/privacy}","received_events_url":"https://api.github.com/users/uzyovoys/received_events","type":"Organization","site_admin":false},"repo":{"id":52526661,"name":"aggregate","full_name":"uzyovoys/aggregate","owner":{"login":"uzyovoys","id":17474985,"avatar_url":"https://avatars.githubusercontent.com/u/17474985?v=3","gravatar_id":"","url":"https://api.github.com/users/uzyovoys","html_url":"https://github.com/uzyovoys","followers_url":"https://api.github.com/users/uzyovoys/followers","following_url":"https://api.github.com/users/uzyovoys/following{/other_user}","gists_url":"https://api.github.com/users/uzyovoys/gists{/gist_id}","starred_url":"https://api.github.com/users/uzyovoys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uzyovoys/subscriptions","organizations_url":"https://api.github.com/users/uzyovoys/orgs","repos_url":"https://api.github.com/users/uzyovoys/repos","events_url":"https://api.github.com/users/uzyovoys/events{/privacy}","received_events_url":"https://api.github.com/users/uzyovoys/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uzyovoys/aggregate","description":"Voice assistant constructor","fork":false,"url":"https://api.github.com/repos/uzyovoys/aggregate","forks_url":"https://api.github.com/repos/uzyovoys/aggregate/forks","keys_url":"https://api.github.com/repos/uzyovoys/aggregate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uzyovoys/aggregate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uzyovoys/aggregate/teams","hooks_url":"https://api.github.com/repos/uzyovoys/aggregate/hooks","issue_events_url":"https://api.github.com/repos/uzyovoys/aggregate/issues/events{/number}","events_url":"https://api.github.com/repos/uzyovoys/aggregate/events","assignees_url":"https://api.github.com/repos/uzyovoys/aggregate/assignees{/user}","branches_url":"https://api.github.com/repos/uzyovoys/aggregate/branches{/branch}","tags_url":"https://api.github.com/repos/uzyovoys/aggregate/tags","blobs_url":"https://api.github.com/repos/uzyovoys/aggregate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uzyovoys/aggregate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uzyovoys/aggregate/git/refs{/sha}","trees_url":"https://api.github.com/repos/uzyovoys/aggregate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uzyovoys/aggregate/statuses/{sha}","languages_url":"https://api.github.com/repos/uzyovoys/aggregate/languages","stargazers_url":"https://api.github.com/repos/uzyovoys/aggregate/stargazers","contributors_url":"https://api.github.com/repos/uzyovoys/aggregate/contributors","subscribers_url":"https://api.github.com/repos/uzyovoys/aggregate/subscribers","subscription_url":"https://api.github.com/repos/uzyovoys/aggregate/subscription","commits_url":"https://api.github.com/repos/uzyovoys/aggregate/commits{/sha}","git_commits_url":"https://api.github.com/repos/uzyovoys/aggregate/git/commits{/sha}","comments_url":"https://api.github.com/repos/uzyovoys/aggregate/comments{/number}","issue_comment_url":"https://api.github.com/repos/uzyovoys/aggregate/issues/comments{/number}","contents_url":"https://api.github.com/repos/uzyovoys/aggregate/contents/{+path}","compare_url":"https://api.github.com/repos/uzyovoys/aggregate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uzyovoys/aggregate/merges","archive_url":"https://api.github.com/repos/uzyovoys/aggregate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uzyovoys/aggregate/downloads","issues_url":"https://api.github.com/repos/uzyovoys/aggregate/issues{/number}","pulls_url":"https://api.github.com/repos/uzyovoys/aggregate/pulls{/number}","milestones_url":"https://api.github.com/repos/uzyovoys/aggregate/milestones{/number}","notifications_url":"https://api.github.com/repos/uzyovoys/aggregate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uzyovoys/aggregate/labels{/name}","releases_url":"https://api.github.com/repos/uzyovoys/aggregate/releases{/id}","deployments_url":"https://api.github.com/repos/uzyovoys/aggregate/deployments","created_at":"2016-02-25T13:35:37Z","updated_at":"2016-03-08T16:36:59Z","pushed_at":"2016-03-21T14:40:07Z","git_url":"git://github.com/uzyovoys/aggregate.git","ssh_url":"git@github.com:uzyovoys/aggregate.git","clone_url":"https://github.com/uzyovoys/aggregate.git","svn_url":"https://github.com/uzyovoys/aggregate","homepage":null,"size":52844,"stargazers_count":13,"watchers_count":13,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":26,"forks":13,"open_issues":26,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uzyovoys/aggregate/pulls/49"},"html":{"href":"https://github.com/uzyovoys/aggregate/pull/49"},"issue":{"href":"https://api.github.com/repos/uzyovoys/aggregate/issues/49"},"comments":{"href":"https://api.github.com/repos/uzyovoys/aggregate/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/uzyovoys/aggregate/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/uzyovoys/aggregate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uzyovoys/aggregate/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/uzyovoys/aggregate/statuses/5132ac70baf02cce5b7d49bf13ccb4ff45be7c3a"}}}}