Saturday, September 20, 2008

(wget = DM) != GUI

Wget the default download manager in *nix systems is a very versatile tool. I will be focusing on some of its very important features useful to a end user. So here we begin :

  1. Simply downloading a file :
    $ wget <URL>
    Or better :
    $ wget -c <URL>
    -c or --continue lets you resume your incomplete download done using wget or a different program

  2. Downloading a file silently (a very imp. feature in wget, to work in background) :
    $ wget -q <URL> &
  3. Taking a log of all messages :
    $ wget <URL> -o filename
  4. Downloading files from a Queue :
    $ wget -i filename
    Strore all download links in a file separated by Return key and link it with wget
  5. Set your no. of retries and timeout seconds :
    $ wget -t <no. to tries> -T <duration> <URL>
  6. Displaying the content of a file rather than saving it on Hard Disk :
    $ wget -O - <URL>
  7. Retrieving all file with a particular extension from a web directory :
    $ wget -r -l1 -np -A.<extension> <directory>
    Example for*.jpg
    $ wget -r -l1 -np -A.jpg
  8. Downloading an entire Web Site :
    $ wget -c -r -nc -p -D <domain> -k <URL>
    For this I have written a script for easy downloading :

    # Bash Script for Web Site downloading by GNUger
    # Syntax : $ sitesdwn [URL]

    command="wget -c -r -p -k"
    domain=$(echo $1 | cut -d/ -f3 | cut --complement -d. -f1)

    read -p "Download within $domain only (y/n) : " opinion
    if [[ $opinion == 'y' ]] ; then
    command="$command -D $domain"
    read -p "Disable overwriting existing files (y/n) : " opinion
    if [[ $opinion == 'y' ]] ; then
    command="$command -nc"
    read -p "Download outside the current directory (y/n) : " opinion
    if [[ $opinion == 'n' ]] ; then
    command="$command -np"
    read -p "Save as HTML extension (y/n) : " opinion
    if [[ $opinion == 'y' ]] ; then
    command="$command -E"
    read -p "Enable compatibility with Windows (y/n) : " opinion
    if [[ $opinion == 'y' ]] ; then
    command="$command --restrict-file-names=windows"
    echo "Downloading ... "
    $command $1
    echo "End"
    exit 1
    Or download the script from here. Syntax :
    ./ <URL>

This is not it.. there's hell lot more but beyond the scope of this post. So just read the Manuals (worth reading specially the Examples part). There are GUI version for wget :
  • GWget - For Gnome
  • Kget - For KDE
But they does not provide you so many options and manual customizations as wget (CLI) does.

References : man pages of wget, Linux Journal

Tuesday, September 16, 2008

DC++ and Linux

Particularly in colleges where media sharing is very popular among students (like in ours) DC++ can be used to inter-connect different hostels and enable fast file-sharing. DC++ is a free and open-source, peer-to-peer file-sharing client that can be used to connect to the Direct Connect network. It has private messaging features or one can globally chat in a Hub Room. It also indexes files, so you just search for a file with specified characteristics. Many more handy features more you try to explore more you know. But alas! this program is not for Linux and designed specially for Windows. But should we worry... naah! We have LinuxDC++, whose interface is rewritten in GTK+ toolkit but the core code is that of DC++ and it works/behave exactly in the same manner.

Some very initial steps you should follow to trigger your DC++ engine :

  1. Open LinuxDC++
  2. Navigate to File > Preferences > Personal. There fill the form ( 'Nick' field is compulsory )
  3. Navigate to File > Preferences > Sharing. There add the folders you want to share.
    NOTE: In DC++ each hub has its minimum sharing limit below which a user cannot join it, so create your share accordingly
  4. Navigate to File > Quick Connect and enter the hub's IP address.

One minus point I would like to share is we cannot preview a file, its like download and use. But it hardly matters when you are in a local hub and have ample disk space. Happy Sharing!!

ADDED (18th Oct 2008) :

Digit Magazine, Oct 2008

Audio Boost using MPlayer

I often felt pissed off when my friends used VLC and others programs for software level volume amplification, so I searched for a similar kind in mplayer and guess what! It was already there in mplayer since ages. You just need to RTFM.

Syntax :

mplayer -af volume=20:0 mediafile
Would amplify the sound by 20dB and hard-clip if the sound level is too high

Reference ( man pages of mplayer ) :

Audio filters allow you to modify the audio stream and its properties. The syntax is:

-af <filter1[=parameter1:parameter2:...],filter2,...>
Setup a chain of audio filters.

NOTE: To get a full list of available audio filters, see -af help.

Implements software volume control. Use this filter with cau‐
tion since it can reduce the signal to noise ratio of the sound.
In most cases it is best to set the level for the PCM sound to
max, leave this filter out and control the output level to your
speakers with the master volume control of the mixer. In case
your sound card has a digital PCM mixer instead of an analog
one, and you hear distortion, use the MASTER mixer instead. If
there is an external amplifier connected to the computer (this
is almost always the case), the noise level can be minimized by
adjusting the master level and the volume knob on the amplifier
until the hissing noise in the background is gone.
This filter has a second feature: It measures the overall maxi‐
mum sound level and prints out that level when MPlayer exits.
This volume estimate can be used for setting the sound level in
MEncoder such that the maximum dynamic range is utilized.
NOTE: This filter is not reentrant and can therefore only be en‐
abled once for every audio stream.
Sets the desired gain in dB for all channels in the
stream from -200dB to +60dB, where -200dB mutes the
sound completely and +60dB equals a gain of 1000 (de‐
fault: 0).
Turns soft clipping on (1) or off (0). Soft-clipping
can make the sound more smooth if very high volume lev‐
els are used. Enable this option if the dynamic range
of the loudspeakers is very low.
WARNING: This feature creates distortion and should be
considered a last resort.

Enjoy your home theater ... :)