#!/bin/bash
#===============================================================================
#
#          FILE:  script.sh
# 
#         USAGE:  ./script.sh 
# 
#   DESCRIPTION:  
# 
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR:  John Ryland (JR), (jryland@invertedlogic.com)
#       COMPANY:  InvertedLogic
#       VERSION:  1.0
#       CREATED:  09/04/2011
#      REVISION:  ---
#===============================================================================

curl -q http://www.abc.net.au/iview/xml/config.xml 2>&1 | cut -d "\"" -f 2,4 | sed s/\"/=/ | grep "=" | grep -v "1.0=utf-8" > .config.sh
. ./.config.sh
rm ./.config.sh

# curl -q ${api}seriesIndex > .index.xml
SERIES=3176813 # `cat .index.xml | tr "[" "\n" | grep "Peppa" | cut -d "\"" -f 4`
TOKEN=`curl -q $auth 2>&1 | grep "token" | tr -d " " | tr "<>" "  " | cut -d " " -f 3`
curl -q ${api}series=$SERIES > .series3.xml

echo "SERIES = $SERIES"

PARAMS='-m "120" -W "http://www.abc.net.au/iview/images/iview.jpg"'
SERVER='-r rtmp://203.18.195.10/' # not ${server_streaming} !!

# filename=kids\/peppa_11_02_11.mp4
# filename=news/landline_110403
filename=wikileaks_11_xx_xx.mp4
# filename=mp4:peppa_11_02_11

PATH=kids/
FILE=wotwots_10_01_16
EXT=mp4

rtmpdump ${SERVER} ${PARAMS} -a "ondemand?auth=${TOKEN}" -y "${EXT}:${PATH}${FILE}" -o "${FILE}.${EXT}" 

# http://tviview.abc.net.au/iview/rss/category/pre-school.xml


