Skip to content
Browse files

wgetzen: goodbye

  • Loading branch information...
1 parent 0380669 commit 8c6af7e6c5da8d1541f9825574ae2e76d1ae5159 @falconindy committed
Showing with 0 additions and 34 deletions.
  1. +0 −34 wgetzen
View
34 wgetzen
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-# wgetzen - a wrapper for wget using zenity
-
-type -P zenity >/dev/null || { printf "zenity binary not found!\n"; exit 1; } >&2
-
-# files: change these if needed/wanted
-wgetfifo=/tmp/wgetfifo
-cookiefile=~/.config/jumanji/cookies
-
-(( $# == 0 )) && exit
-src=$1
-dst=$(zenity --file-selection --filename="$DEFAULT_DIR/${src##*/}" --directory --save)
-
-# progs: less likely you'll want to change these
-_wget() { wget -c --load-cookies "$cookiefile" "$src" -O "$dst"; }
-_zenity() { zenity --progress --auto-close --title "Downloading to $dst" --text "$src"; }
-
-# insure that wget is killed if the script ends before it does
-trap_exit() {
- [[ -p "$wgetfifo" ]] && rm -f "$wgetfifo"
- [[ -d /proc/$wgetpid ]] && kill $wgetpid
-}
-trap 'trap_exit' HUP INT EXIT
-
-# it's not possible to tie wget directly to zenity because we need wget's PID
-# in order to kill it when the cancel button is pressed on the zenity dialog.
-[[ ! -p $wgetfifo ]] && { mkfifo $wgetfifo || exit 2; }
-
-_wget "$@" &> "$wgetfifo" &
-wgetpid=$!
-
-_zenity < <(sed -u 's/ *[0-9]*K[\ \.]\+\([0-9]\+\)%.*/\1/p' < "$wgetfifo")
-

0 comments on commit 8c6af7e

Please sign in to comment.
Something went wrong with that request. Please try again.