Commit 4175797ce6d193cba01b24595e28e03c164dbe2a

Authored by Wesnydy Ribeiro
1 parent c2363d8a

Add video Creator installer and environment variables configuration

Showing 2 changed files with 31 additions and 3 deletions   Show diff stats
core/renderer.py
@@ -40,7 +40,7 @@ PATH_LIBRAS = os.getenv("VLIBRAS_VIDEO_LIBRAS") @@ -40,7 +40,7 @@ PATH_LIBRAS = os.getenv("VLIBRAS_VIDEO_LIBRAS")
40 VIDEO_CREATOR = os.getenv("VLIBRAS_VIDEO_CREATOR") 40 VIDEO_CREATOR = os.getenv("VLIBRAS_VIDEO_CREATOR")
41 41
42 #Temporary 42 #Temporary
43 -PATH_SCREENS = "/storage/frames/" 43 +PATH_FRAMES = os.getenv("VLIBRAS_VIDEO_FRAMES")
44 44
45 # Status of renderer to process new requests. Answer one request at a time. 45 # Status of renderer to process new requests. Answer one request at a time.
46 worker_available = True 46 worker_available = True
@@ -172,7 +172,7 @@ def run(ch, method, properties, body): @@ -172,7 +172,7 @@ def run(ch, method, properties, body):
172 except: 172 except:
173 filesize = 0 173 filesize = 0
174 174
175 - body = {"file": properties.correlation_id+".mp4", "size": filesize} 175 + body = {"file": properties.correlation_id+".mp4", "size": filesize, "status": "success"}
176 json.dumps(body) 176 json.dumps(body)
177 177
178 manager.send_to_queue("videos", body, properties) 178 manager.send_to_queue("videos", body, properties)
@@ -185,7 +185,7 @@ def run(ch, method, properties, body): @@ -185,7 +185,7 @@ def run(ch, method, properties, body):
185 #Temporary 185 #Temporary
186 def clean(id): 186 def clean(id):
187 # logger.info("Cleaning screens files") 187 # logger.info("Cleaning screens files")
188 - path = os.path.join(PATH_SCREENS, id) 188 + path = os.path.join(PATH_FRAMES, id)
189 rmtree(path, ignore_errors=True) 189 rmtree(path, ignore_errors=True)
190 190
191 def keep_alive(conn_send, conn_receive): 191 def keep_alive(conn_send, conn_receive):
scripts/configure.sh
@@ -38,3 +38,31 @@ if [[ $response =~ ^(yes|y| ) ]]; then @@ -38,3 +38,31 @@ if [[ $response =~ ^(yes|y| ) ]]; then
38 cd vlibras-translate/scripts/linux 38 cd vlibras-translate/scripts/linux
39 ./install.sh 39 ./install.sh
40 fi 40 fi
  41 +
  42 +read -r -p "You want to install VLibras Video Player? [Y/n] " response
  43 +response=${response,,} #tolower
  44 +if [[ $response =~ ^(yes|y| ) ]]; then
  45 + echo -n "Obtaining VLibras Video Player"
  46 + wget -q http://150.165.204.30:8080/core/linux/unityVideo.tar.gz && echo -e "... $OK" || eval $ERROR
  47 + echo -n "Installing VLibras Video Player"
  48 + sudo apt-get install -qq -y xvfb && echo -n "." || eval $ERROR
  49 + sudo pip install -q pyvirtualdisplay && echo -n "." || eval $ERROR
  50 + tar -xf unityVideo.tar.gz -C $HOME && echo -e ". $OK" || eval $ERROR
  51 + rm unityVideo.tar.gz
  52 +fi
  53 +
  54 +LIBRASDIR=$HOME/vlibras-contents/libras
  55 +VIDEOSDIR=$HOME/vlibras-contents/videos
  56 +FRAMESDIR=$HOME/vlibras-contents/frames
  57 +
  58 +mkdir -p $LIBRASDIR $VIDEOSDIR $FRAMESDIR
  59 +
  60 +echo -n "Creating environment variables... "
  61 +TEMP_ENV=$(mktemp)
  62 +echo "export VLIBRAS_VIDEO_CREATOR=$HOME/unityVideo/videoCreator.x86_64" > $TEMP_ENV
  63 +echo "export VLIBRAS_VIDEO_LIBRAS=$HOME/vlibras-contents/libras" >> $TEMP_ENV
  64 +echo "export VLIBRAS_VIDEO_MIXED=$HOME/vlibras-contents/videos" >> $TEMP_ENV
  65 +echo "export VLIBRAS_VIDEO_FRAMES=$HOME/vlibras-contents/frames" >> $TEMP_ENV
  66 +sudo install -m 755 $TEMP_ENV -D /etc/profile.d/vlibras-video-env.sh && echo -e $OK || eval $ERROR
  67 +rm -f TEMP_ENV
  68 +echo -e "Restart the computer to finalize installation."