{"action":"created","comment":{"url":"https://api.github.com/repos/kaltura/liveDVR/pulls/comments/53563946","id":53563946,"diff_hunk":"@@ -0,0 +1,91 @@\n+/**\n+ * Created by elad.benedict on 8/26/2015.\n+ */\n+\n+var Q = require('q');\n+var _ = require('underscore');\n+var config = require('../../common/Configuration');\n+//var logger = require('../../../common/logger/logger.js')(module);\n+var NetworkClient=require('../NetworkClient.js');\n+var url = require('url');\n+var BaseAdapter=require('./BaseAdapter.js').BaseAdapter;\n+var util=require('util');\n+\n+var entryCache = require('./EntryCache.js');\n+var WowzaStreamInfo = require('./WowzaStreamInfo.js');\n+\n+\n+var applicationName=config.get('mediaServer').applicationName;\n+var hostname = config.get('mediaServer').hostname;\n+var port = config.get('mediaServer').port;\n+var wowzaUrl=\"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/\"+applicationName+\"/instances\";\n+//var wowzaUrl2=\"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/\"+applicationName+\"/instances/_definst_/incomingstreams/\"+entryId+\"/monitoring/current”\n+var backendClient=require('../BackendClientFactory.js').getBackendClient();\n+\n+\n+\n+function WowzaAdapter() {\n+\n+    BaseAdapter.call(this);\n+\n+}\n+util.inherits(WowzaAdapter,BaseAdapter);\n+\n+\n+\n+WowzaAdapter.prototype.getLiveEntries=function() {\n+\n+    var self=this;\n+  //  BaseAdapter.prototype.getLiveEntries.call(this);\n+\n+    return NetworkClient.read( {\n+            url:wowzaUrl,\n+            json:true\n+        })\n+        .then(function(res) {\n+\n+            if (res.instanceList.length==0) {\n+                return [];\n+            }\n+\n+\n+            var promises= _.map(res.instanceList[0].incomingStreams,function(stream) {\n+                var entryId = \"\";\n+\n+                var i = stream.name.lastIndexOf('_');\n+                if (i != -1) {\n+                    entryId = stream.name.substr(0, i);\n+                }\n+\n+                var cachedEntryInfo = self.entries[entryId];\n+                if (cachedEntryInfo) {\n+                    return Q.resolve(cachedEntryInfo);\n+                }\n+\n+                return backendClient.getEntries([entryId]).then(function (entryArr) {\n+\n+                    var newEntry=entryArr[0];\n+                    self.entries[entryId] = newEntry;\n+\n+                    newEntry.getStreamInfo=function() {\n+                        return  new WowzaStreamInfo(entryId, newEntry.flavorParamsIds, stream.sourceIp);\n+                    };\n+\n+                    return Q.resolve(newEntry);\n+                });\n+\n+            });\n+\n+           return Q.all(promises).then(function(res) {\n+               return Q.resolve(res);\n+           })\n+","path":"lib/Adapters/WowzaAdapter.js","position":82,"original_position":82,"commit_id":"faa49b10b56e4e57f11fa0e4464e4c1c495e71d6","original_commit_id":"faa49b10b56e4e57f11fa0e4464e4c1c495e71d6","user":{"login":"gadyaari","id":15606217,"avatar_url":"https://avatars.githubusercontent.com/u/15606217?v=3","gravatar_id":"","url":"https://api.github.com/users/gadyaari","html_url":"https://github.com/gadyaari","followers_url":"https://api.github.com/users/gadyaari/followers","following_url":"https://api.github.com/users/gadyaari/following{/other_user}","gists_url":"https://api.github.com/users/gadyaari/gists{/gist_id}","starred_url":"https://api.github.com/users/gadyaari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gadyaari/subscriptions","organizations_url":"https://api.github.com/users/gadyaari/orgs","repos_url":"https://api.github.com/users/gadyaari/repos","events_url":"https://api.github.com/users/gadyaari/events{/privacy}","received_events_url":"https://api.github.com/users/gadyaari/received_events","type":"User","site_admin":false},"body":"Is the \"then\" really necessary? Q.all returns correctly only if ALL promises are fulfilled so why do you need to call return Q.resolve as well?","created_at":"2016-02-21T09:19:34Z","updated_at":"2016-02-21T09:19:34Z","html_url":"https://github.com/kaltura/liveDVR/pull/114#discussion_r53563946","pull_request_url":"https://api.github.com/repos/kaltura/liveDVR/pulls/114","_links":{"self":{"href":"https://api.github.com/repos/kaltura/liveDVR/pulls/comments/53563946"},"html":{"href":"https://github.com/kaltura/liveDVR/pull/114#discussion_r53563946"},"pull_request":{"href":"https://api.github.com/repos/kaltura/liveDVR/pulls/114"}}},"pull_request":{"url":"https://api.github.com/repos/kaltura/liveDVR/pulls/114","id":59849191,"html_url":"https://github.com/kaltura/liveDVR/pull/114","diff_url":"https://github.com/kaltura/liveDVR/pull/114.diff","patch_url":"https://github.com/kaltura/liveDVR/pull/114.patch","issue_url":"https://api.github.com/repos/kaltura/liveDVR/issues/114","number":114,"state":"open","locked":false,"title":"Plat 5021 no smil refactor","user":{"login":"kalturaguy","id":7511565,"avatar_url":"https://avatars.githubusercontent.com/u/7511565?v=3","gravatar_id":"","url":"https://api.github.com/users/kalturaguy","html_url":"https://github.com/kalturaguy","followers_url":"https://api.github.com/users/kalturaguy/followers","following_url":"https://api.github.com/users/kalturaguy/following{/other_user}","gists_url":"https://api.github.com/users/kalturaguy/gists{/gist_id}","starred_url":"https://api.github.com/users/kalturaguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalturaguy/subscriptions","organizations_url":"https://api.github.com/users/kalturaguy/orgs","repos_url":"https://api.github.com/users/kalturaguy/repos","events_url":"https://api.github.com/users/kalturaguy/events{/privacy}","received_events_url":"https://api.github.com/users/kalturaguy/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-18T19:22:20Z","updated_at":"2016-02-21T09:19:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"78fe50d80178a812a8b1e32320ef6f723956e2e3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kaltura/liveDVR/pulls/114/commits","review_comments_url":"https://api.github.com/repos/kaltura/liveDVR/pulls/114/comments","review_comment_url":"https://api.github.com/repos/kaltura/liveDVR/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kaltura/liveDVR/issues/114/comments","statuses_url":"https://api.github.com/repos/kaltura/liveDVR/statuses/faa49b10b56e4e57f11fa0e4464e4c1c495e71d6","head":{"label":"kaltura:PLAT-5021-no-smil-refactor","ref":"PLAT-5021-no-smil-refactor","sha":"faa49b10b56e4e57f11fa0e4464e4c1c495e71d6","user":{"login":"kaltura","id":319096,"avatar_url":"https://avatars.githubusercontent.com/u/319096?v=3","gravatar_id":"","url":"https://api.github.com/users/kaltura","html_url":"https://github.com/kaltura","followers_url":"https://api.github.com/users/kaltura/followers","following_url":"https://api.github.com/users/kaltura/following{/other_user}","gists_url":"https://api.github.com/users/kaltura/gists{/gist_id}","starred_url":"https://api.github.com/users/kaltura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaltura/subscriptions","organizations_url":"https://api.github.com/users/kaltura/orgs","repos_url":"https://api.github.com/users/kaltura/repos","events_url":"https://api.github.com/users/kaltura/events{/privacy}","received_events_url":"https://api.github.com/users/kaltura/received_events","type":"Organization","site_admin":false},"repo":{"id":40581240,"name":"liveDVR","full_name":"kaltura/liveDVR","owner":{"login":"kaltura","id":319096,"avatar_url":"https://avatars.githubusercontent.com/u/319096?v=3","gravatar_id":"","url":"https://api.github.com/users/kaltura","html_url":"https://github.com/kaltura","followers_url":"https://api.github.com/users/kaltura/followers","following_url":"https://api.github.com/users/kaltura/following{/other_user}","gists_url":"https://api.github.com/users/kaltura/gists{/gist_id}","starred_url":"https://api.github.com/users/kaltura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaltura/subscriptions","organizations_url":"https://api.github.com/users/kaltura/orgs","repos_url":"https://api.github.com/users/kaltura/repos","events_url":"https://api.github.com/users/kaltura/events{/privacy}","received_events_url":"https://api.github.com/users/kaltura/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kaltura/liveDVR","description":"DVR implementation built on top of live streams","fork":false,"url":"https://api.github.com/repos/kaltura/liveDVR","forks_url":"https://api.github.com/repos/kaltura/liveDVR/forks","keys_url":"https://api.github.com/repos/kaltura/liveDVR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaltura/liveDVR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaltura/liveDVR/teams","hooks_url":"https://api.github.com/repos/kaltura/liveDVR/hooks","issue_events_url":"https://api.github.com/repos/kaltura/liveDVR/issues/events{/number}","events_url":"https://api.github.com/repos/kaltura/liveDVR/events","assignees_url":"https://api.github.com/repos/kaltura/liveDVR/assignees{/user}","branches_url":"https://api.github.com/repos/kaltura/liveDVR/branches{/branch}","tags_url":"https://api.github.com/repos/kaltura/liveDVR/tags","blobs_url":"https://api.github.com/repos/kaltura/liveDVR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaltura/liveDVR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaltura/liveDVR/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaltura/liveDVR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaltura/liveDVR/statuses/{sha}","languages_url":"https://api.github.com/repos/kaltura/liveDVR/languages","stargazers_url":"https://api.github.com/repos/kaltura/liveDVR/stargazers","contributors_url":"https://api.github.com/repos/kaltura/liveDVR/contributors","subscribers_url":"https://api.github.com/repos/kaltura/liveDVR/subscribers","subscription_url":"https://api.github.com/repos/kaltura/liveDVR/subscription","commits_url":"https://api.github.com/repos/kaltura/liveDVR/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaltura/liveDVR/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaltura/liveDVR/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaltura/liveDVR/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaltura/liveDVR/contents/{+path}","compare_url":"https://api.github.com/repos/kaltura/liveDVR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaltura/liveDVR/merges","archive_url":"https://api.github.com/repos/kaltura/liveDVR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaltura/liveDVR/downloads","issues_url":"https://api.github.com/repos/kaltura/liveDVR/issues{/number}","pulls_url":"https://api.github.com/repos/kaltura/liveDVR/pulls{/number}","milestones_url":"https://api.github.com/repos/kaltura/liveDVR/milestones{/number}","notifications_url":"https://api.github.com/repos/kaltura/liveDVR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaltura/liveDVR/labels{/name}","releases_url":"https://api.github.com/repos/kaltura/liveDVR/releases{/id}","deployments_url":"https://api.github.com/repos/kaltura/liveDVR/deployments","created_at":"2015-08-12T05:08:28Z","updated_at":"2016-01-13T11:00:36Z","pushed_at":"2016-02-21T07:55:55Z","git_url":"git://github.com/kaltura/liveDVR.git","ssh_url":"git@github.com:kaltura/liveDVR.git","clone_url":"https://github.com/kaltura/liveDVR.git","svn_url":"https://github.com/kaltura/liveDVR","homepage":null,"size":39542,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":11,"forks":2,"open_issues":11,"watchers":1,"default_branch":"master"}},"base":{"label":"kaltura:PLAT-5021-no-smil","ref":"PLAT-5021-no-smil","sha":"c2913e943c992cb77a8c8e11f390ca4ce790a22d","user":{"login":"kaltura","id":319096,"avatar_url":"https://avatars.githubusercontent.com/u/319096?v=3","gravatar_id":"","url":"https://api.github.com/users/kaltura","html_url":"https://github.com/kaltura","followers_url":"https://api.github.com/users/kaltura/followers","following_url":"https://api.github.com/users/kaltura/following{/other_user}","gists_url":"https://api.github.com/users/kaltura/gists{/gist_id}","starred_url":"https://api.github.com/users/kaltura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaltura/subscriptions","organizations_url":"https://api.github.com/users/kaltura/orgs","repos_url":"https://api.github.com/users/kaltura/repos","events_url":"https://api.github.com/users/kaltura/events{/privacy}","received_events_url":"https://api.github.com/users/kaltura/received_events","type":"Organization","site_admin":false},"repo":{"id":40581240,"name":"liveDVR","full_name":"kaltura/liveDVR","owner":{"login":"kaltura","id":319096,"avatar_url":"https://avatars.githubusercontent.com/u/319096?v=3","gravatar_id":"","url":"https://api.github.com/users/kaltura","html_url":"https://github.com/kaltura","followers_url":"https://api.github.com/users/kaltura/followers","following_url":"https://api.github.com/users/kaltura/following{/other_user}","gists_url":"https://api.github.com/users/kaltura/gists{/gist_id}","starred_url":"https://api.github.com/users/kaltura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaltura/subscriptions","organizations_url":"https://api.github.com/users/kaltura/orgs","repos_url":"https://api.github.com/users/kaltura/repos","events_url":"https://api.github.com/users/kaltura/events{/privacy}","received_events_url":"https://api.github.com/users/kaltura/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kaltura/liveDVR","description":"DVR implementation built on top of live streams","fork":false,"url":"https://api.github.com/repos/kaltura/liveDVR","forks_url":"https://api.github.com/repos/kaltura/liveDVR/forks","keys_url":"https://api.github.com/repos/kaltura/liveDVR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaltura/liveDVR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaltura/liveDVR/teams","hooks_url":"https://api.github.com/repos/kaltura/liveDVR/hooks","issue_events_url":"https://api.github.com/repos/kaltura/liveDVR/issues/events{/number}","events_url":"https://api.github.com/repos/kaltura/liveDVR/events","assignees_url":"https://api.github.com/repos/kaltura/liveDVR/assignees{/user}","branches_url":"https://api.github.com/repos/kaltura/liveDVR/branches{/branch}","tags_url":"https://api.github.com/repos/kaltura/liveDVR/tags","blobs_url":"https://api.github.com/repos/kaltura/liveDVR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaltura/liveDVR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaltura/liveDVR/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaltura/liveDVR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaltura/liveDVR/statuses/{sha}","languages_url":"https://api.github.com/repos/kaltura/liveDVR/languages","stargazers_url":"https://api.github.com/repos/kaltura/liveDVR/stargazers","contributors_url":"https://api.github.com/repos/kaltura/liveDVR/contributors","subscribers_url":"https://api.github.com/repos/kaltura/liveDVR/subscribers","subscription_url":"https://api.github.com/repos/kaltura/liveDVR/subscription","commits_url":"https://api.github.com/repos/kaltura/liveDVR/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaltura/liveDVR/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaltura/liveDVR/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaltura/liveDVR/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaltura/liveDVR/contents/{+path}","compare_url":"https://api.github.com/repos/kaltura/liveDVR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaltura/liveDVR/merges","archive_url":"https://api.github.com/repos/kaltura/liveDVR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaltura/liveDVR/downloads","issues_url":"https://api.github.com/repos/kaltura/liveDVR/issues{/number}","pulls_url":"https://api.github.com/repos/kaltura/liveDVR/pulls{/number}","milestones_url":"https://api.github.com/repos/kaltura/liveDVR/milestones{/number}","notifications_url":"https://api.github.com/repos/kaltura/liveDVR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaltura/liveDVR/labels{/name}","releases_url":"https://api.github.com/repos/kaltura/liveDVR/releases{/id}","deployments_url":"https://api.github.com/repos/kaltura/liveDVR/deployments","created_at":"2015-08-12T05:08:28Z","updated_at":"2016-01-13T11:00:36Z","pushed_at":"2016-02-21T07:55:55Z","git_url":"git://github.com/kaltura/liveDVR.git","ssh_url":"git@github.com:kaltura/liveDVR.git","clone_url":"https://github.com/kaltura/liveDVR.git","svn_url":"https://github.com/kaltura/liveDVR","homepage":null,"size":39542,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":11,"forks":2,"open_issues":11,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kaltura/liveDVR/pulls/114"},"html":{"href":"https://github.com/kaltura/liveDVR/pull/114"},"issue":{"href":"https://api.github.com/repos/kaltura/liveDVR/issues/114"},"comments":{"href":"https://api.github.com/repos/kaltura/liveDVR/issues/114/comments"},"review_comments":{"href":"https://api.github.com/repos/kaltura/liveDVR/pulls/114/comments"},"review_comment":{"href":"https://api.github.com/repos/kaltura/liveDVR/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kaltura/liveDVR/pulls/114/commits"},"statuses":{"href":"https://api.github.com/repos/kaltura/liveDVR/statuses/faa49b10b56e4e57f11fa0e4464e4c1c495e71d6"}}}}