Tv show downloader for a linux server.... Part 2
Today WE continue down the TV show down-loader path. Rtorrent and screen is installed, and a basic config is in place. Additional settings for rtorrent like adding upload_rate=3 to limit upload speeds to 3Kbps might be a good idea, at night you can increase that using the scheduling portion of rtorrent.
rtorrent unfortunately is designed as a program that runs interactively. It really should be redesigned to run headless but the programmers don't want to. so we need to cheat. That's what "screen" is for. screen runs the rtorrent program in a virtual terminal window that we can keep running even when we log off.
Screen is easy to use....
screen rtorrent
this will launch screen with rtorrent running in it.
To detach the session, type Ctrl-A then Ctrl-D. Ctrl-A tells Screen that the next keystrokes will be a command. Ctrl-D is the detach command. Once you are detached you can exit the session and whatever is running will continue to run -- barring a crash or a reboot.
When you want to reconnect, you need to get the name of the detached session by using the -ls parameter (screen -ls) to list all of the screen sessions that are running. To reattach to one of them, use the -r parameter and pass in the name:
screen -r 12345.pts-1.machine
If only one screen session is running you can use the -r parameter without the name of the session.
now isn't that neat. we can launch the program and let it run while we log off.
But what if I want it to start on boot like a service? The guys that write the documentation for rtorrent though of that and put together a nice little script we can put in our init.d folder
Step 1: Assuming a Debian-based distribution, create /etc/init.d/rtorrent with one of the rtorrentInit files attached to this page, editing the Configuration to suit your needs.
Step 2: Make sure it has appropriate permissions:
# ls -l /etc/init.d/rtorrent
-rwxr-xr-x 1 root root 3000 2007-03-06 22:40 /etc/init.d/rtorrent
Step 3: Update your init system (as sudo/su/root):
# update-rc.d rtorrent defaults
This will get rtorrent all set up for out automatic downloading. Next time we cover the automatic downloading of the .torrent files from the rss feed. I'll cover using the showrss feed, although any setup you use to grab the files. in fact you may need to use multiple feeds. showrss does not cover all shows I like, so I have to use a second one that has a lot of the BBC shows I like to grab as well as Australian tv that you just cant get here.
NOTE: If you will be saving the files to a NAS on your network instead of a local directory... you will need to mount that nas as follows....
lorofallisee@security:~/TV$ sudo mount -t smbfs //192.168.1.66/video /mnt/mynas -o umask=022,rw,uid=lordofallisee
this will mount that nas with RW permissions for the user "lordofallisee" if this is the user that your file copying script runs as, this is what is needed to give it permissions to write to that directory. these settings can be added to the fstab to make life easier.
There is a new option available that works better than rtorrent, although it is a bit limited, I like that it's a real service, although not open source.
uTorrent has a "service" version that has a web-ui it uses less resources as rtorrent and is a whole lot easier to set up as the documentation is up to date and not really out of date like Rtorrents is. I am currently stalled comparing the two and updating with details on how to use uTrorrent with this process.
URLs of interest as follows....
WEbUI for uTorrent
utorrent for Linux
rtorrent unfortunately is designed as a program that runs interactively. It really should be redesigned to run headless but the programmers don't want to. so we need to cheat. That's what "screen" is for. screen runs the rtorrent program in a virtual terminal window that we can keep running even when we log off.
Screen is easy to use....
screen rtorrent
this will launch screen with rtorrent running in it.
To detach the session, type Ctrl-A then Ctrl-D. Ctrl-A tells Screen that the next keystrokes will be a command. Ctrl-D is the detach command. Once you are detached you can exit the session and whatever is running will continue to run -- barring a crash or a reboot.
When you want to reconnect, you need to get the name of the detached session by using the -ls parameter (screen -ls) to list all of the screen sessions that are running. To reattach to one of them, use the -r parameter and pass in the name:
screen -r 12345.pts-1.machine
If only one screen session is running you can use the -r parameter without the name of the session.
now isn't that neat. we can launch the program and let it run while we log off.
But what if I want it to start on boot like a service? The guys that write the documentation for rtorrent though of that and put together a nice little script we can put in our init.d folder
Step 1: Assuming a Debian-based distribution, create /etc/init.d/rtorrent with one of the rtorrentInit files attached to this page, editing the Configuration to suit your needs.
Step 2: Make sure it has appropriate permissions:
# ls -l /etc/init.d/rtorrent
-rwxr-xr-x 1 root root 3000 2007-03-06 22:40 /etc/init.d/rtorrent
Step 3: Update your init system (as sudo/su/root):
# update-rc.d rtorrent defaults
This will get rtorrent all set up for out automatic downloading. Next time we cover the automatic downloading of the .torrent files from the rss feed. I'll cover using the showrss feed, although any setup you use to grab the files. in fact you may need to use multiple feeds. showrss does not cover all shows I like, so I have to use a second one that has a lot of the BBC shows I like to grab as well as Australian tv that you just cant get here.
NOTE: If you will be saving the files to a NAS on your network instead of a local directory... you will need to mount that nas as follows....
lorofallisee@security:~/TV$ sudo mount -t smbfs //192.168.1.66/video /mnt/mynas -o umask=022,rw,uid=lordofallisee
this will mount that nas with RW permissions for the user "lordofallisee" if this is the user that your file copying script runs as, this is what is needed to give it permissions to write to that directory. these settings can be added to the fstab to make life easier.
There is a new option available that works better than rtorrent, although it is a bit limited, I like that it's a real service, although not open source.
uTorrent has a "service" version that has a web-ui it uses less resources as rtorrent and is a whole lot easier to set up as the documentation is up to date and not really out of date like Rtorrents is. I am currently stalled comparing the two and updating with details on how to use uTrorrent with this process.
URLs of interest as follows....
WEbUI for uTorrent
utorrent for Linux
Comments
Post a Comment