Programs and scripts that are not yet internationalized

For efforts in internationalising Puppy and solving problems in this area
Message
Author
robwoj44
Posts: 399
Joined: Fri 08 Aug 2008, 18:15
Location: Warsaw

Programs and scripts that are not yet internationalized

#1 Post by robwoj44 »

I tried to internationalize 100% of racy/wary but there are still some scripts and programs not internationalized.
In Utility - gExec
So in total 1 program from main menu.
List updated.
Last edited by robwoj44 on Sat 17 Jan 2015, 21:40, edited 13 times in total.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Programs and scripts that are not yet internationalized

#2 Post by L18L »

Thank you for pointing to these scripts.

I hope that we can have all finished and
ready for Puppy's 10th anniversary. :idea:

PS
gexec is the most superfluos "app" I have ever seen.
Forget it, take a console and you will see also the error messages if any.
Just my humble opinion. 8)

urxvtset is for me I think.....

rodin.s
Posts: 344
Joined: Wed 22 Sep 2010, 19:50
Location: Ukraine

additional langpack for Wary/Racy

#3 Post by rodin.s »

I have some of these scripts internationalized in my additional langpack for Racy.
I could also name some untranslated scripts: GrubInstall and Frequency Scaling Tool.
Attachments
i18n_racy55-130331.pet
(38.69 KiB) Downloaded 703 times

User avatar
vicmz
Posts: 1262
Joined: Sun 15 Jan 2012, 22:47

#4 Post by vicmz »

Xlock is internationalised - it's just not-gettexted.

Set_global_font_size is another script that hasn't got any internationalisation method yet.

