Commit 87751f875797482a6572eccaf46400729ccbfc4c
1 parent
9502ba91
Exists in
master
and in
4 other branches
Response to queue filename and filesize
Showing
1 changed file
with
12 additions
and
2 deletions
Show diff stats
core/renderer.py
| ... | ... | @@ -12,6 +12,7 @@ Author: Wesnydy Lima Ribeiro |
| 12 | 12 | E-Mail: wesnydy@lavid.ufpb.br |
| 13 | 13 | """ |
| 14 | 14 | |
| 15 | +import json | |
| 15 | 16 | import os |
| 16 | 17 | import pika |
| 17 | 18 | import PikaManager |
| ... | ... | @@ -43,6 +44,8 @@ PATH_SCREENS = "/storage/frames/" |
| 43 | 44 | |
| 44 | 45 | # Status of renderer to process new requests. Answer one request at a time. |
| 45 | 46 | worker_available = True |
| 47 | +# Path of libras video. | |
| 48 | +libras_video = None | |
| 46 | 49 | # pyvirtualdisplay instance |
| 47 | 50 | display = None |
| 48 | 51 | # ffmpeg process instance |
| ... | ... | @@ -88,7 +91,7 @@ def start_ffmpeg(id): |
| 88 | 91 | id : string |
| 89 | 92 | Identification of request. |
| 90 | 93 | """ |
| 91 | - global ffmpeg, display | |
| 94 | + global ffmpeg, display, libras_video | |
| 92 | 95 | # logger.info("Starting ffmpeg") |
| 93 | 96 | libras_video = os.path.join(PATH_LIBRAS, id + ".mp4") |
| 94 | 97 | ffmpeg = subprocess.Popen( |
| ... | ... | @@ -164,7 +167,14 @@ def run(ch, method, properties, body): |
| 164 | 167 | start_new_thread(send_to_video_creator, (properties.correlation_id, body)) |
| 165 | 168 | start_video_creator(properties.correlation_id) |
| 166 | 169 | |
| 167 | - body = properties.correlation_id + ".mp4" | |
| 170 | + try: | |
| 171 | + filesize = os.path.getsize(libras_video) | |
| 172 | + except: | |
| 173 | + filesize = 0 | |
| 174 | + | |
| 175 | + body = {"file": properties.correlation_id+".mp4", "size": filesize} | |
| 176 | + json.dumps(body) | |
| 177 | + | |
| 168 | 178 | manager.send_to_queue("videos", body, properties) |
| 169 | 179 | |
| 170 | 180 | clean(properties.correlation_id) | ... | ... |