Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding endpoint to check video recording started * Exposing port
- Loading branch information
Showing
4 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from http.server import BaseHTTPRequestHandler,HTTPServer | ||
from os import environ | ||
import json | ||
import psutil | ||
|
||
video_ready_port = environ.get('VIDEO_READY_PORT', 9000) | ||
|
||
class Handler(BaseHTTPRequestHandler): | ||
|
||
def do_GET(self): | ||
video_ready = "ffmpeg" in (p.name().lower() for p in psutil.process_iter()) | ||
response_code = 200 if video_ready else 404 | ||
response_text = "ready" if video_ready else "not ready" | ||
self.send_response(response_code) | ||
self.end_headers() | ||
self.wfile.write(json.dumps({'status': response_text}).encode('utf-8')) | ||
|
||
httpd = HTTPServer( ('0.0.0.0', video_ready_port), Handler ) | ||
httpd.serve_forever() |