Commit a047b83b3de20cd39c78ec62e0bfb86c6a61951f

Authored by Wesnydy Ribeiro
1 parent 062cdb67
Exists in release

Rename folders

dependencies/configure.sh
@@ -1,84 +0,0 @@ @@ -1,84 +0,0 @@
1 -#!/usr/bin/env bash  
2 -  
3 -OK="\033[32mOK\033[0m"  
4 -ERROR="echo -e '\033[31mERROR\033[0m'"  
5 -  
6 -set -e  
7 -  
8 -echo -n "Updating apt"  
9 -sudo apt-get -qq -y update && echo -n "." || eval $ERROR  
10 -sudo apt-get -qq -y upgrade && echo -n "." || eval $ERROR  
11 -sudo apt-get -qq -y update && echo -e ". $OK" || eval $ERROR  
12 -  
13 -echo -e "Obtaining RabbitMQ from rabbitmq.com APT Repository..."  
14 -echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list  
15 -wget -q -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -  
16 -echo -n "Installing RabbitMQ"  
17 -sudo apt-get -qq -y update && echo -n "." || eval $ERROR  
18 -sudo apt-get install -qq -y rabbitmq-server && echo -n "." || eval $ERROR  
19 -sudo pip install -q pika && echo -e ". $OK" || eval $ERROR  
20 -echo -e "Enabling RabbitMQ management... "  
21 -sudo rabbitmq-plugins enable rabbitmq_management  
22 -  
23 -echo -n "Installing Graylog"  
24 -sudo pip install -q graypy && echo -n ".." || eval $ERROR  
25 -sudo pip install -q graypy[amqp] && echo -e ". $OK" || eval $ERROR  
26 -  
27 -echo -n "Installing nodejs v4.x"  
28 -curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - &>/dev/null  
29 -sudo apt-get install -qq -y nodejs && echo -e "... $OK" || eval $ERROR  
30 -  
31 -echo -n "Installing Redis"  
32 -sudo apt-get install -qq -y redis-server && echo -e "... $OK" || eval $ERROR  
33 -echo -e "Restarting Redis server..."  
34 -sudo service redis-server restart  
35 -  
36 -echo -e "Obtaining MongoDB from repo.mongodb.org APT Repository..."  
37 -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 &>/dev/null  
38 -echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" \  
39 - | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list  
40 -echo -n "Installing MongoDB"  
41 -sudo apt-get -qq -y update && echo -n "." || eval $ERROR  
42 -sudo apt-get install -qq -y mongodb-org && echo -e ".. $OK" || eval $ERROR  
43 -  
44 -echo -n "Installing FFmpeg"  
45 -sudo add-apt-repository -y ppa:mc3man/trusty-media &>/dev/null  
46 -sudo apt-get -qq -y update && echo -n "." || eval $ERROR  
47 -sudo apt-get install -qq -y ffmpeg && echo -e ".. $OK" || eval $ERROR  
48 -  
49 -read -r -p "You want to install VLibras Translate? [Y/n] " response  
50 -response=${response,,} #tolower  
51 -if [[ $response =~ ^(yes|y| ) ]]; then  
52 - echo -n "Obtaining VLibras Translate"  
53 - cd $HOME  
54 - git clone git@git.lavid.ufpb.br:vlibras-translate.git && echo -e "... $OK" || eval $ERROR  
55 - echo -e "Installing VLibras Translate"  
56 - cd vlibras-translate/scripts/linux  
57 - ./install.sh  
58 -fi  
59 -  
60 -read -r -p "You want to install VLibras Video Player? [Y/n] " response  
61 -response=${response,,} #tolower  
62 -if [[ $response =~ ^(yes|y| ) ]]; then  
63 - echo -n "Obtaining VLibras Video Player"  
64 - wget -q http://150.165.204.30:8080/core/linux/unityVideo.tar.gz && echo -e "... $OK" || eval $ERROR  
65 - echo -n "Installing VLibras Video Player"  
66 - sudo apt-get install -qq -y xvfb && echo -n "." || eval $ERROR  
67 - sudo pip install -q pyvirtualdisplay && echo -n "." || eval $ERROR  
68 - tar -xf unityVideo.tar.gz -C $HOME && echo -e ". $OK" || eval $ERROR  
69 - rm unityVideo.tar.gz  
70 -fi  
71 -  
72 -LIBRASDIR=$HOME/vlibras-contents/libras  
73 -VIDEOSDIR=$HOME/vlibras-contents/videos  
74 -  
75 -mkdir -p $LIBRASDIR $VIDEOSDIR  
76 -  
77 -echo -n "Creating environment variables... "  
78 -TEMP_ENV=$(mktemp)  
79 -echo "export VLIBRAS_VIDEO_CREATOR=$HOME/unityVideo/videoCreator.x86_64" > $TEMP_ENV  
80 -echo "export VLIBRAS_VIDEO_LIBRAS=$HOME/vlibras-contents/libras" >> $TEMP_ENV  
81 -echo "export VLIBRAS_VIDEO_MIXED=$HOME/vlibras-contents/videos" >> $TEMP_ENV  
82 -sudo install -m 755 $TEMP_ENV -D /etc/profile.d/vlibras-video-env.sh && echo -e $OK || eval $ERROR  
83 -rm -f TEMP_ENV  
84 -echo -e "Restart the computer to finalize installation."  
dependencies/configureDocker.sh
@@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
1 -#!/usr/bin/env bash  
2 -  
3 -OK="\033[32mOK\033[0m"  
4 -ERROR="echo -e '\033[31mERROR\033[0m'"  
5 -version=$(lsb_release -sr)  
6 -  
7 -set -e  
8 -  
9 -echo -n "Updating apt"  
10 -sudo apt-get -y -qq update && echo -e "... $OK" || eval $ERROR  
11 -  
12 -echo -n "Installing linux images"  
13 -sudo apt-get install -y -qq linux-image-extra-$(uname -r) linux-image-extra-virtual && echo -e "... $OK" || eval $ERROR  
14 -  
15 -echo -n "Installing HTTPS"  
16 -sudo apt-get install -y -qq apt-transport-https && echo -e "... $OK" || eval $ERROR  
17 -  
18 -echo -n "Installing ca-certificates"  
19 -sudo apt-get install -y -qq ca-certificates && echo -e "... $OK" || eval $ERROR  
20 -  
21 -echo -e "Adding keyserver..."  
22 -sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D &>/dev/null  
23 -  
24 -if [ "$version" = "16.04" ] || [ "$version" = "16.10" ]; then  
25 - echo -e "Adding docker path to sources - VERSION: ${version}"  
26 - echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list  
27 -else  
28 - echo -e "Adding docker path to sources - VERSION: ${version}"  
29 - echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list  
30 -fi  
31 -  
32 -echo -n "Updating apt"  
33 -sudo apt-get -y -qq update && echo -e "... $OK" || eval $ERROR  
34 -  
35 -echo -n "Removing lxc"  
36 -sudo apt-get -y -qq purge lxc-docker && echo -e "... $OK" || eval $ERROR  
37 -  
38 -echo -n "Caching docker-engine"  
39 -sudo apt-cache policy docker-engine &>/dev/null && echo -e "... $OK" || eval $ERROR  
40 -  
41 -echo -n "Installing docker-engine"  
42 -sudo apt-get install -y -qq docker-engine && echo -e "... $OK" || eval $ERROR  
dependencies/dictUpdate.sh
@@ -1,47 +0,0 @@ @@ -1,47 +0,0 @@
1 -#!/bin/bash  
2 -  
3 -echo -e "\n\033[32m##### Atualizando dicionário #####\033[0m\n"  
4 -  
5 -NOT_INSTALLED=false  
6 -DIR=/opt/vlibras_desktop/vlibras_player_Data/Bundles  
7 -PLAYER_DATA="$HOME/unityVideo/videoCreator_Data"  
8 -BUNDLES="$PLAYER_DATA/Bundles"  
9 -  
10 -function check_update_patches()  
11 -{  
12 - count=0  
13 - for d in "$DIR/*" ; do  
14 - count=$((count+1))  
15 - apt-get install --only-upgrade --force-yes --yes patch${count}.0.0 > /dev/null 2>&1  
16 - done  
17 -}  
18 -  
19 -if [ ! -f /etc/apt/sources.list.d/dicionario-vlibras.list ]; then  
20 - # Add repository to update the dictionary  
21 - echo 'deb http://150.165.204.46:8080 precise main' | sudo tee /etc/apt/sources.list.d/dicionario-vlibras.list > /dev/null 2>&1  
22 -fi  
23 -  
24 -PKG_DICT=$(dpkg-query -W --showformat='${Status}\n' dicionario-vlibras:i386|grep "install ok installed")  
25 -if [ "" == "$PKG_DICT" ]; then  
26 - NOT_INSTALLED=true  
27 - sudo apt-get install --force-yes --yes dicionario-vlibras:i386  
28 -else  
29 - sudo apt-get update  
30 - check_update_patches  
31 - sudo apt-get install --only-upgrade --force-yes --yes dicionario-vlibras:i386  
32 -fi  
33 -  
34 -#remove pasta bundles  
35 -if [ -d "$BUNDLES" ] ; then  
36 - rm -r $BUNDLES  
37 -fi  
38 -  
39 -#copia dicionário para pasta de bundles  
40 -cp -r $DIR $PLAYER_DATA  
41 -cd $BUNDLES  
42 -rm *.description  
43 -  
44 -#remove pacote  
45 -if [ "$NOT_INSTALLED" = true ] ; then  
46 - sudo apt-get autoremove -y dicionario-vlibras:i386  
47 -fi  
48 \ No newline at end of file 0 \ No newline at end of file
queue_management/bkp_write_queue.py
@@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
1 -import pika  
2 -import json  
3 -import logging  
4 -import sys  
5 -  
6 -logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.CRITICAL)  
7 -  
8 -def run(id):  
9 - credentials = pika.PlainCredentials('test', 'test')  
10 - connection = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials))  
11 - channel = connection.channel()  
12 - queue = "requests"  
13 - message = {"subtitle": "http://150.165.205.50:8000/legenda.srt", "video":"http://150.165.205.50:8000/1_second.mp4", "window_position":"1", "window_size":"1", "type":"video"}  
14 - channel.basic_publish(exchange='',  
15 - routing_key=queue,  
16 - properties=pika.BasicProperties(correlation_id = id),  
17 - body=json.dumps(message))  
18 - channel.close()  
19 - connection.close()  
20 -  
21 -if __name__ == '__main__':  
22 - id = sys.argv[1]  
23 - run(id)  
24 \ No newline at end of file 0 \ No newline at end of file
queue_management/read_queue.py
@@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
1 -import pika  
2 -import json  
3 -import sys  
4 -  
5 -def read(ch, method, properties, body):  
6 - try:  
7 - print str(type(body)) + " | " + json.loads(body)["text"]  
8 - except:  
9 - print str(type(body)) + " | " + body  
10 -  
11 -def run(queue_name):  
12 - credentials = pika.PlainCredentials('test', 'test')  
13 - connection = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials))  
14 - channel = connection.channel()  
15 - channel.basic_qos(prefetch_count=1)  
16 - channel.basic_consume(read,  
17 - queue=queue_name,  
18 - no_ack=True)  
19 - channel.start_consuming()  
20 - channel.close()  
21 - connection.close()  
22 -  
23 -if __name__ == '__main__':  
24 - queue = sys.argv[1]  
25 - run(queue)  
26 \ No newline at end of file 0 \ No newline at end of file
queue_management/write_queue.py
@@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
1 -import pika  
2 -import json  
3 -import logging  
4 -import sys  
5 -  
6 -logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.CRITICAL)  
7 -  
8 -def run(id):  
9 - credentials = pika.PlainCredentials('test', 'test')  
10 - connection = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials))  
11 - channel = connection.channel()  
12 - queue = "requests"  
13 - #message = {"subtitle": "http://150.165.205.69:8000/legenda.srt", "video":"http://150.165.205.69:8000/video.mp4", "window_position":"1", "window_size":"1", "type":"video"}  
14 - message = {"subtitle": "http://150.165.205.132:8000/legenda.srt", "video":"http://150.165.205.132:8000/1_second.mp4", "window_position":"1", "window_size":"1", "type":"video"}  
15 - channel.basic_publish(exchange='',  
16 - routing_key=queue,  
17 - properties=pika.BasicProperties(correlation_id = id),  
18 - body=json.dumps(message))  
19 - channel.close()  
20 - connection.close()  
21 -  
22 -if __name__ == '__main__':  
23 - id = sys.argv[1]  
24 - run(id)  
25 \ No newline at end of file 0 \ No newline at end of file
scripts/configure.sh 0 → 100755
@@ -0,0 +1,84 @@ @@ -0,0 +1,84 @@
  1 +#!/usr/bin/env bash
  2 +
  3 +OK="\033[32mOK\033[0m"
  4 +ERROR="echo -e '\033[31mERROR\033[0m'"
  5 +
  6 +set -e
  7 +
  8 +echo -n "Updating apt"
  9 +sudo apt-get -qq -y update && echo -n "." || eval $ERROR
  10 +sudo apt-get -qq -y upgrade && echo -n "." || eval $ERROR
  11 +sudo apt-get -qq -y update && echo -e ". $OK" || eval $ERROR
  12 +
  13 +echo -e "Obtaining RabbitMQ from rabbitmq.com APT Repository..."
  14 +echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list
  15 +wget -q -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
  16 +echo -n "Installing RabbitMQ"
  17 +sudo apt-get -qq -y update && echo -n "." || eval $ERROR
  18 +sudo apt-get install -qq -y rabbitmq-server && echo -n "." || eval $ERROR
  19 +sudo pip install -q pika && echo -e ". $OK" || eval $ERROR
  20 +echo -e "Enabling RabbitMQ management... "
  21 +sudo rabbitmq-plugins enable rabbitmq_management
  22 +
  23 +echo -n "Installing Graylog"
  24 +sudo pip install -q graypy && echo -n ".." || eval $ERROR
  25 +sudo pip install -q graypy[amqp] && echo -e ". $OK" || eval $ERROR
  26 +
  27 +echo -n "Installing nodejs v4.x"
  28 +curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - &>/dev/null
  29 +sudo apt-get install -qq -y nodejs && echo -e "... $OK" || eval $ERROR
  30 +
  31 +echo -n "Installing Redis"
  32 +sudo apt-get install -qq -y redis-server && echo -e "... $OK" || eval $ERROR
  33 +echo -e "Restarting Redis server..."
  34 +sudo service redis-server restart
  35 +
  36 +echo -e "Obtaining MongoDB from repo.mongodb.org APT Repository..."
  37 +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 &>/dev/null
  38 +echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" \
  39 + | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
  40 +echo -n "Installing MongoDB"
  41 +sudo apt-get -qq -y update && echo -n "." || eval $ERROR
  42 +sudo apt-get install -qq -y mongodb-org && echo -e ".. $OK" || eval $ERROR
  43 +
  44 +echo -n "Installing FFmpeg"
  45 +sudo add-apt-repository -y ppa:mc3man/trusty-media &>/dev/null
  46 +sudo apt-get -qq -y update && echo -n "." || eval $ERROR
  47 +sudo apt-get install -qq -y ffmpeg && echo -e ".. $OK" || eval $ERROR
  48 +
  49 +read -r -p "You want to install VLibras Translate? [Y/n] " response
  50 +response=${response,,} #tolower
  51 +if [[ $response =~ ^(yes|y| ) ]]; then
  52 + echo -n "Obtaining VLibras Translate"
  53 + cd $HOME
  54 + git clone git@git.lavid.ufpb.br:vlibras-translate.git && echo -e "... $OK" || eval $ERROR
  55 + echo -e "Installing VLibras Translate"
  56 + cd vlibras-translate/scripts/linux
  57 + ./install.sh
  58 +fi
  59 +
  60 +read -r -p "You want to install VLibras Video Player? [Y/n] " response
  61 +response=${response,,} #tolower
  62 +if [[ $response =~ ^(yes|y| ) ]]; then
  63 + echo -n "Obtaining VLibras Video Player"
  64 + wget -q http://150.165.204.30:8080/core/linux/unityVideo.tar.gz && echo -e "... $OK" || eval $ERROR
  65 + echo -n "Installing VLibras Video Player"
  66 + sudo apt-get install -qq -y xvfb && echo -n "." || eval $ERROR
  67 + sudo pip install -q pyvirtualdisplay && echo -n "." || eval $ERROR
  68 + tar -xf unityVideo.tar.gz -C $HOME && echo -e ". $OK" || eval $ERROR
  69 + rm unityVideo.tar.gz
  70 +fi
  71 +
  72 +LIBRASDIR=$HOME/vlibras-contents/libras
  73 +VIDEOSDIR=$HOME/vlibras-contents/videos
  74 +
  75 +mkdir -p $LIBRASDIR $VIDEOSDIR
  76 +
  77 +echo -n "Creating environment variables... "
  78 +TEMP_ENV=$(mktemp)
  79 +echo "export VLIBRAS_VIDEO_CREATOR=$HOME/unityVideo/videoCreator.x86_64" > $TEMP_ENV
  80 +echo "export VLIBRAS_VIDEO_LIBRAS=$HOME/vlibras-contents/libras" >> $TEMP_ENV
  81 +echo "export VLIBRAS_VIDEO_MIXED=$HOME/vlibras-contents/videos" >> $TEMP_ENV
  82 +sudo install -m 755 $TEMP_ENV -D /etc/profile.d/vlibras-video-env.sh && echo -e $OK || eval $ERROR
  83 +rm -f TEMP_ENV
  84 +echo -e "Restart the computer to finalize installation."
