About BK Puppy file downlaoder [SOLVED]

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

About BK Puppy file downlaoder [SOLVED]

#1 Post by Argolance »

Hello,
Using the wget option [-O], it is possible to download a file to any chosen directory/filename. For example:

Code: Select all

# 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 :cry: :

Code: Select all

# 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, 17:30, edited 1 time in total.

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#2 Post by RSH »

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
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#3 Post by sc0ttman »

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: Select all

#!/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="Прогре
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#4 Post by Argolance »

Hello,
Thank you for answering...
@RSH,
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 :oops:
For example (usage: techscript.sh URL [output file]):

Code: Select all

# ./techscript.sh http://mysite/puppylinuxstuff/picture.png  /root/my-documents/my-pictures/filename.png
Did I miss something?

EDIT:
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: Select all

# ./techscript.sh http://mysite/puppylinuxstuff/picture.png  /root/my-documents/my-pictures/
Cordialement.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#5 Post by Argolance »

Hello,
I found 'a' solution:
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: Select all

# 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/
8)

Thank you!
Cordialement.

Post Reply