{"action":"created","comment":{"url":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/comments/227745228","pull_request_review_id":167853264,"id":227745228,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNzc0NTIyOA==","diff_hunk":"@@ -0,0 +1,565 @@\n+\n+const ngrok = \"https://74b76b4a.ngrok.io/\";\n+const filepath = \"/Users/ek/Projects/dasmitdersilbe/\";\n+//const filepath = \"/home/student/e/eukaiser/Projects/dasmitdersilbe/\";\n+const appId = \"amzn1.ask.skill.f3bc5473-cad0-42f2-8e82-47664796986d\";\n+\n+// ffmpeg -i <input-file> -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 <output-file.mp3>\n+\n+const express = require('express');\n+const bodyParser = require('body-parser');\n+const Alexa = require('alexa-sdk');\n+const _ = require('lodash');\n+const fs = require('fs');\n+const hf = require('./helper_functions.js');\n+const data = require('./data.js');\n+const db = require('./database.js')\n+\n+const app = express();\n+\n+app.use(bodyParser.json());\n+\n+app.get('/', function (req, res) {\n+  //res.send('hello');\n+  fs.createReadStream(filepath + 'test.mp3').pipe(res);\n+});\n+\n+app.get('/1', function (req, res) { fs.createReadStream(filepath + '1.mp3').pipe(res); });\n+app.get('/2', function (req, res) { fs.createReadStream(filepath + '2.mp3').pipe(res); });\n+/*app.get('/3', function (req, res) { fs.createReadStream(filepath + '3.mp3').pipe(res); });\n+app.get('/4', function (req, res) { fs.createReadStream(filepath + '4.mp3').pipe(res); });\n+app.get('/5', function (req, res) { fs.createReadStream(filepath + '5.mp3').pipe(res); });\n+app.get('/6', function (req, res) { fs.createReadStream(filepath + '6.mp3').pipe(res); });\n+app.get('/7', function (req, res) { fs.createReadStream(filepath + '7.mp3').pipe(res); });\n+app.get('/8', function (req, res) { fs.createReadStream(filepath + '8.mp3').pipe(res); });*/\n+app.get('/a', function (req, res) { fs.createReadStream(filepath + 'geburtstagstanz.mp3').pipe(res); });\n+app.get('/b', function (req, res) { fs.createReadStream(filepath + 'zau_zaubert.mp3').pipe(res); });\n+app.get('/c', function (req, res) { fs.createReadStream(filepath + 'schneller_teller.mp3').pipe(res); });\n+\n+app.post('/', function (req, res) {\n+  let context = {\n+    succeed: function (result) {\n+      res.json(result);\n+    },\n+    fail: function (error) {\n+      console.log(error);\n+    }\n+  };\n+  let alexa = Alexa.handler(req.body, context);\n+\n+  alexa.registerHandlers(\n+    handlers,\n+    start_handlers,\n+    lection_handlers,\n+    music_handlers,\n+    game_handlers\n+  );\n+\n+  alexa.appId = appId;\n+  alexa.execute();\n+});\n+\n+let server = app.listen(process.env.PORT || 4567, function () {\n+  let host = server.address().address;\n+  let port = server.address().port;\n+  console.log(\"Server listening at http://%s:%s\", host, port);\n+  console.log(\"\");\n+});\n+\n+const handlers = {\n+  \"LaunchRequest\": function () {\n+    db.addUser(this.event.session.user.userId);\n+\n+    // USE ONCE AT DATABASE CREATION\n+    //hf.createAllLectures();\n+\n+    this.handler.state = \"_START\";\n+    this.emitWithState(\"Start\");\n+  },\n+  \"Unhandled\": function () {\n+    //this.response.speak(\"Auf Wiedersehen!\").audioPlayerStop();\n+    //this.emit(\":responseReady\");\n+    this.handler.state = \"_START\";\n+    this.emitWithState(\"Start\");\n+  }\n+};\n+\n+const start_handlers = Alexa.CreateStateHandler(\"_START\", {\n+  \"Start\": function () {\n+    if(this.attributes[\"unhandled\"]){\n+      this.attributes[\"unhandled\"] = false;\n+      this.response.speak(\"Das hat leider nicht geklappt, versuchen wir es noch einmal. Möchtest du lernen, üben oder Lieder hören?\")\n+      .listen(\"Sage lernen, üben oder Lieder hören\").audioPlayerStop();\n+      this.emit(\":responseReady\");\n+    } else {\n+      this.attributes[\"unhandled\"] = false;","path":"index.js","position":95,"original_position":95,"commit_id":"3e0cdbb943edbf0945d402488d50e5c70a6825d4","original_commit_id":"05c6ec62e3528c3d804e1c5bb1b817d15b0ac7a5","user":{"login":"ek926m","id":20824075,"node_id":"MDQ6VXNlcjIwODI0MDc1","avatar_url":"https://avatars3.githubusercontent.com/u/20824075?v=4","gravatar_id":"","url":"https://api.github.com/users/ek926m","html_url":"https://github.com/ek926m","followers_url":"https://api.github.com/users/ek926m/followers","following_url":"https://api.github.com/users/ek926m/following{/other_user}","gists_url":"https://api.github.com/users/ek926m/gists{/gist_id}","starred_url":"https://api.github.com/users/ek926m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ek926m/subscriptions","organizations_url":"https://api.github.com/users/ek926m/orgs","repos_url":"https://api.github.com/users/ek926m/repos","events_url":"https://api.github.com/users/ek926m/events{/privacy}","received_events_url":"https://api.github.com/users/ek926m/received_events","type":"User","site_admin":false},"body":"How can I achieve that?","created_at":"2018-10-24T11:17:19Z","updated_at":"2018-10-24T11:17:19Z","html_url":"https://github.com/virtUOS/silbentrainer/pull/1#discussion_r227745228","pull_request_url":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/1","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/comments/227745228"},"html":{"href":"https://github.com/virtUOS/silbentrainer/pull/1#discussion_r227745228"},"pull_request":{"href":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/1"}},"in_reply_to_id":226288387},"pull_request":{"url":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/1","id":223931667,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzOTMxNjY3","html_url":"https://github.com/virtUOS/silbentrainer/pull/1","diff_url":"https://github.com/virtUOS/silbentrainer/pull/1.diff","patch_url":"https://github.com/virtUOS/silbentrainer/pull/1.patch","issue_url":"https://api.github.com/repos/virtUOS/silbentrainer/issues/1","number":1,"state":"open","locked":false,"title":"initial commit","user":{"login":"ek926m","id":20824075,"node_id":"MDQ6VXNlcjIwODI0MDc1","avatar_url":"https://avatars3.githubusercontent.com/u/20824075?v=4","gravatar_id":"","url":"https://api.github.com/users/ek926m","html_url":"https://github.com/ek926m","followers_url":"https://api.github.com/users/ek926m/followers","following_url":"https://api.github.com/users/ek926m/following{/other_user}","gists_url":"https://api.github.com/users/ek926m/gists{/gist_id}","starred_url":"https://api.github.com/users/ek926m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ek926m/subscriptions","organizations_url":"https://api.github.com/users/ek926m/orgs","repos_url":"https://api.github.com/users/ek926m/repos","events_url":"https://api.github.com/users/ek926m/events{/privacy}","received_events_url":"https://api.github.com/users/ek926m/received_events","type":"User","site_admin":false},"body":"This is my first attempt, my code is currently a bit messy. I replaced the songs with dummy files due to copyrights.","created_at":"2018-10-18T12:09:31Z","updated_at":"2018-10-24T11:17:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d35248749ad3c45bcb12c2ece534f79c6c687b3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/1/commits","review_comments_url":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/1/comments","review_comment_url":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/virtUOS/silbentrainer/issues/1/comments","statuses_url":"https://api.github.com/repos/virtUOS/silbentrainer/statuses/3e0cdbb943edbf0945d402488d50e5c70a6825d4","head":{"label":"virtUOS:initial","ref":"initial","sha":"3e0cdbb943edbf0945d402488d50e5c70a6825d4","user":{"login":"virtUOS","id":37844,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3ODQ0","avatar_url":"https://avatars3.githubusercontent.com/u/37844?v=4","gravatar_id":"","url":"https://api.github.com/users/virtUOS","html_url":"https://github.com/virtUOS","followers_url":"https://api.github.com/users/virtUOS/followers","following_url":"https://api.github.com/users/virtUOS/following{/other_user}","gists_url":"https://api.github.com/users/virtUOS/gists{/gist_id}","starred_url":"https://api.github.com/users/virtUOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virtUOS/subscriptions","organizations_url":"https://api.github.com/users/virtUOS/orgs","repos_url":"https://api.github.com/users/virtUOS/repos","events_url":"https://api.github.com/users/virtUOS/events{/privacy}","received_events_url":"https://api.github.com/users/virtUOS/received_events","type":"Organization","site_admin":false},"repo":{"id":149763367,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk3NjMzNjc=","name":"silbentrainer","full_name":"virtUOS/silbentrainer","private":false,"owner":{"login":"virtUOS","id":37844,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3ODQ0","avatar_url":"https://avatars3.githubusercontent.com/u/37844?v=4","gravatar_id":"","url":"https://api.github.com/users/virtUOS","html_url":"https://github.com/virtUOS","followers_url":"https://api.github.com/users/virtUOS/followers","following_url":"https://api.github.com/users/virtUOS/following{/other_user}","gists_url":"https://api.github.com/users/virtUOS/gists{/gist_id}","starred_url":"https://api.github.com/users/virtUOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virtUOS/subscriptions","organizations_url":"https://api.github.com/users/virtUOS/orgs","repos_url":"https://api.github.com/users/virtUOS/repos","events_url":"https://api.github.com/users/virtUOS/events{/privacy}","received_events_url":"https://api.github.com/users/virtUOS/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/virtUOS/silbentrainer","description":"Alexa Skill \"Die Sache mit der Silbe\", als kleine Lern-App für Sprachassistenzsysteme","fork":false,"url":"https://api.github.com/repos/virtUOS/silbentrainer","forks_url":"https://api.github.com/repos/virtUOS/silbentrainer/forks","keys_url":"https://api.github.com/repos/virtUOS/silbentrainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/virtUOS/silbentrainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/virtUOS/silbentrainer/teams","hooks_url":"https://api.github.com/repos/virtUOS/silbentrainer/hooks","issue_events_url":"https://api.github.com/repos/virtUOS/silbentrainer/issues/events{/number}","events_url":"https://api.github.com/repos/virtUOS/silbentrainer/events","assignees_url":"https://api.github.com/repos/virtUOS/silbentrainer/assignees{/user}","branches_url":"https://api.github.com/repos/virtUOS/silbentrainer/branches{/branch}","tags_url":"https://api.github.com/repos/virtUOS/silbentrainer/tags","blobs_url":"https://api.github.com/repos/virtUOS/silbentrainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/virtUOS/silbentrainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/virtUOS/silbentrainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/virtUOS/silbentrainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/virtUOS/silbentrainer/statuses/{sha}","languages_url":"https://api.github.com/repos/virtUOS/silbentrainer/languages","stargazers_url":"https://api.github.com/repos/virtUOS/silbentrainer/stargazers","contributors_url":"https://api.github.com/repos/virtUOS/silbentrainer/contributors","subscribers_url":"https://api.github.com/repos/virtUOS/silbentrainer/subscribers","subscription_url":"https://api.github.com/repos/virtUOS/silbentrainer/subscription","commits_url":"https://api.github.com/repos/virtUOS/silbentrainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/virtUOS/silbentrainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/virtUOS/silbentrainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/virtUOS/silbentrainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/virtUOS/silbentrainer/contents/{+path}","compare_url":"https://api.github.com/repos/virtUOS/silbentrainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/virtUOS/silbentrainer/merges","archive_url":"https://api.github.com/repos/virtUOS/silbentrainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/virtUOS/silbentrainer/downloads","issues_url":"https://api.github.com/repos/virtUOS/silbentrainer/issues{/number}","pulls_url":"https://api.github.com/repos/virtUOS/silbentrainer/pulls{/number}","milestones_url":"https://api.github.com/repos/virtUOS/silbentrainer/milestones{/number}","notifications_url":"https://api.github.com/repos/virtUOS/silbentrainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/virtUOS/silbentrainer/labels{/name}","releases_url":"https://api.github.com/repos/virtUOS/silbentrainer/releases{/id}","deployments_url":"https://api.github.com/repos/virtUOS/silbentrainer/deployments","created_at":"2018-09-21T12:55:11Z","updated_at":"2018-09-21T12:55:14Z","pushed_at":"2018-10-18T12:35:27Z","git_url":"git://github.com/virtUOS/silbentrainer.git","ssh_url":"git@github.com:virtUOS/silbentrainer.git","clone_url":"https://github.com/virtUOS/silbentrainer.git","svn_url":"https://github.com/virtUOS/silbentrainer","homepage":null,"size":1513,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"virtUOS:master","ref":"master","sha":"9b2bcf823aeb74f6bfdd4e70efbf271330278d88","user":{"login":"virtUOS","id":37844,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3ODQ0","avatar_url":"https://avatars3.githubusercontent.com/u/37844?v=4","gravatar_id":"","url":"https://api.github.com/users/virtUOS","html_url":"https://github.com/virtUOS","followers_url":"https://api.github.com/users/virtUOS/followers","following_url":"https://api.github.com/users/virtUOS/following{/other_user}","gists_url":"https://api.github.com/users/virtUOS/gists{/gist_id}","starred_url":"https://api.github.com/users/virtUOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virtUOS/subscriptions","organizations_url":"https://api.github.com/users/virtUOS/orgs","repos_url":"https://api.github.com/users/virtUOS/repos","events_url":"https://api.github.com/users/virtUOS/events{/privacy}","received_events_url":"https://api.github.com/users/virtUOS/received_events","type":"Organization","site_admin":false},"repo":{"id":149763367,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk3NjMzNjc=","name":"silbentrainer","full_name":"virtUOS/silbentrainer","private":false,"owner":{"login":"virtUOS","id":37844,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3ODQ0","avatar_url":"https://avatars3.githubusercontent.com/u/37844?v=4","gravatar_id":"","url":"https://api.github.com/users/virtUOS","html_url":"https://github.com/virtUOS","followers_url":"https://api.github.com/users/virtUOS/followers","following_url":"https://api.github.com/users/virtUOS/following{/other_user}","gists_url":"https://api.github.com/users/virtUOS/gists{/gist_id}","starred_url":"https://api.github.com/users/virtUOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virtUOS/subscriptions","organizations_url":"https://api.github.com/users/virtUOS/orgs","repos_url":"https://api.github.com/users/virtUOS/repos","events_url":"https://api.github.com/users/virtUOS/events{/privacy}","received_events_url":"https://api.github.com/users/virtUOS/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/virtUOS/silbentrainer","description":"Alexa Skill \"Die Sache mit der Silbe\", als kleine Lern-App für Sprachassistenzsysteme","fork":false,"url":"https://api.github.com/repos/virtUOS/silbentrainer","forks_url":"https://api.github.com/repos/virtUOS/silbentrainer/forks","keys_url":"https://api.github.com/repos/virtUOS/silbentrainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/virtUOS/silbentrainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/virtUOS/silbentrainer/teams","hooks_url":"https://api.github.com/repos/virtUOS/silbentrainer/hooks","issue_events_url":"https://api.github.com/repos/virtUOS/silbentrainer/issues/events{/number}","events_url":"https://api.github.com/repos/virtUOS/silbentrainer/events","assignees_url":"https://api.github.com/repos/virtUOS/silbentrainer/assignees{/user}","branches_url":"https://api.github.com/repos/virtUOS/silbentrainer/branches{/branch}","tags_url":"https://api.github.com/repos/virtUOS/silbentrainer/tags","blobs_url":"https://api.github.com/repos/virtUOS/silbentrainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/virtUOS/silbentrainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/virtUOS/silbentrainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/virtUOS/silbentrainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/virtUOS/silbentrainer/statuses/{sha}","languages_url":"https://api.github.com/repos/virtUOS/silbentrainer/languages","stargazers_url":"https://api.github.com/repos/virtUOS/silbentrainer/stargazers","contributors_url":"https://api.github.com/repos/virtUOS/silbentrainer/contributors","subscribers_url":"https://api.github.com/repos/virtUOS/silbentrainer/subscribers","subscription_url":"https://api.github.com/repos/virtUOS/silbentrainer/subscription","commits_url":"https://api.github.com/repos/virtUOS/silbentrainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/virtUOS/silbentrainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/virtUOS/silbentrainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/virtUOS/silbentrainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/virtUOS/silbentrainer/contents/{+path}","compare_url":"https://api.github.com/repos/virtUOS/silbentrainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/virtUOS/silbentrainer/merges","archive_url":"https://api.github.com/repos/virtUOS/silbentrainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/virtUOS/silbentrainer/downloads","issues_url":"https://api.github.com/repos/virtUOS/silbentrainer/issues{/number}","pulls_url":"https://api.github.com/repos/virtUOS/silbentrainer/pulls{/number}","milestones_url":"https://api.github.com/repos/virtUOS/silbentrainer/milestones{/number}","notifications_url":"https://api.github.com/repos/virtUOS/silbentrainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/virtUOS/silbentrainer/labels{/name}","releases_url":"https://api.github.com/repos/virtUOS/silbentrainer/releases{/id}","deployments_url":"https://api.github.com/repos/virtUOS/silbentrainer/deployments","created_at":"2018-09-21T12:55:11Z","updated_at":"2018-09-21T12:55:14Z","pushed_at":"2018-10-18T12:35:27Z","git_url":"git://github.com/virtUOS/silbentrainer.git","ssh_url":"git@github.com:virtUOS/silbentrainer.git","clone_url":"https://github.com/virtUOS/silbentrainer.git","svn_url":"https://github.com/virtUOS/silbentrainer","homepage":null,"size":1513,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/1"},"html":{"href":"https://github.com/virtUOS/silbentrainer/pull/1"},"issue":{"href":"https://api.github.com/repos/virtUOS/silbentrainer/issues/1"},"comments":{"href":"https://api.github.com/repos/virtUOS/silbentrainer/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/virtUOS/silbentrainer/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/virtUOS/silbentrainer/statuses/3e0cdbb943edbf0945d402488d50e5c70a6825d4"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"ek926m"}}