scripts/configureDocker.sh 0 → 100755
@@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
  1 +#!/usr/bin/env bash
  2 +
  3 +OK="\033[32mOK\033[0m"
  4 +ERROR="echo -e '\033[31mERROR\033[0m'"
  5 +version=$(lsb_release -sr)
  6 +
  7 +set -e
  8 +
  9 +echo -n "Updating apt"
  10 +sudo apt-get -y -qq update && echo -e "... $OK" || eval $ERROR
  11 +
  12 +echo -n "Installing linux images"
  13 +sudo apt-get install -y -qq linux-image-extra-$(uname -r) linux-image-extra-virtual && echo -e "... $OK" || eval $ERROR
  14 +
  15 +echo -n "Installing HTTPS"
  16 +sudo apt-get install -y -qq apt-transport-https && echo -e "... $OK" || eval $ERROR
  17 +
  18 +echo -n "Installing ca-certificates"
  19 +sudo apt-get install -y -qq ca-certificates && echo -e "... $OK" || eval $ERROR
  20 +
  21 +echo -e "Adding keyserver..."
  22 +sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D &>/dev/null
  23 +
  24 +if [ "$version" = "16.04" ] || [ "$version" = "16.10" ]; then
  25 + echo -e "Adding docker path to sources - VERSION: ${version}"
  26 + echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
  27 +else
  28 + echo -e "Adding docker path to sources - VERSION: ${version}"
  29 + echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
  30 +fi
  31 +
  32 +echo -n "Updating apt"
  33 +sudo apt-get -y -qq update && echo -e "... $OK" || eval $ERROR
  34 +
  35 +echo -n "Removing lxc"
  36 +sudo apt-get -y -qq purge lxc-docker && echo -e "... $OK" || eval $ERROR
  37 +
  38 +echo -n "Caching docker-engine"
  39 +sudo apt-cache policy docker-engine &>/dev/null && echo -e "... $OK" || eval $ERROR
  40 +
  41 +echo -n "Installing docker-engine"
  42 +sudo apt-get install -y -qq docker-engine && echo -e "... $OK" || eval $ERROR
