-#!/bin/sh
+#!/bin/bash
if [ -z "$1" ] ; then
echo "ERROR: missing mandatory argument"
GENOPT="-c --retry-connrefused --auth-no-challenge --progress=bar"
OUTOPT="-O"
[ -n "$USER" ] && [ -n "$PASS" ] && HTTP_AUTH="--user=$USER --password=$PASS"
- # NOTE: GNU Wget2 1.99.1 gives "Unknown option 'limit-rate'
+ # NOTE: GNU Wget2 1.99.1 --limit-rate is broken, option not implemented!
#[ -n "$BWLDOWN" ] && BWLIM="--limit-rate=$BWLDOWN"
;;
esac
# Got an URL for the file parameter.
TMP_FILE=$(mktemp kaoget_XXXX)
case "$URL_FILE" in
+ *"&s=1&q="* )
+ # URL appears to point to a directory, fetch the listing!
+ URL_FILE="${URL_FILE%%&*}"
+ URL_FILE="${URL_FILE/leech.php/leechx.php/}&q=1&m=0"
+ $GETTER $GENOPT $HTTP_AUTH $OUTOPT "$TMP_FILE" "$URL_FILE$GET_AUTH"
+ ;;
*"&q=1&m=0" )
# URL appears to point to a generated listing, fetch it!
$GETTER $GENOPT $HTTP_AUTH $OUTOPT "$TMP_FILE" "$URL_FILE$GET_AUTH"
;;
* )
# Otherwise, just store the URL verbatim.
- echo "echo $URL_FILE > $TMP_FILE"
echo "$URL_FILE" > $TMP_FILE
;;
esac