#!/bin/bash headOut() { touch ../tmp/tmpalphaListing letterIn=$(echo "$QUERY_STRING" | sed -n 's/^.*letter=\([^&]*\).*$/\1/p') wget http://www.crunchyroll.com/videos/anime/alpha?group=$letterIn -O ../tmp/tmpalphaListing sed 1,650d ../tmp/tmpalphaListing > ../tmp/alphaListing IFS=$'\n' bgs=($(ls -L ../backgrounds/)) numdirs=${#bgs[@]} index=$(( (( RANDOM % $numdirs ) - 2) + 1 )) if [ -f ./000.jpg ]; then bg="
"; else bg="
"; fi echo ' MiniRoll App '${bg}'

' > ../tmp/alist.html main } main() { sed -n 's/.*title="\([^"]*\).*/\1/p' ../tmp/alphaListing > ../tmp/preaTitles head -n -6 ../tmp/preaTitles > ../tmp/aTitles sed -n 's/.*src="\([^"]*\).*/\1/p' ../tmp/alphaListing > ../tmp/preaImgList sed -i '/.js/d' ../tmp/preaImgList sed -i '/.gif/d' ../tmp/preaImgList cat ../tmp/preaImgList > ../tmp/aImgList sed -n 's/.*group_id="\([^"]*\).*/\1/p' ../tmp/alphaListing > ../tmp/tmpaGrpIds head -n -7 ../tmp/tmpaGrpIds > ../tmp/aGrpIds d=$(cat ../tmp/aGrpIds | wc -l) >> /dev/null ; i="1" while [ $i -le $d ]; do title=$(sed -n "${i}p" ../tmp/aTitles); imgLnk=$(sed -n "${i}p" ../tmp/aImgList); groupID=$(sed -n "${i}p" ../tmp/aGrpIds); vdoLnk="http://www.crunchyroll.com/swf/StandardVideoPlayer.swf?config_url=http%3A%2F%2Fwww.crunchyroll.com%2Fxml%2F%3Freq%3DRpcApiVideoPlayer_GetStandardConfig%26media_id%3D"$groupID"" echo '

'${title}'
' >> ../tmp/alist.html ; i=$[$i++1]; done endOut } endOut() { echo ' ' >> ../tmp/alist.html redirect } redirect() { echo "Content-type: text/html" echo "" echo "" echo "" echo "Loading..." echo "" echo "" echo "" echo "
You will be redirected in a few seconds... " echo "
" echo "" echo "" } headOut