I think rodin.s had gettexted Pwsget last year, or I had done that from a more recent Puppy, I'll check later.
Attachments
image-12.png
(79.27 KiB) Downloaded 928 times
[url=http://murga-linux.com/puppy/viewtopic.php?t=76948]Puppy Linux en español[/url]

rodin.s
Posts: 344
Joined: Wed 22 Sep 2010, 19:50
Location: Ukraine

#5 Post by rodin.s »

Set_global_font_size is gettexted in new Precise, and new script there to translate is xorgwizard-cli.

robwoj44
Posts: 399
Joined: Fri 08 Aug 2008, 18:15
Location: Warsaw

#6 Post by robwoj44 »

большое

rodin.s
Posts: 344
Joined: Wed 22 Sep 2010, 19:50
Location: Ukraine

#7 Post by rodin.s »

Look into /usr/local/apps/Xlock/locale

User avatar
vicmz
Posts: 1262
Joined: Sun 15 Jan 2012, 22:47

#8 Post by vicmz »

robwoj44 wrote: muchos gracias vicmz, but where I can find the solution with Xlock, I looked at your langpack and could not find it.
Look at the pictures below. If you want to include the translation for Wallpaper6 (Nathan Wallpaper Setter, used in Slacko, some derivatives and OpenboxPlus), you have to follow the same steps, but with the Wallpaper app dir instead. Precise, Wary and Racy have got Pwallpaper, which is now gettexted and editable through Momanager.
Attachments
app-dir-xlock-look-inside.jpg
(55.84 KiB) Downloaded 924 times
edit-xlock-locale.jpg
(52.47 KiB) Downloaded 849 times
[url=http://murga-linux.com/puppy/viewtopic.php?t=76948]Puppy Linux en español[/url]

User avatar
vicmz
Posts: 1262
Joined: Sun 15 Jan 2012, 22:47

#9 Post by vicmz »

One more thing (either for Xlock or Wallpaper6):
Attachments
edit-xlock-xml.jpg
(133.63 KiB) Downloaded 940 times
[url=http://murga-linux.com/puppy/viewtopic.php?t=76948]Puppy Linux en español[/url]

robwoj44
Posts: 399
Joined: Fri 08 Aug 2008, 18:15
Location: Warsaw

#10 Post by robwoj44 »

Thank you for your help. It was easier than I thought.
I updated the list:
In Internet - Axel, SSH GUI, Pmirrorget, Puppy Podcast Grabber, Psip, Secure SSH
In Network - Gpptp, Pure FTPD
In Filesystem - PRename, gFnRename
In Utility - Pudd, Snap2, gExec
In System - Pdisk
Now only 14 applications.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Programs and scripts that are not yet internationalized

#11 Post by L18L »

Here is snap2
/usr/bin/mtpaintsnapshot.sh wrote:#!/bin/sh
#110116 change to yaf-splash.
#110312 rodin.s: adding gettext

export TEXTDOMAIN=mtpaintsnapshot #usr_sbin
export TEXTDOMAINDIR=/usr/share/locale
export OUTPUT_CHARSET=UTF-8
eval_gettext () {
local myMESSAGE=$(gettext "$1")
eval echo "$myMESSAGE"
}

#xmessage -center -bg "#ff00ff" -title "mtPaint screen snapshot utility" -buttons "" -timeout 8 "
#There will now be a pause of 10 seconds to allow you to adjust
#windows as you wish, then a snapshot will be taken of entire screen.
#
#Note, you can also take a snapshot of the main menu. Close this window,
#open the main menu to the desired layout, then wait until the 10 seconds
#has expired.
#
#This window will disappear in 8 seconds from its creation." &

yaf-splash -placement center -bg '#ff00ff' -timeout 10 -close box -text "$(gettext 'mtPaint screen snapshot utility

There will now be a pause of 13 seconds to allow you to adjust windows as you wish, then a snapshot will be taken of entire screen.

Note, you can also take a snapshot of the main menu. Close this window, open the main menu to the desired layout, then wait until the 13 seconds has expired.')" &

sleep 13
exec mtpaint -s
Update in 1st post ( use Edit button ) would be nice :)
Thank you.
Last edited by L18L on Sat 11 May 2013, 13:31, edited 1 time in total.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Programs and scripts that are not yet internationalized

#12 Post by L18L »

Attached is Pudd.

If you like my design ( html5 ) you can copy the help file to
/usr/share/doc/help/<your language>/Pudd.htm and translate there.

Pudd help will use this or if not existent then just /usr/share/doc/Pudd.htm.

BTW,
I think everyone can learn something while translating help files, I did.
Attachments
Pudd-i18n.tar.gz
/usr/sbin/Pudd
/usr/share/doc/help/de/Pudd.htm
(10.21 KiB) Downloaded 658 times

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Programs and scripts that are not yet internationalized

#13 Post by L18L »

I have found urxvt i18n'ed by rodin.s

added On/Off
version bumped to 0.6

Code: Select all

#!/bin/sh 

 ## urxvt terminal setup ##
 ## stu90 ##  ## L18L ##
 ## combobox -v2 
 ## transparency combobox -v3
 ## numeric fields, colorchoosers, font preview -v3a
 ## color using integrated colorchooser -v3b
 ## transparency shading -v0.5
 ## borderless window -v0.5
 #110818 rodin.s: adding gettext
 #130511 L18L: v0.6 added ON/OFF translatable
 
#export TEXTDOMAIN=puppy #urxvtset
export TEXTDOMAIN=urxvtset
export TEXTDOMAINDIR=/usr/share/locale
export OUTPUT_CHARSET=UTF-8
eval_gettext () {
  local myMESSAGE=$(gettext "$1")
  eval echo \"$myMESSAGE\"
}
 
 version=v0.6

 xdorig="$HOME/.Xdefaults" 
 xdtmp="/tmp/.Xdefaults" 
 xdback="$HOME/.Xdefaults.back" 

 if [ -f "$xdorig" ]; then 
  cp $xdorig $xdtmp 
  else 
  echo "No $xdorig file found exiting" 
 fi 


 ### get current urxvt theme information ###
 echo "Current Urxvt terminal settings" 
 
 ## foreground ##
 fcolour="`grep 'foreground'  $xdtmp | cut -s -d ":" -f 2`" 
 echo "$fcolour" 

 ## background ##
 bcolour="`grep 'background'  $xdtmp | cut -s -d ":" -f 2`" 
 echo "$bcolour" 
 
 ## cursor colour ##
 ccolour="`grep 'underlineColor'  $xdtmp | cut -s -d ":" -f 2`" 
 echo "$ccolour" 
 
 ## geometry ##
 geom="`grep 'geometry' $xdtmp | cut -s -d ":" -f 2`"
 echo "$geom"
 geomw="`echo $geom | cut -d "x" -f 1`"
 geomh="`echo $geom | cut -d "x" -f 2`" 

 ## font size ##
 fsize="`grep 'pixelsize' $xdtmp | cut -s -d "=" -f 3`" 
 echo "$fsize" 
 
 ## font ##
 font="`grep 'xft' $xdtmp | cut -s -d ":" -f 3`" 
 #echo "$font" 
 
 ## font style ##
 style="`grep 'style' $xdtmp | awk -F '[=:]' '{print $5}'`" 
 #echo "$style" 
 
 font_style="$font:$style" 
 echo "$font_style"
 
 ## transparency ##
 transp="`grep 'transparent' $xdtmp | cut -s -d ":" -f 2`" 
 #transp="`grep 'inherit' $xdtmp | awk -F '[:]' '{print $2}'`"
 if echo $transp | grep -q 'Off' ; then 
 trans="$(gettext 'Off')!$(gettext 'On')"
 else
 trans="$(gettext 'On')!$(gettext 'Off')"
 fi
 echo "$transp"
 
 ## transparency shading ##
 shade="`grep 'shading'  $xdtmp | cut -s -d ":" -f 2`" 
 echo "$shade" 
 
 ## terminal border ##
 border="`grep 'border' $xdtmp | cut -s -d ":" -f 2`"
 #border="`grep 'border' $xdtmp | awk -F '[:]' '{print $2}'`"
 if echo $border | grep -q 'Off' ; then 
 border1="$(gettext 'Off')!$(gettext 'On')"
 else
 border1="$(gettext 'On')!$(gettext 'Off')"
 fi
 echo "$border"

 ### urxvtset gui ### 
setup=$(yad --title="$(gettext 'Urxvt Setup') - $version" --form --align="Center" --justify=right \
 --text="                 $(gettext 'Urxvt Terminal Setup')  \n \n         --:$(gettext 'Make sure to fill in ALL fields:')--   " \
 --field="$(gettext 'Foreground')":CLR "$fcolour" \
 --field="$(gettext 'Background')":CLR "$bcolour" \
 --field="$(gettext 'Cursor')":CLR "$ccolour" \
 --field="$(gettext 'Transparency')":CB "$trans" \
  --field="$(gettext 'Shading')":NUM "$shade" \
 --field="$(gettext 'Borderless')":CB "$border1" \
 --field="$(gettext 'width')":NUM "$geomw" \
 --field="$(gettext 'height')":NUM "$geomh" \
 --field="$(gettext 'Font')":CB "$font_style! `fc-list | sort -f -u | tr '\n' '!' | sed s/style=//g `"\
 --field="$(gettext 'Fontsize')":NUM "$fsize" \
 --icons --button="$(gettext 'Restore'):2" --button="gtk-cancel:1"  --button="gtk-ok:0" \
--notification --command="yad --color" )
button1=$?
case $button1 in

 1) 
  echo "Exiting" && exit  
 ;; 

 0) 
 ### gert setup GUI user input ###
 ectext="$(gettext 'One or more entries has not been filled in please make sure  to fill in All entries. Exiting with out saving settings')"
 guitext="  $(gettext 'One or more entries has not been filled in. please make sure  \n  to fill in ALL entries. Exiting with out saving settings.')  "

 ## get new foreground 1 ##
 setfcolour=`echo $setup  | cut -d "|" -f 1`
 [[ ! "$setfcolour" ]] && yad --title="$(gettext 'Urxvt Setup Info')" --text="$guitext" && echo "$ectext" && exit
 
 ## get new background 2 ##
 setbcolour=`echo $setup  | cut -d "|" -f 2`
 [[ ! "$setbcolour" ]] && yad --title="Urxvt Setup Info" --text="$guitext" && echo "$ectext" && exit
 
 ## get new cursor colour 3 ##
 setccolour=`echo $setup  | cut -d "|" -f3`
 [[ ! "$setccolour" ]] && yad --title="$(gettext 'Urxvt Setup Info')" --text="$guitext" && echo "$ectext" && exit
 
 ## get new transparency 4 ##
 settrans=`echo $setup  | cut -d "|" -f4` 
 [ "$settrans" = "$(gettext 'On')" ] && settrans="On" || settrans="Off" #130511
 [[ ! "$settrans" ]] && yad --title="$(gettext 'Urxvt Setup Info')" --text="$guitext" && echo "$ectext" && exit 
 
 ## get new transparency shading 5 ##
 setshade=`echo $setup  | cut -d "|" -f5 | cut -d "." -f1` 
 [[ ! "$setshade" ]] && yad --title="$(gettext 'Urxvt Setup Info')" --text="$guitext" && echo "$ectext" && exit 
 
 ## get new terminal border 6 ## 
 setborder=`echo $setup  | cut -d "|" -f6`
 [ "$setborder" = "$(gettext 'On')" ] && setborder="On" || settrans="Off" #130511
 [[ ! "$setborder" ]] && yad --title="$(gettext 'Urxvt Setup Info')" --text="$guitext" && echo "$ectext" && exit 
 
 ## get new geometry 7 - 8 ##
 setgeom=`echo $setup  | cut -d "|" -f7 | cut -d "." -f1 `x` echo $setup  | cut -d "|" -f8 | cut -d "." -f1`
 [[ ! "$setgeom" ]] && yad --title="$(gettext 'Urxvt Setup Info')" --text="$guitext" && echo "$ectext" && exit
 
 ## get new font 9 ##
 setfont=`echo $setup  | cut -d "|" -f9 | cut -d ":" -f1`
 [[ ! "$setfont" ]] && yad --title="$(gettext 'Urxvt Setup Info')" --text="$guitext" && echo "$ectext" && exit
 
 ## get new font style 9 ##
 setstyle=`echo $setup  | cut -d "|" -f9 | cut -d ":" -f2`
 [[ ! "$setstyle" ]] && yad --title="$(gettext 'Urxvt Setup Info')" --text="$guitext" && echo "$ectext" && exit

 ## get new font size 10 ##
 setfsize=`echo $setup  | cut -d "|" -f10 | cut -d "." -f1`
 [[ ! "$setfsize" ]] && yad --title="$(gettext 'Urxvt Setup Info')" --text="$guitext" && echo "$ectext" && exit 
 
 
  ## set fourground colour ## 
  sed -i "/foreground/s/$fcolour/$setfcolour/" $xdtmp 2>/dev/null 
   
  ## set back ground colour ## 
  sed -i "/background/s/$bcolour/$setbcolour/" $xdtmp 2>/dev/null 
   
  ## set cursor colour ## 
  sed -i "/underline/s/$ccolour/$setccolour/" $xdtmp 2>/dev/null 
   
  ## set transparency style ## 
  sed -i "/transparent/s/$transp/$settrans/" $xdtmp 2>/dev/null  
  
  ## set transparency shade ## 
  sed -i "/shading/s/$shade/$setshade/" $xdtmp 2>/dev/null 
  
  ## set borders style ## 
  sed -i "/border/s/$border/$setborder/" $xdtmp 2>/dev/null 
   
  ## set geometry ## 
  sed -i "/geometry/s/$geom/$setgeom/" $xdtmp 2>/dev/null 
   
  ## set font size ## 
  sed -i "s:$fsize:$setfsize:g" $xdtmp 2>/dev/null 
   
  ## set font ## 
  sed -i "s:$font:$setfont:g" $xdtmp 2>/dev/null 
   
  ## set font style ## 
  sed -i "s:$style:$setstyle:g" $xdtmp 2>/dev/null 
  

  ### settings saved gui ###
  yad --title="$(gettext 'Urxvt Setup Info')" --text="   $(gettext 'Urxvt terminal settings saved')   " && echo "$(gettext 'Urxvt terminal settings saved')" && cp "$xdtmp" "$xdorig" 
  #echo $setup
  exit 
 ;; 

 2) 
 ### restore defaults gui ###
 if [ -f "$xdback" ]; then 
  yad --title="$(gettext 'Urxvt Setup Info')" --text="   $(gettext 'Restored default settings')   " 
  cp "$xdback" "$xdorig" && echo "$(gettext 'Restored default settings')" 
  else 
  echo "$(gettext 'Can not find file to restore exiting')" && exit 
 fi 
 ;; 

 esac
