Today I’ll walk through getting perl & SlimRat installed on your WDTV. SlimRat is a command line and GUI utility for downloading files from Rapidshare on Linux.
In order to take advantage of this tutorial you must either be running WDLXTV or Zoranders ext3-boot. You must also have my Optware for WDTV package installed, that stuff is covered elsewhere. I’ll be including every necessary step here, so you might be able to skip around if you already have some of this done.
first install perl and all the modules that slimrat requires.
# ipkg install perl perl-www-mechanize
Installing perl (5.10.0-3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl_5.10.0-3_mipsel.ipk
Installing libdb (4.2.52-3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//libdb_4.2.52-3_mipsel.ipk
Installing gdbm (1.8.3-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//gdbm_1.8.3-2_mipsel.ipk
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-www-mechanize_1.54-2_mipsel.ipk
Installing perl-http-response-encoding (0.05-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-http-response-encoding_0.05-1_mipsel.ipk
Installing perl-libwww (5.825-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-libwww_5.825-1_mipsel.ipk
Installing perl-uri (1.35-3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-uri_1.35-3_mipsel.ipk
Installing perl-compress-zlib (1.42-3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-compress-zlib_1.42-3_mipsel.ipk
Installing zlib (1.2.3-3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//zlib_1.2.3-3_mipsel.ipk
Installing perl-html-parser (3.60-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-html-parser_3.60-1_mipsel.ipk
Installing perl-html-tagset (3.04-4) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-html-tagset_3.04-4_mipsel.ipk
Configuring gdbm
Configuring libdb
Configuring perl
Configuring perl-compress-zlib
Configuring perl-html-parser
Configuring perl-html-tagset
Configuring perl-http-response-encoding
Configuring perl-libwww
Configuring perl-uri
Configuring perl-www-mechanize
Configuring zlib
Successfully terminated.
Does perl work?
# perl -v
This is perl, v5.10.0 built for mipsel-linux
Copyright 1987-2007, Larry Wall
Perl may be copied only under the terms of either the Artistic License or theGNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
# perl -e "print "Hello World";"
Hello World
Looks like perl works so now lets download & extract SlimRat
# cd /opt/bin
# wget http://slimrat.googlecode.com/files/slimrat-0.9.3.tar.bz2
Connecting to slimrat.googlecode.com (209.85.173.82:80)
slimrat-0.9.3.tar.bz 100% |*******************************| 12195 --:--:-- ETA
# bunzip2 slimrat-0.9.3.tar.bz2
# tar -xvf slimrat-0.9.3.tar
slimrat-0.9.3/
slimrat-0.9.3/INSTALL
slimrat-0.9.3/Plugin.pm
slimrat-0.9.3/Toolbox.pm
slimrat-0.9.3/config
slimrat-0.9.3/index.html
slimrat-0.9.3/plugins/
slimrat-0.9.3/plugins/DepositFiles.pm
slimrat-0.9.3/plugins/Direct.pm
slimrat-0.9.3/plugins/FastLoad.pm
slimrat-0.9.3/plugins/Leteckaposta.pm
slimrat-0.9.3/plugins/MediaFire.pm
slimrat-0.9.3/plugins/Rapidshare.pm
slimrat-0.9.3/plugins/YouTube.pm
slimrat-0.9.3/slimrat.glade
slimrat-0.9.3/slimrat-gui
slimrat-0.9.3/slimrat
# rm slimrat-0.9.3.tar
# ln -s slimrat-0.9.3/slimrat ./slimrat
The last line allows us to execute slimrat from anywhere on the system.
*Note* I’ve just noticed that either: SlimRat was recently added to the nslu2-linux wdtv feed or I never realized it was there : p
# ipkg install slimratWill install a slightly older version of SlimRat than I’m using here in these examples.
If bunzip2 says not found, then:
# ipkg install bzip2
So now let see if it works.
# slimrat
Loaded plugins: FastLoad, MediaFire, YouTube, DepositFiles, Rapidshare, LeteckapostaSlimRat
Downloads files from rapidshare and other servers to your working directory. Files to download are specified by download links like 'http://rapidshare.com/files/012345678/somefile.xxx' as arguments on command line or one per line in file given as --list option ('-' for stdin works too).USAGE:
/opt/bin/slimrat [options] [link [link [...]]]OPTIONS:
-h | --help this help
-l | --list filename load links from file (one per line)
-c | --check only check links, don't download them
-t | --to directory destination directory (where to download)
-w | --wget wget options, enclosed in quotes
slimrat -w '--limit-rate=20k' -l file-list
It works! Now before we test it out and download some stuff theres one issue to work out. Rapidshare enforces a waiting period in between downloads, so a big release could take a while to download. We don’t want to have to keep the shell open the whole time SlimRat works, but if its closed SlimRat will terminate. What we’ll do is utilize the program screen, which will allow us to detach SlimRat and exit our terminal session on the wdtv without affecting the downloading.
# ipkg install screen
Installing screen (4.0.3-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//screen_4.0.3-2_mipsel.ipk
Installing termcap (1.3.1-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//termcap_1.3.1-2_mipsel.ipk
Configuring screen
Configuring termcap
Successfully terminated.
To run a program behing screen prepend it to the command string.
# screen <program> <arguments>
Once running there is one main key sequence that you need to remember
Ctrl^a^d
That is: press the Ctrl key, then a, then d, then lift off Ctrl. This sequence drops screen to the background and returns us to the shell. In order to get back (if theres only one instance of screen running) to the program:
# screen -r
I’ll queue up 3 files and when SlimRat starts the first file I’ll hit Ctrl^a^d, exit my ssh session, grab a snack, and watch a show.
# cd /tmp/boot
# mkdir rstests && cd rstests
# screen slimrat http://rapidshare.com/files/206442508/WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip http://rapidshare.com/files/206443577/WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip http://rapidshare.com/files/207616110/opt.bin-0.2.zipLoaded plugins: FastLoad, MediaFire, YouTube, DepositFiles, Rapidshare, Leteckaposta
[09:17:34] Slimrat started
[09:17:34] Downloading http://rapidshare.com/files/206442508/WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip (Rapidshare) [ALIVE]
[09:17:40] Waiting 00:32
[09:18:12] Continuing
--2009-03-16 09:18:12-- http://rs523tl2.rapidshare.com/files/206442508/1409886/WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip
Resolving rs523tl2.rapidshare.com... 80.239.226.124
Connecting to rs523tl2.rapidshare.com|80.239.226.124|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12535355 (12M) [application/octet-stream]
Saving to: `WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip'
22% [==================> ] 2,816,816 196K/s eta 57s
[detached]
(Here I’ve just hit Ctrl^a^d, which detached screen)
[detached]
# exit
connection to wdtv closed.
$
Ok, my show is over. Its time to log back in and see if SlimRat is complete yet.
$ ssh root@wdtv
BusyBox v1.10.0 (2009-02-15 05:09:42 CST) built-in shell (msh)
Enter 'help' for a list of built-in commands.
# screen -r
[09:17:34] Downloading http://rapidshare.com/files/206442508/WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip (Rapidshare) [ALIVE]
[09:17:40] Waiting 00:32
[09:18:12] Continuing
--2009-03-16 09:18:12-- http://rs523tl2.rapidshare.com/files/206442508/1409886/WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip
Resolving rs523tl2.rapidshare.com... 80.239.226.124
Connecting to rs523tl2.rapidshare.com|80.239.226.124|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12535355 (12M) [application/octet-stream]
Saving to: `WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip'
100%[=====================================================================================>] 12,535,355 196K/s in 67s
2009-03-16 09:19:20 (183 KB/s) - `WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip' saved [12535355/12535355]
[09:19:20] File downloaded
[09:19:20] Downloading http://rapidshare.com/files/206443577/WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip (Rapidshare) [ALIVE]
[09:19:23] Reached the download limit for free-users
[09:19:23] Waiting 15:00
[09:34:24] Continuing
[09:34:25] Waiting 00:32
[09:34:57] Continuing
--2009-03-16 09:34:57-- http://rs234l33.rapidshare.com/files/206443577/1363875/WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip
Resolving rs234l33.rapidshare.com... 195.122.149.35
Connecting to rs234l33.rapidshare.com|195.122.149.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13693232 (13M) [application/octet-stream]
Saving to: `WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip'
100%[=====================================================================================>] 13,693,232 153K/s in 75s
2009-03-16 09:36:13 (179 KB/s) - `WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip' saved [13693232/13693232]
[09:36:13] File downloaded
[09:36:13] Downloading http://rapidshare.com/files/207616110/opt.bin-0.2.zip (Rapidshare) [ALIVE]
[09:36:16] Reached the download limit for free-users
[09:36:16] Waiting 15:00
[09:51:17] Continuing
[09:51:18] Waiting 00:33
[09:51:51] Continuing
--2009-03-16 09:51:52-- http://rs601l3.rapidshare.com/files/207616110/109812/opt.bin-0.2.zip
Resolving rs601l3.rapidshare.com... 62.140.7.2
Connecting to rs601l3.rapidshare.com|62.140.7.2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18084506 (17M) [application/octet-stream]
Saving to: `opt.bin-0.2.zip'
100%[=====================================================================================>] 18,084,506 193K/s in 80s
2009-03-16 09:53:23 (227 KB/s) - `opt.bin-0.2.zip' saved [18084506/18084506]
[09:53:23] File downloaded
When a program running under screen terminates control is immediately returned to the shell. Any output from the previously running program will disappear. If you ever try screen -r and are told there is no screen to be resumed, then your program has already finished executing. So now we see:
$ ssh root@wdtv
BusyBox v1.10.0 (2009-02-15 05:09:42 CST) built-in shell (msh)
Enter 'help' for a list of built-in commands.
# screen -r
[screen terminating]
# cd /tmp/boot/rstests && ls -la *.zip
-rwxr-xr-x 1 root root 12535355 Mar 16 09:19 WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip
-rwxr-xr-x 1 root root 13693232 Mar 16 09:36 WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip
-rwxr-xr-x 1 root root 18084506 Mar 16 09:53 opt.bin-0.2.zip
Looks like everything downloaded correctly as it should, now to go find some other more interesting stuff to download : )
Tune in for next time, when i show how to automate SlimRat with directory monitoring and a custom autoextract script...