Mercurial > ec-dotfiles
changeset 231:4c0fd276665e
- for some reason I broke the getopts logic again. Fixed
author | edhoprima |
---|---|
date | Sat, 13 Mar 2010 20:42:01 +0000 |
parents | e922fb1e858f |
children | 5438d80244a3 |
files | moefetch.sh |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/moefetch.sh Tue Mar 09 04:37:07 2010 +0000 +++ b/moefetch.sh Sat Mar 13 20:42:01 2010 +0000 @@ -126,7 +126,7 @@ while [ "${__tempnum}" -ge 1000 ]; do __url="http://${SITE}/post/index.xml?tags=$(get_cleantags "${TAGS}")&offset=0&limit=1000&page=${__iternum}" [ ${_use_login} -eq 1 ] && __url="${__url}&login=${LOGIN_USER}&password_hash=${LOGIN_PASS}" - wget "${__url}" -O "${TEMP_PREFIX}-xml" -e continue=off || Err_Fatal "Failed download catalog file" + wget --quiet "${__url}" -O "${TEMP_PREFIX}-xml" -e continue=off || Err_Fatal "Failed download catalog file" printf "Processing XML file... " # xslt evilry xsltproc - "${TEMP_PREFIX}-xml" <<EOF | sed 's/.*\(http.*\)\(\/[a-f0-9]\{32\}\).*\.\([^\.]*\)/\1\2.\3/g' | grep ^http > "${TEMP_PREFIX}-templist" @@ -307,9 +307,9 @@ if [ "$(echo $(wc -l < "${TEMP_PREFIX}-newlist"))" -eq 0 ]; then echo "No new file" else - printf "Starting wget... " + printf "Downloading files... " cd "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}" - wget -e continue=on -bi "${TEMP_PREFIX}-newlist" -o "${TEMP_PREFIX}.log" + wget -e continue=on -i "${TEMP_PREFIX}-newlist" -o "${TEMP_PREFIX}.log" fi } @@ -345,7 +345,8 @@ TAGS= __has_pass=0 __has_user=0 - while getopts "s:(site)n(noclean)u:(user)p:(password)" opt + x=1 + while getopts "s:nu:p:" opt do case "$opt" in s) SITE="$OPTARG";; @@ -359,7 +360,10 @@ __has_user=1 ;; esac + x=$OPTIND done + shift $(($x-1)) + if [ "$1" = -- ]; then shift; fi TAGS="$@" [ -n "${SITE}" ] || SITE=${DEFAULT_SITE} [ -n "${TAGS}" ] || Err_Fatal "No tag specified"