[edit] changed from quote to code
Last edited by L18L on Sat 18 May 2013, 07:38, edited 2 times in total.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#14 Post by don570 »

I compiled mhwaveedit recently and I noticed that it is translated
into only a few languages. For instance Portuguese is not
represented.

Someone should help the developper before he publishes
his next version 1.4.23

______________________________________________________

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Programs and scripts that are not yet internationalized

#15 Post by L18L »

don570,
are you sure you are in the right (opposit of wrong) thread?

Code: Select all

#!/bin/sh
#2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
#v3.97 BK bugfix.
#110205 use probedisk2.
#130203 change probedisk2 to probedisk.
#130511 i18n L18L

export TEXTDOMAIN=Pdisk
export OUTPUT_CHARSET=UTF-8

if [ -f /usr/sbin/cfdisk -o -f /sbin/cfdisk ];then #v3.97
 BUTMANAGE="fdisk:20,cfdisk:21"
else
 BUTMANAGE="fdisk:20"
fi

ALLINFO="`probedisk 2>/dev/null | grep -v "optical|" | grep -v "/scd"`" #110205
ALLPARTS="`echo "$ALLINFO" | cut -f 1 -d "|" | cut -f 3 -d "/" | tr "\n" " "`"
ALLMNTD="`df | grep "/dev/" | cut -f 1 -d " " | grep -v "loop" | tr "\n" " "`"

