{"action":"created","comment":{"url":"https://api.github.com/repos/bmlis/project_phoenix/pulls/comments/36641397","id":36641397,"diff_hunk":"@@ -0,0 +1,123 @@\n+#In develop version\n+#TODO: checking available cams\n+#TODO: refactor\n+#TODO: maybe parsing line args\n+\n+#First, check connected cams by running:\n+# $ ls /dev/video*\n+\n+#To display stream, have to generate .sdp file, sample in config folder\n+#Data to .sdp file are displayed by running startStream command after SDP: statement\n+\n+\n+from time import sleep\n+import subprocess\n+\n+\n+class Streamer (object):\n+    \"\"\"\n+    General class for streaming cams.\n+    \"\"\"\n+    def __init__( self, rtp = '127.0.0.1', port = 8074 ):\n+        self.rtp_address = rtp\n+        self.port = port\n+        self.camera = 0\n+        self.input_resolution = \"320x240\"\n+        self.output_resolution = \"1024x768\"\n+\n+\n+    def startStream (self, camera = 0):\n+        \"\"\"\n+        Starts stream with resolution of i/o specified in class fields.\n+        To change resolution see setResolution method.\n+\n+        :param camera: number of cam from /dev/video*\n+        :return:\n+        \"\"\"\n+        self.camera = camera\n+        self.runFF = subprocess.Popen( [    \"ffmpeg\",\n+                                            \"-s\", self.input_resolution,        #resolution\n+                                            \"-i\", \"/dev/video\" + str(camera),   #cam device number\n+                                            \"-s\", self.output_resolution,\n+                                            \"-f\", \"rtp\", \"rtp://\" + self.rtp_address + \":\" + str(self.port) ],\n+                                            stdin = subprocess.PIPE )\n+\n+\n+\n+    def DisplayStream(self):\n+        \"\"\"\n+        Helper for test and debug purposes.\n+        \"\"\"\n+        self.runVLC = subprocess.Popen( [   \"vlc\",\n+                                            \"<absolute path to .sdp file with connection config>\"])\n+\n+\n+    def stopStream (self) :\n+        \"\"\"\n+        Stop stream and kills last streaming process.\n+        :return:\n+        \"\"\"\n+        stop_output = self.runFF.kill()\n+        print stop_output","path":"core_rover/server/core/camera/FFmpegCamStream.py","position":61,"original_position":61,"commit_id":"94dfa6d78da63a6147bf852db5b4d5000f9d02bf","original_commit_id":"94dfa6d78da63a6147bf852db5b4d5000f9d02bf","user":{"login":"bmlis","id":6079729,"avatar_url":"https://avatars.githubusercontent.com/u/6079729?v=3","gravatar_id":"","url":"https://api.github.com/users/bmlis","html_url":"https://github.com/bmlis","followers_url":"https://api.github.com/users/bmlis/followers","following_url":"https://api.github.com/users/bmlis/following{/other_user}","gists_url":"https://api.github.com/users/bmlis/gists{/gist_id}","starred_url":"https://api.github.com/users/bmlis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmlis/subscriptions","organizations_url":"https://api.github.com/users/bmlis/orgs","repos_url":"https://api.github.com/users/bmlis/repos","events_url":"https://api.github.com/users/bmlis/events{/privacy}","received_events_url":"https://api.github.com/users/bmlis/received_events","type":"User","site_admin":false},"body":"Remove print, if you want logs, use log","created_at":"2015-08-10T15:05:47Z","updated_at":"2015-08-10T15:05:47Z","html_url":"https://github.com/bmlis/project_phoenix/pull/1#discussion_r36641397","pull_request_url":"https://api.github.com/repos/bmlis/project_phoenix/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/bmlis/project_phoenix/pulls/comments/36641397"},"html":{"href":"https://github.com/bmlis/project_phoenix/pull/1#discussion_r36641397"},"pull_request":{"href":"https://api.github.com/repos/bmlis/project_phoenix/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/bmlis/project_phoenix/pulls/1","id":41978230,"html_url":"https://github.com/bmlis/project_phoenix/pull/1","diff_url":"https://github.com/bmlis/project_phoenix/pull/1.diff","patch_url":"https://github.com/bmlis/project_phoenix/pull/1.patch","issue_url":"https://api.github.com/repos/bmlis/project_phoenix/issues/1","number":1,"state":"open","locked":false,"title":"Cam module added.","user":{"login":"miczyg","id":12674431,"avatar_url":"https://avatars.githubusercontent.com/u/12674431?v=3","gravatar_id":"","url":"https://api.github.com/users/miczyg","html_url":"https://github.com/miczyg","followers_url":"https://api.github.com/users/miczyg/followers","following_url":"https://api.github.com/users/miczyg/following{/other_user}","gists_url":"https://api.github.com/users/miczyg/gists{/gist_id}","starred_url":"https://api.github.com/users/miczyg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miczyg/subscriptions","organizations_url":"https://api.github.com/users/miczyg/orgs","repos_url":"https://api.github.com/users/miczyg/repos","events_url":"https://api.github.com/users/miczyg/events{/privacy}","received_events_url":"https://api.github.com/users/miczyg/received_events","type":"User","site_admin":false},"body":"First raw version of cam streaming module.","created_at":"2015-08-09T22:22:29Z","updated_at":"2015-08-10T15:05:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c8b23c169c51471bdc4073f0703c96ab852bae0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bmlis/project_phoenix/pulls/1/commits","review_comments_url":"https://api.github.com/repos/bmlis/project_phoenix/pulls/1/comments","review_comment_url":"https://api.github.com/repos/bmlis/project_phoenix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bmlis/project_phoenix/issues/1/comments","statuses_url":"https://api.github.com/repos/bmlis/project_phoenix/statuses/94dfa6d78da63a6147bf852db5b4d5000f9d02bf","head":{"label":"miczyg:master","ref":"master","sha":"94dfa6d78da63a6147bf852db5b4d5000f9d02bf","user":{"login":"miczyg","id":12674431,"avatar_url":"https://avatars.githubusercontent.com/u/12674431?v=3","gravatar_id":"","url":"https://api.github.com/users/miczyg","html_url":"https://github.com/miczyg","followers_url":"https://api.github.com/users/miczyg/followers","following_url":"https://api.github.com/users/miczyg/following{/other_user}","gists_url":"https://api.github.com/users/miczyg/gists{/gist_id}","starred_url":"https://api.github.com/users/miczyg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miczyg/subscriptions","organizations_url":"https://api.github.com/users/miczyg/orgs","repos_url":"https://api.github.com/users/miczyg/repos","events_url":"https://api.github.com/users/miczyg/events{/privacy}","received_events_url":"https://api.github.com/users/miczyg/received_events","type":"User","site_admin":false},"repo":{"id":40452220,"name":"project_phoenix","full_name":"miczyg/project_phoenix","owner":{"login":"miczyg","id":12674431,"avatar_url":"https://avatars.githubusercontent.com/u/12674431?v=3","gravatar_id":"","url":"https://api.github.com/users/miczyg","html_url":"https://github.com/miczyg","followers_url":"https://api.github.com/users/miczyg/followers","following_url":"https://api.github.com/users/miczyg/following{/other_user}","gists_url":"https://api.github.com/users/miczyg/gists{/gist_id}","starred_url":"https://api.github.com/users/miczyg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miczyg/subscriptions","organizations_url":"https://api.github.com/users/miczyg/orgs","repos_url":"https://api.github.com/users/miczyg/repos","events_url":"https://api.github.com/users/miczyg/events{/privacy}","received_events_url":"https://api.github.com/users/miczyg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/miczyg/project_phoenix","description":"Mars exploration rover project","fork":true,"url":"https://api.github.com/repos/miczyg/project_phoenix","forks_url":"https://api.github.com/repos/miczyg/project_phoenix/forks","keys_url":"https://api.github.com/repos/miczyg/project_phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miczyg/project_phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miczyg/project_phoenix/teams","hooks_url":"https://api.github.com/repos/miczyg/project_phoenix/hooks","issue_events_url":"https://api.github.com/repos/miczyg/project_phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/miczyg/project_phoenix/events","assignees_url":"https://api.github.com/repos/miczyg/project_phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/miczyg/project_phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/miczyg/project_phoenix/tags","blobs_url":"https://api.github.com/repos/miczyg/project_phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miczyg/project_phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miczyg/project_phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/miczyg/project_phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miczyg/project_phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/miczyg/project_phoenix/languages","stargazers_url":"https://api.github.com/repos/miczyg/project_phoenix/stargazers","contributors_url":"https://api.github.com/repos/miczyg/project_phoenix/contributors","subscribers_url":"https://api.github.com/repos/miczyg/project_phoenix/subscribers","subscription_url":"https://api.github.com/repos/miczyg/project_phoenix/subscription","commits_url":"https://api.github.com/repos/miczyg/project_phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/miczyg/project_phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/miczyg/project_phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/miczyg/project_phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/miczyg/project_phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/miczyg/project_phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miczyg/project_phoenix/merges","archive_url":"https://api.github.com/repos/miczyg/project_phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miczyg/project_phoenix/downloads","issues_url":"https://api.github.com/repos/miczyg/project_phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/miczyg/project_phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/miczyg/project_phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/miczyg/project_phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miczyg/project_phoenix/labels{/name}","releases_url":"https://api.github.com/repos/miczyg/project_phoenix/releases{/id}","created_at":"2015-08-09T22:08:04Z","updated_at":"2015-08-09T22:08:06Z","pushed_at":"2015-08-09T22:20:29Z","git_url":"git://github.com/miczyg/project_phoenix.git","ssh_url":"git@github.com:miczyg/project_phoenix.git","clone_url":"https://github.com/miczyg/project_phoenix.git","svn_url":"https://github.com/miczyg/project_phoenix","homepage":null,"size":94,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"bmlis:master","ref":"master","sha":"2ab82fe0146930bcadd06824d19aa6c7b7d70301","user":{"login":"bmlis","id":6079729,"avatar_url":"https://avatars.githubusercontent.com/u/6079729?v=3","gravatar_id":"","url":"https://api.github.com/users/bmlis","html_url":"https://github.com/bmlis","followers_url":"https://api.github.com/users/bmlis/followers","following_url":"https://api.github.com/users/bmlis/following{/other_user}","gists_url":"https://api.github.com/users/bmlis/gists{/gist_id}","starred_url":"https://api.github.com/users/bmlis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmlis/subscriptions","organizations_url":"https://api.github.com/users/bmlis/orgs","repos_url":"https://api.github.com/users/bmlis/repos","events_url":"https://api.github.com/users/bmlis/events{/privacy}","received_events_url":"https://api.github.com/users/bmlis/received_events","type":"User","site_admin":false},"repo":{"id":33722694,"name":"project_phoenix","full_name":"bmlis/project_phoenix","owner":{"login":"bmlis","id":6079729,"avatar_url":"https://avatars.githubusercontent.com/u/6079729?v=3","gravatar_id":"","url":"https://api.github.com/users/bmlis","html_url":"https://github.com/bmlis","followers_url":"https://api.github.com/users/bmlis/followers","following_url":"https://api.github.com/users/bmlis/following{/other_user}","gists_url":"https://api.github.com/users/bmlis/gists{/gist_id}","starred_url":"https://api.github.com/users/bmlis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmlis/subscriptions","organizations_url":"https://api.github.com/users/bmlis/orgs","repos_url":"https://api.github.com/users/bmlis/repos","events_url":"https://api.github.com/users/bmlis/events{/privacy}","received_events_url":"https://api.github.com/users/bmlis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bmlis/project_phoenix","description":"Mars exploration rover project","fork":false,"url":"https://api.github.com/repos/bmlis/project_phoenix","forks_url":"https://api.github.com/repos/bmlis/project_phoenix/forks","keys_url":"https://api.github.com/repos/bmlis/project_phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bmlis/project_phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bmlis/project_phoenix/teams","hooks_url":"https://api.github.com/repos/bmlis/project_phoenix/hooks","issue_events_url":"https://api.github.com/repos/bmlis/project_phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/bmlis/project_phoenix/events","assignees_url":"https://api.github.com/repos/bmlis/project_phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/bmlis/project_phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/bmlis/project_phoenix/tags","blobs_url":"https://api.github.com/repos/bmlis/project_phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bmlis/project_phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bmlis/project_phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/bmlis/project_phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bmlis/project_phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/bmlis/project_phoenix/languages","stargazers_url":"https://api.github.com/repos/bmlis/project_phoenix/stargazers","contributors_url":"https://api.github.com/repos/bmlis/project_phoenix/contributors","subscribers_url":"https://api.github.com/repos/bmlis/project_phoenix/subscribers","subscription_url":"https://api.github.com/repos/bmlis/project_phoenix/subscription","commits_url":"https://api.github.com/repos/bmlis/project_phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/bmlis/project_phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/bmlis/project_phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/bmlis/project_phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/bmlis/project_phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/bmlis/project_phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bmlis/project_phoenix/merges","archive_url":"https://api.github.com/repos/bmlis/project_phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bmlis/project_phoenix/downloads","issues_url":"https://api.github.com/repos/bmlis/project_phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/bmlis/project_phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/bmlis/project_phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/bmlis/project_phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bmlis/project_phoenix/labels{/name}","releases_url":"https://api.github.com/repos/bmlis/project_phoenix/releases{/id}","created_at":"2015-04-10T10:23:32Z","updated_at":"2015-04-15T14:21:57Z","pushed_at":"2015-08-09T22:22:29Z","git_url":"git://github.com/bmlis/project_phoenix.git","ssh_url":"git@github.com:bmlis/project_phoenix.git","clone_url":"https://github.com/bmlis/project_phoenix.git","svn_url":"https://github.com/bmlis/project_phoenix","homepage":null,"size":172,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bmlis/project_phoenix/pulls/1"},"html":{"href":"https://github.com/bmlis/project_phoenix/pull/1"},"issue":{"href":"https://api.github.com/repos/bmlis/project_phoenix/issues/1"},"comments":{"href":"https://api.github.com/repos/bmlis/project_phoenix/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/bmlis/project_phoenix/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/bmlis/project_phoenix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bmlis/project_phoenix/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/bmlis/project_phoenix/statuses/94dfa6d78da63a6147bf852db5b4d5000f9d02bf"}}}}