Graphical wget

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

  1. bashcommando

    bashcommando Active Member

    Joined:
    Jan 28, 2014
    Messages:
    223
    Likes Received:
    49
    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

    Joined:
    Aug 4, 2012
    Messages:
    1,830
    Likes Received:
    635
    Best Answer
    aria2.sourceforge.net/
     
  3. DevynCJohnson

    DevynCJohnson Well-Known Member Staff Member Staff Writer

    Joined:
    May 21, 2013
    Messages:
    1,635
    Likes Received:
    1,270
    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

    Joined:
    Jan 28, 2014
    Messages:
    223
    Likes Received:
    49
    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

    Joined:
    May 21, 2013
    Messages:
    1,635
    Likes Received:
    1,270
    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

    Joined:
    Dec 13, 2013
    Messages:
    341
    Likes Received:
    178
    or re-coding it
     
    DevynCJohnson likes this.
  7. bashcommando

    bashcommando Active Member

    Joined:
    Jan 28, 2014
    Messages:
    223
    Likes Received:
    49
    How would I recode it? Or how do I get it to output the percentage?
     
  8. Yesyesloud

    Yesyesloud Active Member

    Joined:
    Dec 13, 2013
    Messages:
    341
    Likes Received:
    178
    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

    Joined:
    Aug 4, 2012
    Messages:
    1,830
    Likes Received:
    635
    Best Answer
    aria2.sourceforge.net/
     
  10. bashcommando

    bashcommando Active Member

    Joined:
    Jan 28, 2014
    Messages:
    223
    Likes Received:
    49
    I barley know C. Oh well...
     

Share This Page