Graphical wget

Discussion in 'Command Line' started by bashcommando, Apr 18, 2014.

  1. bashcommando

    bashcommando Active Member

    Messages:
    135
    Likes Received:
    32
    Trophy Points:
    28
    I am trying to make a graphical version of what but how do I echo the percentage finished downloading? Here is my code so far:
    Code:
    #!/bin/sh
    export url=`zenity --entry --text="Enter URL" --title="gwget"`
    cd ~/Downloads
    (
    wget $url
    ) |
    zenity --progress --title="gwget" --text="Downloading..." --percentage 0
    exit 0
    How do I make it echo the percentage downloaded?

    DevynCJohnson likes this.
  2. ryanvade

    ryanvade Administrator Staff Member Staff Writer

    Messages:
    1,139
    Likes Received:
    383
    Trophy Points:
    83
  3. DevynCJohnson

    DevynCJohnson Well-Known Member Staff Member Staff Writer

    Messages:
    1,150
    Likes Received:
    979
    Trophy Points:
    113
    Does this article help - http://www.linux.org/threads/zenity-gui-for-shell-scripts.556

    You should read the article for extra info, but very quickly, this is how you do it - (echo "40"; COMPLEX_COMMAND; echo "60"; COMMAND) | zenity --progress --text="Working hard or hardly working?" --percentage=0 --auto-close

    However, I do not think there is a way to make wget output its download progress.
  4. bashcommando

    bashcommando Active Member

    Messages:
    135
    Likes Received:
    32
    Trophy Points:
    28
    The code above works BUT it will show 0% until it is finished downloading when it shows 100%. What I need help with is to have wget print or echo the percentage. But thanks for
    Code:
    --auto-close
    DevynCJohnson likes this.
  5. DevynCJohnson

    DevynCJohnson Well-Known Member Staff Member Staff Writer

    Messages:
    1,150
    Likes Received:
    979
    Trophy Points:
    113
    The only way you can get past the 0-100% issue is to get wget to occasionally output its downloading progress.
    Yesyesloud likes this.
  6. Yesyesloud

    Yesyesloud Active Member

    Messages:
    244
    Likes Received:
    124
    Trophy Points:
    43
    or re-coding it
    DevynCJohnson likes this.
  7. bashcommando

    bashcommando Active Member

    Messages:
    135
    Likes Received:
    32
    Trophy Points:
    28
    How would I recode it? Or how do I get it to output the percentage?
  8. Yesyesloud

    Yesyesloud Active Member

    Messages:
    244
    Likes Received:
    124
    Trophy Points:
    43
    Analyse the source to realize where and how exactly you should implement the code.

    As for the second question, it's up to you. Learning C is a good start.

    When you finally manage to output downloading percentage for wget in a clean way, you can send its maintainers your code, they'd probably make it official :)
  9. ryanvade

    ryanvade Administrator Staff Member Staff Writer

    Messages:
    1,139
    Likes Received:
    383
    Trophy Points:
    83
  10. bashcommando

    bashcommando Active Member

    Messages:
    135
    Likes Received:
    32
    Trophy Points:
    28
    I barley know C. Oh well...

Share This Page