butval=20
BUTPARTS=""
for EACHPART in $ALLPARTS
do
BUTPARTS="${BUTPARTS}$EACHPART:$butval,"
butval=`expr $butval + 1`
done
BUTPARTS="${BUTPARTS}$(gettext 'EXIT'):10"

xmessage -bg "#8080ff" -center -name "Pdisk" -title "$(gettext 'Pdisk drive partition manager')" -buttons $BUTPARTS "$(gettext 'Welcome, this program enables you to run either fdisk, or, if it is
installed, cfdisk. These are utility applications to examine and
modify disk drive partitions. This includes creating and erasing
partitions, so is not for the faint-of-heart!')

$(gettext 'Here are the disk drives that Puppy knows about:')
$ALLINFO

$(gettext 'If any drive is wrong or missing, exit this program and run the
\"Mount/unmount drives\" program, that you will find in the \"File 
Managers\" menu. That tool will enable you to probe the hardware.')

$(gettext 'These partitions are curently mounted:')
$ALLMNTD
$(gettext '...you can view these but NOT change them.')

$(gettext 'To continue this program, click a drive button...')"

RETVAL=$?
if [ $RETVAL -lt 11 ];then
 exit
fi

EDITPART="`echo "$BUTPARTS" | tr "," "\n" | grep "$RETVAL" | cut -f 1 -d ":"`"

xmessage -bg "#80C080" -center -name "Pdisk" -title "$(gettext 'Pdisk drive partition manager')" -buttons $BUTMANAGE,$(gettext 'EXIT'):10 "$(gettext 'Chose the partition manager program that you want to use...')"

RETVAL=$?
if [ $RETVAL -lt 11 ];then
 exit
fi

if [ $RETVAL -eq 21 ];then
 rxvt -bg "#C080ff" -e cfdisk /dev/$EDITPART
else
 rxvt -bg "#C080ff" -e fdisk /dev/$EDITPART
fi
[edit] changed from quote to code
Last edited by L18L on Sat 18 May 2013, 07:42, edited 1 time in total.

robwoj44
Posts: 399
Joined: Fri 08 Aug 2008, 18:15
Location: Warsaw

#16 Post by robwoj44 »

L18L thank you for Pdisk and Pudd.
Snap2 it is other program - http://sourceforge.net/projects/snap2/. In Puppy in menu/utilities.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Programs and scripts that are not yet internationalized

#17 Post by L18L »

robwoj44 wrote:Snap2 it is other program - http://sourceforge.net/projects/snap2/. In Puppy in menu/utilities.
Sorry

Code: Select all

# grep nap2 .jwmrc 
#
did not find it in actual Puppy Precise.

I see: snap2-4.21 is in puppy-noarch-official
snap2-4.25.pet is at http://files.crnatural.net/snap2/

lstandish is the forum name of snap2 developer Lloyd Standish.

Hope he helps :wink:

robwoj44
Posts: 399
Joined: Fri 08 Aug 2008, 18:15
Location: Warsaw

#18 Post by robwoj44 »

Thank you for the info about lstandish. I contacted him directly.
Snap2 is still in Wary/Racy 5.5 and slacko 5.5.

robwoj44
Posts: 399
Joined: Fri 08 Aug 2008, 18:15
Location: Warsaw

#19 Post by robwoj44 »

PMirrorget internationalized

/usr/bin/pmwget

Code: Select all

#! /bin/bash
# Pmwget created by gposil with thanks to Lobster for Pwget
# April 2009 GPL v3 License
# http://gposil.netne.net
#2009 gposil: version 0.2
#121018 bk: bug fixes, version 0.2.1.
#130514 gettexted by robwoj44

. gettext.sh
export TEXTDOMAIN=pmwget
export TEXTDOMAINDIR=/usr/share/locale
export OUTPUT_CHARSET=UTF-8

export HELP_DIALOG='
<window title="'$(gettext 'PMirrorget - Help')'" resizable="false">
  <vbox>
    <text>
      <label>'$(gettext 'PMirrorget allows you to download an entire web page and its text linked pages to a folder on your PC. Copy and paste the URL you wish to download. Use the folder selector to choose the destination. It is designed primarily for grabbing manuals and wiki pages without sifting through them, so you can view them later.')'</label>
      <variable>HELP_DLG_MSG</variable>
    </text>
    <button>
      <label>'$(gettext 'Close')'</label>
      <action type="closewindow">HELP_DLG_MSG</action>
    </button>
  </vbox>
  </window>
'

export Pmwget='
<window title="'$(gettext 'PMirrorget - 0.2.1 - Site Grabber Utility')'" resizable="false">
<vbox>
 <hbox>
  <text><label>'$(gettext 'Copy and Paste or type the URL of the required site into URL. Choose your destination folder and then Grab It Now!')'</label></text>
 </hbox>
 <frame>
 <hbox>
  <text><label> '$(gettext ' URL:    ')'</label></text>
  <entry accept="directory"><variable>SOURCE</variable><input>/tmp/pm_source_dir</input></entry>
 </hbox>
 <hbox>
  <text><label>'$(gettext 'Folder:')'</label></text>
  <entry accept="directory"><variable>DEST</variable><input>/tmp/pm_mirror_dir</input></entry>
  <button>
   <input file stock="gtk-open"></input>
   <action type="fileselect">DEST</action>
   <action>refresh:DEST</action>
  </button>
 </hbox>
 </frame>
 <hbox>
 <frame>
  <button help>
<action type="launch">HELP_DIALOG</action> 
  </button>
  <button cancel></button>
  </frame>
  <button>
  <input file>/usr/local/lib/X11/mini-icons/mini.checkmark.xpm</input>
       <label>'$(gettext 'Grab It Now!')' </label>
       <action type="exit">OK</action>
  </button>

 </hbox>
</vbox>
</window>'

I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog4 --program=Pmwget --center); do
   eval $STATEMENTS
