1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
agent="$URL_AGENT"
proxy="$URL_PROXY"
refer="$URL_PREFIX"
userid="$URL_USERID"
secret="$URL_SECRET"
cookies="$ARGS_SESSION_COOKIES"
convert="$ARGS_CONVERT"
rate="ARGS_RATE"
file="$ARGS_PATH"
url="$ARGS_URL"
query="$ARGS_QUERY"
encoding="$ARGS_ENCODING"
format=""
rate="-r8000"
if test -f "$cookies" ; then
load="--load-cookies $cookies" ; fi
save="--save-cookies $cookies"
if test ! -z "$convert" ; then
case ${convert} in
*.au|*.snd)
format="-U"
;;
*.wav|*.raw)
format="-sw"
;;
*.vox)
rate=""
encoding=""
;;
*.gsm|*.ul|*.al|*.sw|*.uw)
encoding=""
;;
esac
fi
if test ! -z "$encoding" ; then
case ${encoding} in
*ulaw)
format="-U"
;;
alaw)
format="-A"
;;
gsm)
format="-tgsm"
;;
esac
fi
if test ! -z "$refer" ; then
refer="--referer=$refer" ; fi
if test ! -z "$agent" ; then
agent="--user-agent=$agent" ; fi
if test ! -z "$proxy" ; then
export http_proxy="$proxy"
export ftp_proxy="$proxy"
if test ! -z "$userid" ; then
proxy_userid="--proxy-user=$userid" ; fi
if test ! -z "$secret" ; then
proxy_secret="--proxy-secret=$secret" ; fi
fi
rm -f ${file}
if test ! -z "$convert" ; then
rm -f ${convert} ; fi
if test ! -z "$query" ; then
url=${url}${query} ; fi
wget $load $save -q --passive-ftp -O ${file} \
"$agent" "$refer" $userid $secret ${url}
if test "$?" -gt 0 ; then
rm -f ${file}
echo "$PORT_TSESSION error url-failed"
exit 0
fi
if test ! -f ${file} ; then
echo "$PORT_TSESSION error url-invalid"
exit 0
fi
if test -z "$convert" ; then
exit 0 ; fi
sox ${file} $rate $format -c1 ${convert}
rm -f ${file}
if test "$?" -gt 0 ; then
rm -f ${convert}
echo "$PORT_TSESSION error convert-failed" ; fi
exit 0
|