scripts/dictUpdate.sh 0 → 100644
@@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
  1 +#!/bin/bash
  2 +
  3 +echo -e "\n\033[32m##### Atualizando dicionário #####\033[0m\n"
  4 +
  5 +NOT_INSTALLED=false
  6 +DIR=/opt/vlibras_desktop/vlibras_player_Data/Bundles
  7 +PLAYER_DATA="$HOME/unityVideo/videoCreator_Data"
  8 +BUNDLES="$PLAYER_DATA/Bundles"
  9 +
  10 +function check_update_patches()
  11 +{
  12 + count=0
  13 + for d in "$DIR/*" ; do
  14 + count=$((count+1))
  15 + apt-get install --only-upgrade --force-yes --yes patch${count}.0.0 > /dev/null 2>&1
  16 + done
  17 +}
  18 +
  19 +if [ ! -f /etc/apt/sources.list.d/dicionario-vlibras.list ]; then
  20 + # Add repository to update the dictionary
  21 + echo 'deb http://150.165.204.46:8080 precise main' | sudo tee /etc/apt/sources.list.d/dicionario-vlibras.list > /dev/null 2>&1
  22 +fi
  23 +
  24 +PKG_DICT=$(dpkg-query -W --showformat='${Status}\n' dicionario-vlibras:i386|grep "install ok installed")
  25 +if [ "" == "$PKG_DICT" ]; then
  26 + NOT_INSTALLED=true
  27 + sudo apt-get install --force-yes --yes dicionario-vlibras:i386
  28 +else
  29 + sudo apt-get update
  30 + check_update_patches
  31 + sudo apt-get install --only-upgrade --force-yes --yes dicionario-vlibras:i386
  32 +fi
  33 +
  34 +#remove pasta bundles
  35 +if [ -d "$BUNDLES" ] ; then
  36 + rm -r $BUNDLES
  37 +fi
  38 +
  39 +#copia dicionário para pasta de bundles
  40 +cp -r $DIR $PLAYER_DATA
  41 +cd $BUNDLES
  42 +rm *.description
  43 +
  44 +#remove pacote
  45 +if [ "$NOT_INSTALLED" = true ] ; then
  46 + sudo apt-get autoremove -y dicionario-vlibras:i386
  47 +fi