done
IFS=$I
if [ $EXIT = OK ]; then
  rxvt -name PMirrorget -bg "#F3F2DF" -e wget -m -c -k -r -np -P "$DEST" $SOURCE
  rox -d "$DEST"
fi

robwoj44
Posts: 399
Joined: Fri 08 Aug 2008, 18:15
Location: Warsaw

#20 Post by robwoj44 »

Puppy Axel download accelerator internationalized

/usr/local/bin/puppydownload

Code: Select all

#!/bin/sh

#my own humble download accelerator frontend for axel.
#(c) copyright 2004 Barry Kauler www.goosee.com/puppy

#choices: 
# multiple servers or one
# if one, then number connections
# destination path.
#130514 gettexted by robwoj44

. gettext.sh
export TEXTDOMAIN=puppydownload
export TEXTDOMAINDIR=/usr/share/locale
export OUTPUT_CHARSET=UTF-8

COMMANDTAIL="$@"

if [ "$COMMANDTAIL" ];then
 #this means that a url has been passed in on the commandline.
 echo "$COMMANDTAIL" | grep -i "http://"
 if [ ! $? -eq 0 ];then #=0 if found.
  echo "$COMMANDTAIL" | grep -i "ftp://"
  if [ ! $? -eq 0 ];then
   Xdialog --wmclass "puppyaxel" --title "'$(gettext 'Puppy download accelerator')'" --no-buttons --icon "/usr/local/lib/X11/pixmaps/warning24.xpm" --infobox "'(gettext 'The URL is incomplete. It needs http:// or ftp:// prefix.')'" 0 0 20000 &
  fi
 fi
