The time now is Sun 22 Apr 2018, 09:55
All times are UTC - 4 |
Author |
Message |
Argolance

Joined: 06 Jan 2008 Posts: 3255 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Fri 30 Nov 2012, 08:38 Post subject:
About BK Puppy file downlaoder [SOLVED] |
|
Hello,
Using the wget option [-O], it is possible to download a file to any chosen directory/filename. For example: Code: | # wget http://mysite/puppylinuxstuff/picture.png -O /root/my-documents/my-pictures/filename.png |
The BK script 'download_file', (which seems to be a GUI for wget) automatically downloads files to /root. I would like to be able to choose, at least, the target directory. Is there a way to do it using a command line and without having to modify the original script?
For example, I tried this but : Code: | # download_file http://mysite/puppylinuxstuff/picture.png > /root/my-documents/my-pictures/filename.png |
Thank you.
Cordialement.
_________________

Last edited by Argolance on Fri 30 Nov 2012, 13:30; edited 1 time in total
|
Back to top
|
|
 |
RSH

Joined: 05 Sep 2011 Posts: 2420 Location: Germany
|
Posted: Fri 30 Nov 2012, 11:10 Post subject:
|
|
Hi.
i do use wget-option --directory-prefix=$LP2BDL wherein $LP2BDL is the LazY Puppy boot directory to download the LazY Puppy sfs files from the RunScripts directly to the boot directory.
After download you can rename the downloaded file using bash command mv if needed.
RSH
_________________ LazY Puppy
RSH's DNA
SARA B.
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2571 Location: UK
|
Posted: Fri 30 Nov 2012, 11:29 Post subject:
|
|
Save the following as 'download_progress':
the 1st option is the URL to download, the 2nd (optional) parameter is the output filename, or output dir (if it's a dir)
Code: | #!/bin/bash
# original script by technosaurus
#18012012: fixed to work on akita: no busybox, wget -c, added some translations, error checking, etc
#usage, cli options
{
[ "$1" = "" ] && echo "Usage: $(basename $0) URL [output file]" && exit 1
if [ "$2" != "" ];then # add output file or dir, if given
[ -f "$2" ] && OUTPUTFILE="-O$2"
[ -d "$2" ] && OUTPUTFILE="-P$2"
else
OUTPUTFILE=''
fi
export OUTPUTFILE
}
# i18n, translations
{
[ $myLANG ] || myLANG=${LANGUAGE%% *}
[ $myLANG ] || myLANG=${LANG%_*}
case $myLANG in
de*)
Loc_downloading_file="Download der Datei"
Loc_download_progess="Download-Fortschritt"
Loc_files_remaining="Dateien übrig"
Loc_current_file_is="Aktuelle Datei ist"
;;
es*)
Loc_downloading_file="Descargar el fichero"
Loc_download_progess="El progreso de descarga"
Loc_files_remaining="archivos restantes"
Loc_current_file_is="Archivo actual es"
;;
fr*)
Loc_downloading_file="Fichiers en cours de téléchargement"
Loc_download_progess="Progression du téléchargement en cours"
Loc_files_remaining="Fichier(s) restant(s)"
Loc_current_file_is="Le fichier actuellement en téléchargement est"
;;
nl*)
Loc_downloading_file="Downloaden bestand"
Loc_download_progess="Download vooruitgang"
Loc_files_remaining="bestanden over"
Loc_current_file_is="De huidige bestand is"
;;
ru*)
Loc_downloading_file="Загрузка файла"
Loc_download_progess="Прогресс загрузки"
Loc_files_remaining="файл. осталось"
Loc_current_file_is="Текущий файл"
;;
*);;
esac
}
download_progress(){ #pass a file as $1 to download with a GUI progress bar
while ([ $# -gt 0 ]) do
LANG=C # should avoid wget returning weird values
wget "$OUTPUTFILE" -4 -c "$1" 2>&1 | while read LINE; do
case $LINE in
*%*)LINE=${LINE##*..};echo ${LINE%%%*};;
esac
done |Xdialog --wm-class "button" --title "${Loc_downloading_file:-Downloading File}" --gauge "${Loc_download_progess:-Download progress} ($# ${Loc_files_remaining:-files remaining}.)
${Loc_current_file_is:-Current file is}:
$1" 0 0
shift
done
}
download_progress "${1}" |
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
Argolance

Joined: 06 Jan 2008 Posts: 3255 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Fri 30 Nov 2012, 12:27 Post subject:
|
|
Hello,
Thank you for answering...
@RSH, Quote: | After download you can rename the downloaded file using bash command mv if needed. | I wanted to use the BK script, because it tests if file exists, has already been completely or just partially downloaded and so on, displays a progress bar instead of the classical wget urxvt window and is already 'gettexted'. I could indeed simply move/rename the downloaded /root/file but I am not sure the file is always downloaded at this place, depending (perhaps?) on the running Puppy mode (?).
Question: is the file always downloaded at this place?
@sc0ttman,
The script by technosaurus is quite interesting but doesn't make all what I am waiting for. If downloaded file already exists, windows appears quickly and closes immediately, and user don't know exactly what happens.
Else: Sorry, I could not define the output directory/filename. File is downloaded in the script directory
For example (usage: techscript.sh URL [output file]): Code: | # ./techscript.sh http://mysite/puppylinuxstuff/picture.png /root/my-documents/my-pictures/filename.png |
Did I miss something?
EDIT: Quote: | he 1st option is the URL to download, the 2nd option is the output filename, or output dir (if it's a dir) | Okay, okay:
Code: | # ./techscript.sh http://mysite/puppylinuxstuff/picture.png /root/my-documents/my-pictures/ |
Cordialement.
_________________

|
Back to top
|
|
 |
Argolance

Joined: 06 Jan 2008 Posts: 3255 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Fri 30 Nov 2012, 13:21 Post subject:
|
|
Hello,
I found 'a' solution:
Quote: | Question: is the file always downloaded at this place? | I well noticed it was not always the same place, probably depending on the rox-filer active directory window (?) Code: | # cd /root/my-documents/my-pictures/
# download_file http://mysite/puppylinuxstuff/picture.png |
... and I find my downloaded file in /root/my-documents/my-pictures/
Thank you!
Cordialement.
_________________

|
Back to top
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|