0 \ No newline at end of file 48 \ No newline at end of file
test/read_queue.py 0 → 100644
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +import pika
  2 +import json
  3 +import sys
  4 +
  5 +def read(ch, method, properties, body):
  6 + try:
  7 + print str(type(body)) + " | " + json.loads(body)["text"]
  8 + except:
  9 + print str(type(body)) + " | " + body
  10 +
  11 +def run(queue_name):
  12 + credentials = pika.PlainCredentials('test', 'test')
  13 + connection = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials))
  14 + channel = connection.channel()
  15 + channel.basic_qos(prefetch_count=1)
  16 + channel.basic_consume(read,
  17 + queue=queue_name,
  18 + no_ack=True)
  19 + channel.start_consuming()
  20 + channel.close()
  21 + connection.close()
  22 +
  23 +if __name__ == '__main__':
  24 + queue = sys.argv[1]
  25 + run(queue)
0 \ No newline at end of file 26 \ No newline at end of file
test/write_queue.py 0 → 100644
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
  1 +import pika
  2 +import json
  3 +import logging
  4 +import sys
  5 +
  6 +logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.CRITICAL)
  7 +
  8 +def run(id):
  9 + credentials = pika.PlainCredentials('test', 'test')
  10 + connection = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials))
  11 + channel = connection.channel()
  12 + queue = "requests"
  13 + #message = {"subtitle": "http://150.165.205.69:8000/legenda.srt", "video":"http://150.165.205.69:8000/video.mp4", "window_position":"1", "window_size":"1", "type":"video"}
  14 + message = {"subtitle": "http://150.165.205.132:8000/legenda.srt", "video":"http://150.165.205.132:8000/1_second.mp4", "window_position":"1", "window_size":"1", "type":"video"}
  15 + channel.basic_publish(exchange='',
  16 + routing_key=queue,
  17 + properties=pika.BasicProperties(correlation_id = id),
  18 + body=json.dumps(message))
  19 + channel.close()
  20 + connection.close()
  21 +
  22 +if __name__ == '__main__':
  23 + id = sys.argv[1]
  24 + run(id)
0 \ No newline at end of file 25 \ No newline at end of file