fi

DOSETUPLOOP="true"
while [ "$DOSETUPLOOP" = "true" ];do
 DOSETUPLOOP="false"

RETSTR=`Xdialog --wmclass "puppyaxel" --title "$(gettext 'Puppy Axel download accelerator')" --stdout --left --separator "|" --icon "/usr/share/images/ftp64.png" --check "$(gettext 'Bypass any proxy server')" off --3inputsbox "$(gettext 'This is a frontend for the Axel download accelerator.\nIt is capable of multiple connections to the same server,\nor download simultaneously from multiple servers.\n\nNote: you can paste from the clipboard with CTRL-V.\nDo not forget the ftp:// or http:// prefix.\nRecommend leave bypass-proxy checkbox unticked.')" 0 0 "$(gettext 'First server URL:')" "$COMMANDTAIL" "$(gettext 'Second server URL (optional):')" "" "$(gettext 'Third server URL (optional):')" ""`

if [ $? -eq 0 ];then
URL1=`echo -n "$RETSTR" | head -n 1 | cut -f 1 -d "|"`
URL2=`echo -n "$RETSTR" | head -n 1 | cut -f 2 -d "|"`
URL3=`echo -n "$RETSTR" | head -n 1 | cut -f 3 -d "|"`
BYPASSPROXY=`echo -n "$RETSTR" | tail -n 1`
else
 exit
