diff --git a/core/extractor.py b/core/extractor.py index f05c94d..9a7201b 100755 --- a/core/extractor.py +++ b/core/extractor.py @@ -15,33 +15,35 @@ Author: Wesnydy Lima Ribeiro E-Mail: wesnydy@lavid.ufpb.br """ +import json +import logging import os import pika import PikaManager import pysrt -import json -import logging #Logging from thread import start_new_thread from time import sleep from urllib import urlretrieve -logger = logging.getLogger('extractor') +# Logging configuration. +logger = logging.getLogger("extractor") logger.setLevel(logging.DEBUG) -fh = logging.FileHandler('../log/extractor.log') +fh = logging.FileHandler("../log/extractor.log") fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.ERROR) -formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') +formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") fh.setFormatter(formatter) ch.setFormatter(formatter) logger.addHandler(fh) logger.addHandler(ch) +# Manager of queues connections. manager = PikaManager.PikaManager("150.165.205.10", "test", "test") def run(ch, method, properties, body): @@ -56,46 +58,45 @@ def run(ch, method, properties, body): Callback method. properties : object Message containing a set of 14 properties. - body : json object - Informations received from queue. + body : string + Json string containing the necessary arguments for workers. """ - logger.info("Processando a requisição " + properties.correlation_id.encode("utf-8")) - # body it's a json that contains subtitle file + logger.info("processing request " + properties.correlation_id.encode("utf-8")) body = json.loads(body) try: - # Try to download the subtitle - logger.info("Obtendo o arquivo de legendas") + logger.info("Downloading subtitle") filename = urlretrieve(body["subtitle"].encode("utf-8"))[0] except IOError, e: - logger.error("Falha ao obter o arquivo de legendas") - # Returns if can't download the subtitle file + logger.error("Download of subtitle fail") return + try: + # Tries to open file with utf-8 encoding. subtitle = pysrt.open(filename) except UnicodeDecodeError: - subtitle = pysrt.open(filename, encoding='iso-8859-1') + # Tries to open file with iso-8859-1 encoding if utf-8 encoding fails. + subtitle = pysrt.open(filename, encoding="iso-8859-1") + index = 1 - # Initialize the extraction of subtitles print ("Extracting...") - logger.info("Extraindo legendas do arquivo") + logger.info("Extracting subtitles from file") for sub in subtitle: pts = calculate_ms(str(sub.start)) - message = {'text': sub.text.encode("utf-8"), 'pts': pts, 'index': index} + message = {"text": sub.text.encode("utf-8"), "pts": pts, "index": index} manager.send_to_queue("extractions", message, properties) index += 1 - # Flag indicating the end of extraction - body['control-message'] = "FINALIZE" - body['pts'] = -1 - body['index'] = index - #Number of subtitle extracted - logger.info(str(index-1) + " Legendas extraídas com sucesso") - # Clean temporary file - logger.info("Removendo arquivo temporário") + # Control message indicating the end of subtitles. + body["control-message"] = "FINALIZE" + body["pts"] = -1 + body["index"] = index + logger.info(str(index-1) + " Subtitles extracted successfully") + + logger.info("Cleaning temp files") os.remove(filename) - # Send the body to the queue - logger.info("Enviando para a fila de extrações") + + logger.info("Sending control message to the queue") manager.send_to_queue("extractions", body, properties) - print ("Sucess") + print ("Ok") def calculate_ms(time_in): """ @@ -111,8 +112,8 @@ def calculate_ms(time_in): number The timestamp in milliseconds. """ - time = time_in.split(":") - time = time[:2] + time[2].split(",") + time = time_in.split(':') + time = time[:2] + time[2].split(',') hour = int(time[0]) * 3600000 minute = int(time[1]) * 60000 second = int(time[2]) * 1000 diff --git a/core/mixer.py b/core/mixer.py index 735996e..f7d2afc 100755 --- a/core/mixer.py +++ b/core/mixer.py @@ -15,19 +15,18 @@ Author: Wesnydy Lima Ribeiro E-Mail: wesnydy@lavid.ufpb.br """ +import json +import logging import os import pika -import json import PikaManager -import logging #Logging +import subprocess -from subprocess import call, Popen, PIPE from thread import start_new_thread from time import sleep from urllib import urlretrieve -PATH_MIXED_VIDEO = os.getenv("VLIBRAS_VIDEO_MIXED") - +# Logging configuration. logger = logging.getLogger('mixer') logger.setLevel(logging.DEBUG) @@ -44,8 +43,11 @@ ch.setFormatter(formatter) logger.addHandler(fh) logger.addHandler(ch) +# Manager of queues connections. manager = PikaManager.PikaManager("150.165.205.10", "test", "test") +PATH_MIXED_VIDEO = os.getenv("VLIBRAS_VIDEO_MIXED") + def main_video_height(main_video): """ Extract height information of video. @@ -60,20 +62,27 @@ def main_video_height(main_video): string None if failed to extract info. The height if extraction has been successfuly. """ - logger.info("Extraindo informações de resolução do vídeo original") + logger.info("Extracting resolution of main video") try: # Obtains the main video height using ffprobe - pipe = Popen( - ['ffprobe', '-v', 'error', '-select_streams', 'v:0', '-print_format', - 'json', '-show_entries', 'stream=height', main_video], - stdout=PIPE, shell=False) + ffprobe = subprocess.Popen( + [ + "ffprobe", + "-loglevel", "error", + "-select_streams", "v:0", + "-print_format", "json", + "-show_entries", 'stream=height', + main_video + ], + stdout=subprocess.PIPE, + shell=False + ) # The results comes in a json - video_height = json.loads(pipe.communicate()[0]) + video_height = json.loads(ffprobe.communicate()[0]) # Returns the height obtained return video_height['streams'][0]['height'] except OSError as ex: - logger.error("Impossível extrair informações, resolução padrão será utilizada") - # If an error occurs, return empty + logger.error("Error when extracting resolution, default will be used") return None def secondary_video_heigth(main_height, window_size): @@ -92,7 +101,7 @@ def secondary_video_heigth(main_height, window_size): number The height of window. """ - logger.info("Calculando a resolução da janela de libras") + logger.info("Calculating the resolution of the libras window") # Set the default height of main video if a height is not given if main_height is None: main_height = 324 @@ -120,7 +129,7 @@ def secondary_video_position(window_position): string The configurations of position of window. """ - logger.info("Definindo a posição da janela de libras") + logger.info("Defining the position of the libras window") # Overlap the window at top Left on main video if window_position == 'top_left': return "10:10" @@ -146,19 +155,16 @@ def run(ch, method, properties, body): Callback method. properties : object Message containing a set of 14 properties. - body : json object - Informations received from queue. + body : string + Json string containing the necessary arguments for workers. """ - logger.info("Processando a requisição " + properties.correlation_id.encode("utf-8")) - # body it's a json that contains main video, libras video, window size and window position + logger.info("Processing request " + properties.correlation_id.encode("utf-8")) body = json.loads(body) try: - # Try to download the main video - logger.info("Obtendo o vídeo original") + logger.info("Downloading main video") main_video = urlretrieve(body["video"].encode("utf-8"))[0] except IOError as ex: - logger.error("Falha ao obter o vídeo original") - # Returns if can't download the video + logger.error("Download of video fail") return # Get the main video height main_height = main_video_height(main_video) @@ -169,7 +175,7 @@ def run(ch, method, properties, body): # Get the window position regarding to the main video window_pos = secondary_video_position(body["window_position"].encode("utf-8")) # Defines the window movie - movie = 'movie=' + body["libras_video"].encode("utf-8") + movie = 'movie=' + body["libras-video"].encode("utf-8") # Defines the scale of window movie scale = 'scale=' + str(window_width) + ':' + str(window_heigth) # Defines the overlay position @@ -180,26 +186,39 @@ def run(ch, method, properties, body): mixed_video = os.path.join(PATH_MIXED_VIDEO, properties.correlation_id.encode("utf-8")+".mp4") # Mix videos using ffmpeg print ("Mixing videos...") - logger.info("Mixando o vídeo original com a janela de libras") + logger.info("Mixing videos") try: - call( - ['ffmpeg', '-v', 'error', '-i', main_video, '-y', '-vf', filter_graph, - '-qscale', '0', '-strict', 'experimental', '-vcodec', 'libx264', - '-preset', 'fast', '-r', '30', '-threads', '8', mixed_video], shell=False) - logger.info("Mixagem bem sucedida") + subprocess.call( + [ + "ffmpeg", + "-loglevel", "error", + "-i", main_video, + "-y", + "-vf", filter_graph, + "-qscale", "0", + "-strict", "experimental", + "-vcodec", "libx264", + "-preset", "fast", + "-r", "30", + "-threads", "4", + mixed_video + ], + shell=False + ) + logger.info("Mixing successfuly") except OSError as ex: - logger.error("Mixagem mal sucedida") + logger.error("Mixing fail") print ("Error") - # Inserts the mixed video into the body + # Add mixed video to the body body["mixed_video"] = mixed_video - # Clean temporary files - logger.info("Removendo arquivos temporários") + + logger.info("Cleaning temp files") os.remove(main_video) - os.remove(body["libras_video"]) - # Send the body to the queue - logger.info("Enviando para a fila de videos") + os.remove(body["libras-video"]) + + logger.info("Sending mixed video to the videos queue") manager.send_to_queue("videos", body, properties) - print ("Success") + print ("Ok") def keep_alive(conn_send, conn_receive): while True: diff --git a/core/renderer.py b/core/renderer.py index 08a0c16..ce2de38 100755 --- a/core/renderer.py +++ b/core/renderer.py @@ -1,40 +1,25 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- -""" -Author: Caio Marcelo Campoy Guedes -E-Mail: caiomcg@gmail.com - -Author: Erickson Silva -E-Mail: erickson.silva@lavid.ufpb.br - -Author: Jorismar Barbosa -E-Mail: jorismar.barbosa@lavid.ufpb.br - -Author: Wesnydy Lima Ribeiro -E-Mail: wesnydy@lavid.ufpb.br -""" - +import json +import logging import os -import sys import pika -import pysrt +import PikaManager +import signal import socket -import json import subprocess -import threading -import signal -from time import sleep -from thread import start_new_thread -from pyvirtualdisplay import Display + from operator import itemgetter -from shutil import rmtree, move -import logging #Logging +from pyvirtualdisplay import Display +from thread import start_new_thread +from time import sleep +# Logging configuration. logger = logging.getLogger('renderer') logger.setLevel(logging.DEBUG) -fh = logging.FileHandler('renderer.log') +fh = logging.FileHandler('../log/renderer.log') fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() @@ -47,206 +32,202 @@ ch.setFormatter(formatter) logger.addHandler(fh) logger.addHandler(ch) -credentials = pika.PlainCredentials('test', 'test') -conn_send = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials)) -conn_receive = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials)) - -#conn_send = pika.BlockingConnection(pika.ConnectionParameters(host='localhost',heartbeat_interval=0)) -#conn_receive = pika.BlockingConnection(pika.ConnectionParameters(host='localhost',heartbeat_interval=0)) - -running = False -gl_id = None -contents = [] -correlation_id = None -ffmpeg = None -display = None +# Manager of queues connections. +manager = PikaManager.PikaManager("150.165.205.10", "test", "test") TCP_IP = '0.0.0.0' TCP_PORT = 5555 -PATH_SCREENS="/home/caiomcg/.config/unity3d/LAViD/VLibrasVideoMaker/" -PATH_LIBRAS="/home/caiomcg/libras/" -PATH_VIDEO="/home/caiomcg/videos/" -VIDEO_CREATOR="/home/caiomcg/unityVideo/videoCreator.x86_64" - -def run(ch, method, properties, body): - logger.info("Processando a requisição " + properties.correlation_id.encode("utf-8")) - global running, correlation_id - body = json.loads(body) - print body - if running: - print "Running..." - if properties.correlation_id.encode("utf-8") == correlation_id: - try: - if body["control-message".decode("utf-8")] == "FINALIZE".decode("utf-8"): - size = body["index"] - - if len(contents) == size - 1: - contents.append(body) - ch.basic_ack(delivery_tag = method.delivery_tag) - make_video(correlation_id) - body['libras_video'] = os.path.join(PATH_LIBRAS, correlation_id + ".mp4") - running = False - correlation_id = "" - send_to_queue(body, properties) - else: - ch.basic_reject(delivery_tag=method.delivery_tag) - except KeyError: - contents.append(body) - ch.basic_ack(delivery_tag = method.delivery_tag) - else: - ch.basic_reject(delivery_tag=method.delivery_tag, requeue=True) - else: - print body["index"] - if "index" in body and body["index"] == 1: - print "index" - running = True - correlation_id = properties.correlation_id.encode("utf-8") - contents.append(body) - ch.basic_ack(delivery_tag = method.delivery_tag) - elif "type" in body and body["type"] == "text": - print "Body=Text..." - body['pts'] = -1 - body['index'] = 0 - contents.append(body) - message = {'control-message': "FINALIZE", 'pts': -1, 'index': 1} - contents.append(message) - ch.basic_ack(delivery_tag = method.delivery_tag) - make_video(properties.correlation_id.encode("utf-8")) - path_libras = os.path.join(PATH_LIBRAS, properties.correlation_id.encode("utf-8")+".mp4") - path_video = os.path.join(PATH_VIDEO, properties.correlation_id.encode("utf-8")+".mp4") - move(path_libras, path_video) - body['libras_video'] = path_video - send_to_queue(body, properties) - else: - print "basic" - ch.basic_reject(delivery_tag=method.delivery_tag, requeue=True) - -def make_video(id): - logger.info("Gerando o vídeo de libras") - print "Making video..." - global gl_id - gl_id = id - start_new_thread(send_to_player, ()) - #threading.Thread(target=send_to_player, args=(id,)).start() - capture(id) - #render(id) - clean(id) - -def send_to_player(): - logger.info("Enviando glosa para o player") - global gl_id - socket = open_socket() - contents_sorted = sorted(contents, key=itemgetter('index')) - for message in contents_sorted: - try: - socket.send(message["gloss"].encode('utf-8')+"#"+str(message["pts"])) - except KeyError: - logger.error("Impossível enviar glosa. Mensagem de controle será enviada para o servidor") - socket.send(message["control-message"].encode('utf-8')+"#"+str(message["pts"])) - render(gl_id) - sleep(1) - socket.close() - del contents[:] - -def open_socket(): - logger.info("Abrindo conexão via socket") - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - while True: - try: - s.connect((TCP_IP, TCP_PORT)) - print "Connected..." - break - except: - sleep(2) - return s - -def render(id): - global ffmpeg, display - - print "Rendering..." - logger.info("Renderizando o vídeo de libras") - ffmpeg = subprocess.Popen( - [ - "ffmpeg", - "-y", - "-loglevel", "quiet", - "-video_size", "800x600", - "-r", "30", - "-f", "x11grab", - "-draw_mouse", "0", - "-i", str(display.cmd_param[-1]) + ".0+nomouse", - "-vcodec", "libx264", - "-pix_fmt", "yuv420p", - "-an", - PATH_LIBRAS + id + ".mp4" - ], - shell=False - ) - - print "OK" - -def capture(id): - print "Capture..." - logger.info("Capturando informações do display") - global ffmpeg, display - display = Display(visible=0, size=(800, 600)) - display.start() - subprocess.call([VIDEO_CREATOR, id, "0", "30", "20", "25", "-screen-fullscreen", "1", "-screen-quality", "Fantastic", "-force-opengl"], shell=False) - ffmpeg.send_signal(signal.SIGQUIT) - ffmpeg.communicate() - display.stop() - print "OK" +PATH_LIBRAS = os.getenv("VLIBRAS_VIDEO_LIBRAS") +VIDEO_CREATOR = os.getenv("VLIBRAS_VIDEO_CREATOR") -def clean(id): - logger.info("Removendo arquivos temporários") - path = os.path.join(PATH_SCREENS, id) - rmtree(path, ignore_errors=True) - -def send_to_queue(body, props): - try: - channel = conn_send.channel() - except KeyError: - reload_connection_send() - channel = conn_send.channel() - queue = "libras" if body["type"].encode("UTF-8") == "video" else "videos" - channel.basic_publish(exchange='', - routing_key=queue, - properties=pika.BasicProperties(correlation_id = props.correlation_id), - body=json.dumps(body)) - channel.close() - -def receive_from_queue(): - try: - channel = conn_receive.channel() - except KeyError: - reload_connection_receive() - channel = conn_receive.channel() - queue = "translations" - channel.basic_qos(prefetch_count=1) - channel.basic_consume(run, - queue=queue) - channel.start_consuming() - channel.close() +# Status of renderer to process new requests. Answer one request at a time. +worker_available = True +# Identification to indicate the request being processed. +correlation_id = None +# Array that stores gloss and pts in json format to be sent to videoCreator. +gloss_buffer = [] +# pyvirtualdisplay instance +display = None +# ffmpeg process instance +ffmpeg = None -def reload_connection_send(): - global conn_send - try: - conn_send.close() - except: - pass - conn_send = pika.BlockingConnection(pika.ConnectionParameters(host='localhost',heartbeat_interval=0)) +def start_video_creator(id): + """ + Start video creator server. + + Parameters + ---------- + id : string + Identification of request. + """ + global display, ffmpeg + logger.info("Starting video creator server") + display = Display(visible=0, size=(800,600)) + display.start() + subprocess.call( + [ + VIDEO_CREATOR, + id, + "0", + "30", + "20", + "25", + "-screen-fullscreen", "1", + "-screen-quality", "Fantastic", + "-force-opengl" + ], + shell=False + ) + ffmpeg.send_signal(signal.SIGQUIT) + ffmpeg.communicate() + display.stop() + +def start_ffmpeg(id): + """ + Start FFmpeg to capture the video creator display. + + Parameters + ---------- + id : string + Identification of request. + """ + global ffmpeg, display + logger.info("Starting ffmpeg") + libras_video = os.path.join(PATH_LIBRAS, id + ".mp4") + ffmpeg = subprocess.Popen( + [ + "ffmpeg", + "-y", + "-loglevel", "quiet", + "-video_size", "800x600", + "-r", "30", + "-f", "x11grab", + "-draw_mouse", "0", + "-i", str(display.cmd_param[-1]) + ".0+nomouse", + "-vcodec", "libx264", + "-pix_fmt", "yuv420p", + "-an", + libras_video + ], + shell=False + ) + +def open_socket_connection(): + """ + Create a new socket TCP connection with video creator server. + + Returns + ------- + socket object + Connection with video creator server. + """ + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + logger.info("Opening connection with video creator") + while True: + try: + s.connect((TCP_IP, TCP_PORT)) + break + except: + sleep(2) + return s + +def send_to_video_creator(id): + # Stablishes connection with video creator server. + socket = open_socket_connection() + # Sort buffer to restore the original sequence. + sorted_buffer = sorted(gloss_buffer, key=itemgetter("index")) + logger.info("Sending gloss to video creator") + for content in sorted_buffer: + try: + # Send gloss to video creator. + socket.send(content["gloss"].encode("utf-8")+"#"+str(content["pts"])) + except KeyError: + logger.info("Sending control message to video creator") + socket.send(content["control-message"].encode("utf-8")+"#"+str(content["pts"])) + # Start ffmpeg to capture the video creator display. + logger.info("Rendering video") + start_ffmpeg(id) + # sleep for 500 milliseconds + sleep(.500) + socket.close() + del gloss_buffer[:] -def reload_connection_receive(): - global conn_receive - try: - conn_receive.close() - except: - pass - conn_receive = pika.BlockingConnection(pika.ConnectionParameters(host='localhost',heartbeat_interval=0)) +def run(ch, method, properties, body): + """ + Execute the worker. + + Parameters + ---------- + ch : object + Channel of communication. + method : function + Callback method. + properties : object + Message containing a set of 14 properties. + body : string + Json string containing the necessary arguments for workers. + """ + global worker_available, correlation_id + body = json.loads(body) + # Check if worker is available to process a new request. + if worker_available: + logger.info("Processing request " + properties.correlation_id.encode("utf-8")) + # Accept only messages with index equals to 1. + try: + if body["index"] == 1: + # Change the status of renderer to occupied. + worker_available = False + # Stores the id of request in process. + correlation_id = properties.correlation_id.encode("utf-8") + # Stores the first gloss in the buffer. + gloss_buffer.append(body) + else: + ch.basic_reject(delivery_tag=method.delivery_tag, requeue=True) + except KeyError: + ch.basic_reject(delivery_tag=method.delivery_tag, requeue=True) + # Else the worker is alread processing a request. + else: + # Check if the id of message match with the id of request being processed. + if properties.correlation_id.encode("utf-8") == correlation_id: + # Check if the body contains the control-message. + try: + if body["control-message"] == "FINALIZE": + # Get the total number of gloss of the current request. + total = body["index"] # Index of "FINALIZE" is the total number of gloss. + # Check if the buffer contains the correct number of gloss. + if len(gloss_buffer) == total - 1: + gloss_buffer.append(body) + logger.info("Preparing to generate the video") + start_new_thread(send_to_video_creator, (correlation_id,)) + start_video_creator(correlation_id) + # Add path of libras video on body. + body["libras-video"] = os.path.join(PATH_LIBRAS, correlation_id + ".mp4") + worker_available = True + correlation_id = None + logger.info("Sending libras video to the translations queue") + manager.send_to_queue("libras", body, properties) + print ("OK") + else: + ch.basic_reject(delivery_tag=method.delivery_tag, requeue=True) + except KeyError: + # Control message doesn't exist, continues to store gloss. + gloss_buffer.append(body) + else: + ch.basic_reject(delivery_tag=method.delivery_tag, requeue=True) def keep_alive(conn_send, conn_receive): - while True: + """ + Keep the connection alive. + + Parameters + ---------- + conn_send : object + Connection of writer. + conn_receive : object + Connection of receiver. + """ + while True: sleep(30) try: conn_send.process_data_events() @@ -254,13 +235,12 @@ def keep_alive(conn_send, conn_receive): except: continue -start_new_thread(keep_alive, (conn_send, conn_receive)) +start_new_thread(keep_alive, (manager.get_conn_send(), manager.get_conn_receive())) + +print("Renderer listening...") while True: try: - receive_from_queue() + manager.receive_from_queue("translations", run) except KeyboardInterrupt: - conn_send.close() - conn_receive.close() + manager.close_connections() os._exit(0) - except: - continue diff --git a/core/translator.py b/core/translator.py index f194f01..9064e84 100755 --- a/core/translator.py +++ b/core/translator.py @@ -15,32 +15,34 @@ Author: Wesnydy Lima Ribeiro E-Mail: wesnydy@lavid.ufpb.br """ +import json +import logging import os import pika -import json import PikaManager -import logging #Logging from PortGlosa import traduzir from thread import start_new_thread from time import sleep -logger = logging.getLogger('translator') +# Logging configuration. +logger = logging.getLogger("translator") logger.setLevel(logging.DEBUG) -fh = logging.FileHandler('../log/translator.log') +fh = logging.FileHandler("../log/translator.log") fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.ERROR) -formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') +formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") fh.setFormatter(formatter) ch.setFormatter(formatter) logger.addHandler(fh) logger.addHandler(ch) +# Manager of queues connections. manager = PikaManager.PikaManager("150.165.205.10", "test", "test") def run(ch, method, properties, body): @@ -55,25 +57,24 @@ def run(ch, method, properties, body): Callback method. properties : object Message containing a set of 14 properties. - body : json object - Informations received from queue. + body : string + Json string containing the necessary arguments for workers. """ - # body it's a json that contains text to be translating body = json.loads(body) print ("Translating...") - # Initialize the translation of text try: - logger.info("Traduzindo: "+body["text"]+" id: "+properties.correlation_id.encode("utf-8")) + logger.info("Translating: "+body["text"]+" id: "+properties.correlation_id.encode("utf-8")) gloss = traduzir(body["text"].encode("utf-8")) + # Add gloss key with glosa content on the body. body["gloss"] = gloss + # Remove text translated. del body["text"] except KeyError: - logger.info("Não existe texto para traduzir") pass - # Send the body to the queue - logger.info("Enviando glosa para a fila de traduções") + + logger.info("Sending gloss to the translations queue") manager.send_to_queue("translations", body, properties) - print ("Success") + print ("Ok") def keep_alive(conn_send, conn_receive): """ -- libgit2 0.21.2