diff --git a/dependencies/configure.sh b/dependencies/configure.sh deleted file mode 100755 index 270ccac..0000000 --- a/dependencies/configure.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash - -OK="\033[32mOK\033[0m" -ERROR="echo -e '\033[31mERROR\033[0m'" - -set -e - -echo -n "Updating apt" -sudo apt-get -qq -y update && echo -n "." || eval $ERROR -sudo apt-get -qq -y upgrade && echo -n "." || eval $ERROR -sudo apt-get -qq -y update && echo -e ". $OK" || eval $ERROR - -echo -e "Obtaining RabbitMQ from rabbitmq.com APT Repository..." -echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list -wget -q -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add - -echo -n "Installing RabbitMQ" -sudo apt-get -qq -y update && echo -n "." || eval $ERROR -sudo apt-get install -qq -y rabbitmq-server && echo -n "." || eval $ERROR -sudo pip install -q pika && echo -e ". $OK" || eval $ERROR -echo -e "Enabling RabbitMQ management... " -sudo rabbitmq-plugins enable rabbitmq_management - -echo -n "Installing Graylog" -sudo pip install -q graypy && echo -n ".." || eval $ERROR -sudo pip install -q graypy[amqp] && echo -e ". $OK" || eval $ERROR - -echo -n "Installing nodejs v4.x" -curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - &>/dev/null -sudo apt-get install -qq -y nodejs && echo -e "... $OK" || eval $ERROR - -echo -n "Installing Redis" -sudo apt-get install -qq -y redis-server && echo -e "... $OK" || eval $ERROR -echo -e "Restarting Redis server..." -sudo service redis-server restart - -echo -e "Obtaining MongoDB from repo.mongodb.org APT Repository..." -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 &>/dev/null -echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" \ - | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list -echo -n "Installing MongoDB" -sudo apt-get -qq -y update && echo -n "." || eval $ERROR -sudo apt-get install -qq -y mongodb-org && echo -e ".. $OK" || eval $ERROR - -echo -n "Installing FFmpeg" -sudo add-apt-repository -y ppa:mc3man/trusty-media &>/dev/null -sudo apt-get -qq -y update && echo -n "." || eval $ERROR -sudo apt-get install -qq -y ffmpeg && echo -e ".. $OK" || eval $ERROR - -read -r -p "You want to install VLibras Translate? [Y/n] " response -response=${response,,} #tolower -if [[ $response =~ ^(yes|y| ) ]]; then - echo -n "Obtaining VLibras Translate" - cd $HOME - git clone git@git.lavid.ufpb.br:vlibras-translate.git && echo -e "... $OK" || eval $ERROR - echo -e "Installing VLibras Translate" - cd vlibras-translate/scripts/linux - ./install.sh -fi - -read -r -p "You want to install VLibras Video Player? [Y/n] " response -response=${response,,} #tolower -if [[ $response =~ ^(yes|y| ) ]]; then - echo -n "Obtaining VLibras Video Player" - wget -q http://150.165.204.30:8080/core/linux/unityVideo.tar.gz && echo -e "... $OK" || eval $ERROR - echo -n "Installing VLibras Video Player" - sudo apt-get install -qq -y xvfb && echo -n "." || eval $ERROR - sudo pip install -q pyvirtualdisplay && echo -n "." || eval $ERROR - tar -xf unityVideo.tar.gz -C $HOME && echo -e ". $OK" || eval $ERROR - rm unityVideo.tar.gz -fi - -LIBRASDIR=$HOME/vlibras-contents/libras -VIDEOSDIR=$HOME/vlibras-contents/videos - -mkdir -p $LIBRASDIR $VIDEOSDIR - -echo -n "Creating environment variables... " -TEMP_ENV=$(mktemp) -echo "export VLIBRAS_VIDEO_CREATOR=$HOME/unityVideo/videoCreator.x86_64" > $TEMP_ENV -echo "export VLIBRAS_VIDEO_LIBRAS=$HOME/vlibras-contents/libras" >> $TEMP_ENV -echo "export VLIBRAS_VIDEO_MIXED=$HOME/vlibras-contents/videos" >> $TEMP_ENV -sudo install -m 755 $TEMP_ENV -D /etc/profile.d/vlibras-video-env.sh && echo -e $OK || eval $ERROR -rm -f TEMP_ENV -echo -e "Restart the computer to finalize installation." diff --git a/dependencies/configureDocker.sh b/dependencies/configureDocker.sh deleted file mode 100755 index 4a56cb3..0000000 --- a/dependencies/configureDocker.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash - -OK="\033[32mOK\033[0m" -ERROR="echo -e '\033[31mERROR\033[0m'" -version=$(lsb_release -sr) - -set -e - -echo -n "Updating apt" -sudo apt-get -y -qq update && echo -e "... $OK" || eval $ERROR - -echo -n "Installing linux images" -sudo apt-get install -y -qq linux-image-extra-$(uname -r) linux-image-extra-virtual && echo -e "... $OK" || eval $ERROR - -echo -n "Installing HTTPS" -sudo apt-get install -y -qq apt-transport-https && echo -e "... $OK" || eval $ERROR - -echo -n "Installing ca-certificates" -sudo apt-get install -y -qq ca-certificates && echo -e "... $OK" || eval $ERROR - -echo -e "Adding keyserver..." -sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D &>/dev/null - -if [ "$version" = "16.04" ] || [ "$version" = "16.10" ]; then - echo -e "Adding docker path to sources - VERSION: ${version}" - echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list -else - echo -e "Adding docker path to sources - VERSION: ${version}" - echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list -fi - -echo -n "Updating apt" -sudo apt-get -y -qq update && echo -e "... $OK" || eval $ERROR - -echo -n "Removing lxc" -sudo apt-get -y -qq purge lxc-docker && echo -e "... $OK" || eval $ERROR - -echo -n "Caching docker-engine" -sudo apt-cache policy docker-engine &>/dev/null && echo -e "... $OK" || eval $ERROR - -echo -n "Installing docker-engine" -sudo apt-get install -y -qq docker-engine && echo -e "... $OK" || eval $ERROR diff --git a/dependencies/dictUpdate.sh b/dependencies/dictUpdate.sh deleted file mode 100644 index 3a99494..0000000 --- a/dependencies/dictUpdate.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -echo -e "\n\033[32m##### Atualizando dicionário #####\033[0m\n" - -NOT_INSTALLED=false -DIR=/opt/vlibras_desktop/vlibras_player_Data/Bundles -PLAYER_DATA="$HOME/unityVideo/videoCreator_Data" -BUNDLES="$PLAYER_DATA/Bundles" - -function check_update_patches() -{ - count=0 - for d in "$DIR/*" ; do - count=$((count+1)) - apt-get install --only-upgrade --force-yes --yes patch${count}.0.0 > /dev/null 2>&1 - done -} - -if [ ! -f /etc/apt/sources.list.d/dicionario-vlibras.list ]; then - # Add repository to update the dictionary - echo 'deb http://150.165.204.46:8080 precise main' | sudo tee /etc/apt/sources.list.d/dicionario-vlibras.list > /dev/null 2>&1 -fi - -PKG_DICT=$(dpkg-query -W --showformat='${Status}\n' dicionario-vlibras:i386|grep "install ok installed") -if [ "" == "$PKG_DICT" ]; then - NOT_INSTALLED=true - sudo apt-get install --force-yes --yes dicionario-vlibras:i386 -else - sudo apt-get update - check_update_patches - sudo apt-get install --only-upgrade --force-yes --yes dicionario-vlibras:i386 -fi - -#remove pasta bundles -if [ -d "$BUNDLES" ] ; then - rm -r $BUNDLES -fi - -#copia dicionário para pasta de bundles -cp -r $DIR $PLAYER_DATA -cd $BUNDLES -rm *.description - -#remove pacote -if [ "$NOT_INSTALLED" = true ] ; then - sudo apt-get autoremove -y dicionario-vlibras:i386 -fi \ No newline at end of file diff --git a/queue_management/bkp_write_queue.py b/queue_management/bkp_write_queue.py deleted file mode 100644 index 9c5cd4e..0000000 --- a/queue_management/bkp_write_queue.py +++ /dev/null @@ -1,23 +0,0 @@ -import pika -import json -import logging -import sys - -logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.CRITICAL) - -def run(id): - credentials = pika.PlainCredentials('test', 'test') - connection = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials)) - channel = connection.channel() - queue = "requests" - 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"} - channel.basic_publish(exchange='', - routing_key=queue, - properties=pika.BasicProperties(correlation_id = id), - body=json.dumps(message)) - channel.close() - connection.close() - -if __name__ == '__main__': - id = sys.argv[1] - run(id) \ No newline at end of file diff --git a/queue_management/read_queue.py b/queue_management/read_queue.py deleted file mode 100644 index 3c27fe5..0000000 --- a/queue_management/read_queue.py +++ /dev/null @@ -1,25 +0,0 @@ -import pika -import json -import sys - -def read(ch, method, properties, body): - try: - print str(type(body)) + " | " + json.loads(body)["text"] - except: - print str(type(body)) + " | " + body - -def run(queue_name): - credentials = pika.PlainCredentials('test', 'test') - connection = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials)) - channel = connection.channel() - channel.basic_qos(prefetch_count=1) - channel.basic_consume(read, - queue=queue_name, - no_ack=True) - channel.start_consuming() - channel.close() - connection.close() - -if __name__ == '__main__': - queue = sys.argv[1] - run(queue) \ No newline at end of file diff --git a/queue_management/write_queue.py b/queue_management/write_queue.py deleted file mode 100644 index d74a907..0000000 --- a/queue_management/write_queue.py +++ /dev/null @@ -1,24 +0,0 @@ -import pika -import json -import logging -import sys - -logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.CRITICAL) - -def run(id): - credentials = pika.PlainCredentials('test', 'test') - connection = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials)) - channel = connection.channel() - queue = "requests" - #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"} - 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"} - channel.basic_publish(exchange='', - routing_key=queue, - properties=pika.BasicProperties(correlation_id = id), - body=json.dumps(message)) - channel.close() - connection.close() - -if __name__ == '__main__': - id = sys.argv[1] - run(id) \ No newline at end of file diff --git a/scripts/configure.sh b/scripts/configure.sh new file mode 100755 index 0000000..270ccac --- /dev/null +++ b/scripts/configure.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +OK="\033[32mOK\033[0m" +ERROR="echo -e '\033[31mERROR\033[0m'" + +set -e + +echo -n "Updating apt" +sudo apt-get -qq -y update && echo -n "." || eval $ERROR +sudo apt-get -qq -y upgrade && echo -n "." || eval $ERROR +sudo apt-get -qq -y update && echo -e ". $OK" || eval $ERROR + +echo -e "Obtaining RabbitMQ from rabbitmq.com APT Repository..." +echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list +wget -q -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add - +echo -n "Installing RabbitMQ" +sudo apt-get -qq -y update && echo -n "." || eval $ERROR +sudo apt-get install -qq -y rabbitmq-server && echo -n "." || eval $ERROR +sudo pip install -q pika && echo -e ". $OK" || eval $ERROR +echo -e "Enabling RabbitMQ management... " +sudo rabbitmq-plugins enable rabbitmq_management + +echo -n "Installing Graylog" +sudo pip install -q graypy && echo -n ".." || eval $ERROR +sudo pip install -q graypy[amqp] && echo -e ". $OK" || eval $ERROR + +echo -n "Installing nodejs v4.x" +curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - &>/dev/null +sudo apt-get install -qq -y nodejs && echo -e "... $OK" || eval $ERROR + +echo -n "Installing Redis" +sudo apt-get install -qq -y redis-server && echo -e "... $OK" || eval $ERROR +echo -e "Restarting Redis server..." +sudo service redis-server restart + +echo -e "Obtaining MongoDB from repo.mongodb.org APT Repository..." +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 &>/dev/null +echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" \ + | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list +echo -n "Installing MongoDB" +sudo apt-get -qq -y update && echo -n "." || eval $ERROR +sudo apt-get install -qq -y mongodb-org && echo -e ".. $OK" || eval $ERROR + +echo -n "Installing FFmpeg" +sudo add-apt-repository -y ppa:mc3man/trusty-media &>/dev/null +sudo apt-get -qq -y update && echo -n "." || eval $ERROR +sudo apt-get install -qq -y ffmpeg && echo -e ".. $OK" || eval $ERROR + +read -r -p "You want to install VLibras Translate? [Y/n] " response +response=${response,,} #tolower +if [[ $response =~ ^(yes|y| ) ]]; then + echo -n "Obtaining VLibras Translate" + cd $HOME + git clone git@git.lavid.ufpb.br:vlibras-translate.git && echo -e "... $OK" || eval $ERROR + echo -e "Installing VLibras Translate" + cd vlibras-translate/scripts/linux + ./install.sh +fi + +read -r -p "You want to install VLibras Video Player? [Y/n] " response +response=${response,,} #tolower +if [[ $response =~ ^(yes|y| ) ]]; then + echo -n "Obtaining VLibras Video Player" + wget -q http://150.165.204.30:8080/core/linux/unityVideo.tar.gz && echo -e "... $OK" || eval $ERROR + echo -n "Installing VLibras Video Player" + sudo apt-get install -qq -y xvfb && echo -n "." || eval $ERROR + sudo pip install -q pyvirtualdisplay && echo -n "." || eval $ERROR + tar -xf unityVideo.tar.gz -C $HOME && echo -e ". $OK" || eval $ERROR + rm unityVideo.tar.gz +fi + +LIBRASDIR=$HOME/vlibras-contents/libras +VIDEOSDIR=$HOME/vlibras-contents/videos + +mkdir -p $LIBRASDIR $VIDEOSDIR + +echo -n "Creating environment variables... " +TEMP_ENV=$(mktemp) +echo "export VLIBRAS_VIDEO_CREATOR=$HOME/unityVideo/videoCreator.x86_64" > $TEMP_ENV +echo "export VLIBRAS_VIDEO_LIBRAS=$HOME/vlibras-contents/libras" >> $TEMP_ENV +echo "export VLIBRAS_VIDEO_MIXED=$HOME/vlibras-contents/videos" >> $TEMP_ENV +sudo install -m 755 $TEMP_ENV -D /etc/profile.d/vlibras-video-env.sh && echo -e $OK || eval $ERROR +rm -f TEMP_ENV +echo -e "Restart the computer to finalize installation." diff --git a/scripts/configureDocker.sh b/scripts/configureDocker.sh new file mode 100755 index 0000000..4a56cb3 --- /dev/null +++ b/scripts/configureDocker.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +OK="\033[32mOK\033[0m" +ERROR="echo -e '\033[31mERROR\033[0m'" +version=$(lsb_release -sr) + +set -e + +echo -n "Updating apt" +sudo apt-get -y -qq update && echo -e "... $OK" || eval $ERROR + +echo -n "Installing linux images" +sudo apt-get install -y -qq linux-image-extra-$(uname -r) linux-image-extra-virtual && echo -e "... $OK" || eval $ERROR + +echo -n "Installing HTTPS" +sudo apt-get install -y -qq apt-transport-https && echo -e "... $OK" || eval $ERROR + +echo -n "Installing ca-certificates" +sudo apt-get install -y -qq ca-certificates && echo -e "... $OK" || eval $ERROR + +echo -e "Adding keyserver..." +sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D &>/dev/null + +if [ "$version" = "16.04" ] || [ "$version" = "16.10" ]; then + echo -e "Adding docker path to sources - VERSION: ${version}" + echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list +else + echo -e "Adding docker path to sources - VERSION: ${version}" + echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list +fi + +echo -n "Updating apt" +sudo apt-get -y -qq update && echo -e "... $OK" || eval $ERROR + +echo -n "Removing lxc" +sudo apt-get -y -qq purge lxc-docker && echo -e "... $OK" || eval $ERROR + +echo -n "Caching docker-engine" +sudo apt-cache policy docker-engine &>/dev/null && echo -e "... $OK" || eval $ERROR + +echo -n "Installing docker-engine" +sudo apt-get install -y -qq docker-engine && echo -e "... $OK" || eval $ERROR diff --git a/scripts/dictUpdate.sh b/scripts/dictUpdate.sh new file mode 100644 index 0000000..3a99494 --- /dev/null +++ b/scripts/dictUpdate.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +echo -e "\n\033[32m##### Atualizando dicionário #####\033[0m\n" + +NOT_INSTALLED=false +DIR=/opt/vlibras_desktop/vlibras_player_Data/Bundles +PLAYER_DATA="$HOME/unityVideo/videoCreator_Data" +BUNDLES="$PLAYER_DATA/Bundles" + +function check_update_patches() +{ + count=0 + for d in "$DIR/*" ; do + count=$((count+1)) + apt-get install --only-upgrade --force-yes --yes patch${count}.0.0 > /dev/null 2>&1 + done +} + +if [ ! -f /etc/apt/sources.list.d/dicionario-vlibras.list ]; then + # Add repository to update the dictionary + echo 'deb http://150.165.204.46:8080 precise main' | sudo tee /etc/apt/sources.list.d/dicionario-vlibras.list > /dev/null 2>&1 +fi + +PKG_DICT=$(dpkg-query -W --showformat='${Status}\n' dicionario-vlibras:i386|grep "install ok installed") +if [ "" == "$PKG_DICT" ]; then + NOT_INSTALLED=true + sudo apt-get install --force-yes --yes dicionario-vlibras:i386 +else + sudo apt-get update + check_update_patches + sudo apt-get install --only-upgrade --force-yes --yes dicionario-vlibras:i386 +fi + +#remove pasta bundles +if [ -d "$BUNDLES" ] ; then + rm -r $BUNDLES +fi + +#copia dicionário para pasta de bundles +cp -r $DIR $PLAYER_DATA +cd $BUNDLES +rm *.description + +#remove pacote +if [ "$NOT_INSTALLED" = true ] ; then + sudo apt-get autoremove -y dicionario-vlibras:i386 +fi \ No newline at end of file diff --git a/test/read_queue.py b/test/read_queue.py new file mode 100644 index 0000000..3c27fe5 --- /dev/null +++ b/test/read_queue.py @@ -0,0 +1,25 @@ +import pika +import json +import sys + +def read(ch, method, properties, body): + try: + print str(type(body)) + " | " + json.loads(body)["text"] + except: + print str(type(body)) + " | " + body + +def run(queue_name): + credentials = pika.PlainCredentials('test', 'test') + connection = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials)) + channel = connection.channel() + channel.basic_qos(prefetch_count=1) + channel.basic_consume(read, + queue=queue_name, + no_ack=True) + channel.start_consuming() + channel.close() + connection.close() + +if __name__ == '__main__': + queue = sys.argv[1] + run(queue) \ No newline at end of file diff --git a/test/write_queue.py b/test/write_queue.py new file mode 100644 index 0000000..d74a907 --- /dev/null +++ b/test/write_queue.py @@ -0,0 +1,24 @@ +import pika +import json +import logging +import sys + +logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.CRITICAL) + +def run(id): + credentials = pika.PlainCredentials('test', 'test') + connection = pika.BlockingConnection(pika.ConnectionParameters(host='150.165.205.10', credentials=credentials)) + channel = connection.channel() + queue = "requests" + #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"} + 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"} + channel.basic_publish(exchange='', + routing_key=queue, + properties=pika.BasicProperties(correlation_id = id), + body=json.dumps(message)) + channel.close() + connection.close() + +if __name__ == '__main__': + id = sys.argv[1] + run(id) \ No newline at end of file -- libgit2 0.21.2