fi

MULTISERVE="$URL2$URL3"
if [ ! "$MULTISERVE" ];then
 MULTICONN=`Xdialog --wmclass "puppyaxel" --title "$(gettext 'Puppy Axel download accelerator')" --stdout --no-tags --radiolist "$(gettext 'Choose one or more simultaneous connections to the server.\nMultiple connections will speed download, but a slow\ndialup connection may still be the bottleneck\n(choose 3 and above only if you have broadband).\nAlso, some servers will disconnect if download\nacceleration is attempted.')" 0 0 0 "1" "$(gettext 'Single connection, no acceleration')" on "2" "$(gettext 'Two simultaneous connections')" off "3" "$(gettext 'Three simultaneous connections')" off "4" "$(gettext 'Four simultaneous connections')" off`
fi

if [ ! $? -eq 0 ];then
 exit
fi

 DESTDIR="`Xdialog --wmclass "puppyaxel" --title "$(gettext 'Choose destination directory:')" --wizard --no-cancel --help "$(gettext 'if you leave the Selection field blank, the destination filename\nwill be the same as the source filename.\nOtherwise, type in the new name for the downloaded file.')" --stdout --dselect "/root/" 0 0 `"

 RETVAL=$?
 #note, returns 3 if "previous" button clicked.
 if [ $RETVAL -eq 3 ];then #=0 "next".
  DOSETUPLOOP="true"
 else
  if [ ! $RETVAL -eq 0 ];then
   exit
  fi
 fi

done

#now do the actual download...

ls "$DESTDIR" 2>&1 | grep "No such file or directory"
if [ $? -eq 0 ];then
 #this means that dest is not an existing file nor directory, so must
 #have typed a filename into directory selection dialog.
 FULLDEST="$DESTDIR"
else
 file $DESTDIR | grep "directory"
 if [ $? -eq 0 ];then
  #DESTDIR is only a path. get filename off url...
  FILEDEST=`basename "$URL1"`
  FULLDEST="$DESTDIR$FILEDEST"
 else
  #dest filename must already exist.
  FULLDEST="$DESTDIR"
 fi
fi

if [ "$BYPASSPROXY" = "checked" ];then
 BYPASSPROXY="--no-proxy"
else
 BYPASSPROXY=""
fi

echo -e "#!/bin/sh
axel $BYPASSPROXY --alternate --verbose --num-connections=\"$MULTICONN\" --output=\"$FULLDEST\" \"$URL1\" $URL2 $URL3
if [ ! \$? -eq 0 ];then
 echo
 echo \"'$(gettext DOWNLOAD FAILURE!\')'"
 if [ -f $FULLDEST ];then
  echo \"'$(gettext 'The file has not been fully downloaded.\')'"
  echo -n \"'$(gettext 'Deleting partially downloaded file...\')'"
  echo \"'$(gettext  'done\')'"
 else
  echo \"'$(gettext 'The file has not been downloaded.\')'"
 fi
 echo
 echo -n \"'$(gettext 'Press ENTER key to exit: \')'"
 read nnn
fi
" > /tmp/axelrun.sh

chmod 755 /tmp/axelrun.sh
rxvt -name puppyaxel -bg orange -geometry 80x10 -title "'$(gettext 'Puppy Axel download accelerator')'" -e /tmp/axelrun.sh

Post Reply