Showing posts with label aria2. Show all posts
Showing posts with label aria2. Show all posts

Thursday, October 11, 2012

Aria2 shell script and batch file

I wrote a BASH shell script and a DOS batch file that can be used to download files using aria2 — Aria2 is a command-line tool for downloading files. The script and the batch file take 2 arguments; the first one is for the bittorrent hash in 40-digit hexadecimal number and the second one is for arbitrary one-word description.





aria2.bat can be used on Windows, and aria2.sh can be used on Linux and *BSD. Make sure that aria2c is in PATH. For example, if you want to download an ISO file for the OpenSUSE DVD, you would type something like:



aria2.bat 198472f5217d843cceb1a4c82233f009ed6608af opensuse-dvd-586


To find the value of a bittorrent hash (that long hex number), you can cut it from a magnet link you find on a Web site — Magnet links allow you to download actual files without first having to download bittorrent files (*.torrent). When you see a magnet sign, right-click on it to display the shortcut menu and select Copy Link Location.



btih-demo1

Then, paste it somewhere, for example, inside the URL address bar. The hash value comes after the btih: string.



btih-demo2

After you find the bittorrent hash, use it as the first argument to the script and make up anything for the second argument, as shown in the example above.


Sunday, January 3, 2010

Compile Aria2c on Debian Linux

Aria2 is a fast download utility that you use in the Command Prompt or xterm. To compile aria2 for Linux, install the following packages.



  • ca-certificates
  • g++
  • make
  • libexpat1-dev
  • libsqlite3-dev
  • libssl-dev
  • zlib1g-dev


Although Debian 5.0 Lenny has libc-ares2, Debian 4.0 Etch and Debian 3.1 Sarge don't have it. As a user of Debian Sarge, I had to compile c-ares myself to enable asynchronous DNS resolution in Aria2c. I downloaded c-ares source from c-ares.haxx.se and compiled it statically.



tar xzvf c-ares-1.7.0.tar.gz

cd c-ares-1.7.0/

./configure --prefix=/usr --build=i586-pc-linux-gnu --disable-debug --disable-shared CFLAGS='-DCARES_STATICLIB'

make

make install


Then, I downloaded Aria2 source from aria2.sf.net and compiled it like this:



tar xzvf aria2-1.8.0.tar.gz

cd aria2-1.8.0

./configure --build=i586-pc-linux-gnu --prefix=/usr --enable-bittorrent --enable-metalink --enable-threads=posix --with-ca-bundle="/etc/ssl/certs/ca-certificates.crt" LIBS='-lrt -lcares' CPPFLAGS='-DCARES_STATICLIB'


You can optionally link aria2 with static libraries libssl and libcrypto. This is useful when you move aria2c to another system with a different version of OpenSSL library. To do so, open every Makefile in the aria2 source directory and change every line containing “-L/usr/local/lib -lssl -lcrypto” to “/usr/lib/libssl.a /usr/lib/libcrypto.a”. Then, run the following commands to build aria2.



make
make install


An executable /usr/bin/aria2c will be installed. To use it, open a xterm or rxvt and type its command. To see brief command-line options, type aria2c -h.

About This Blog

KBlog logo This blog seeks to provide a collection of interesting pictures found on the Web. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

Powered By Blogger