#!/usr/bin/env bash
PREFIX=/tmp
NAME=alicevision
PROJECT=alicevision/meshroom
#RELEASE=$(curl -s https://api.github.com/repos/${PROJECT}/releases/latest | grep tarball_url | cut -d '"' -f 4 | awk -F "/" {'print $8'}|)

RSS_FEED="https://github.com/${USER}/${PROJECT}/releases.atom"
# xdg-open ${RSS_FEED}
echo ${RSS_FEED}

DOWNLOAD_URL=$(curl -s https://api.github.com/repos/${PROJECT}/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep linux)

FILENAME=$(echo $DOWNLOAD_URL | sed "s/.*\///")

wget -c --directory-prefix ${PREFIX} ${DOWNLOAD_URL}

cd /tmp

tar -xzvf ${FILENAME}

cd /tmp/${FILENAME}
sudo pip install -r requirements.txt
