#/bin/bash

#monitor the PS4 Warframe twitter feed for phat loots ~ reddit.com/u/vipertech2 ~ 24 Feb 2014

# not my most optimized code, but it works...

# Runs on OSX but should work on Linux with a little bit of tweaking.

#Informs user of a Aura, Resource, or Blueprint

#gvars#

IFS =$ '

'

gcount = 1

aryatmp =

aratmpcmp =

#function checks the twitter feed via curl & formats the findings into an array#

getnew ( ) {

aryatmp = ( $ ( for i in $ ( curl https: // twitter.com / WFAlertsPS4 2 > / dev / null | grep -B 10 js-tweet-text | awk '/Aura/ || /Blueprint/ || /Resource/ || /WFAlertsPS4\/status/' | grep -B 1 js-tweet-text | grep -v "\-\-" ) ; do

if [ $ ( ( gcount % 2 ) ) -eq 0 ] ; then

echo -n " ~ "

echo $i | cut -d ">" -f2 | cut -d "<" -f1 | awk -F " - " '{print $2" ~ "$1" ~ "$4" ~ "$3}'

else

echo $i | cut -d ">" -f3 | cut -d "<" -f1 | tr -d "

"

fi

gcount =$ ( ( $gcount + 1 ) )

done ) )

}

#infinite while loop that calls the "getnew" function, then alerts the user if there is a new alert of interest#

while true ; do

getnew

a =$ ( echo ${aryatmp[0]} | cut -d " " -f3, 5 | base64 )

b =$ ( echo $aratmpcmp | cut -d " " -f3, 5 | base64 )

tst = "Cg=="

if [ [ " $a " == " $tst " ] ] ; then

echo blah > / dev / null

else

if [ [ " $a " == " $b " ] ] ; then

echo blah > / dev / null

else

#un-comment below to see the whole list of results

#echo ${aryatmp[@]};echo -e "\a\a\a\a"

#comment out the line below if you un-comment the line above

echo -n ${aryatmp[0]} ; echo -e "\a\a\a\a"

say -v Ralph New Warframe Alert Detected > / dev / null

fi

aratmpcmp = ${aryatmp[0]}

fi

sleep 10