GeneralHardwareOpenMSS FirmwareOriginal FirmwareDevelopmentRelated |
How to automatically download torrents with the MSS SummaryThis is an updated version of my TorrentDownloader. It contains a couple of new features, and several bugfixes. It allows you to search and queue torrents from multiple sites, as well as subscribe to RSS feeds of popular TV shows. RequirementsOn the MSS:
You can install both CTorrent and lsof on your MSS by using ipkg, this will be explained under installation. On your webserver*:
php_flag register_globals off
* It is possible to install Lighttpd with PHP and run the PHP script on you MSS, I haven’t tried this myself, but it should not be any different from installing it on a webserver. Take a look at the forum for PHP installation instructions. How it worksThis collection of scripts will allow you to administrate your torrent downloads remotely. In its most complete form it consists of a website to administrate and manage your downloads and two scripts on your MSS/Kurobox that download torrents automatically. The use of the website scripts is not neccessary, since the shell scripts function fine without them. Just make sure to set the option for the RSS feed in DownloadYou can find the scripts at my site: Q3.zip InstallationFirst and foremost, you need to install CTorrent. This can be done with ipkg. Log on to your MSS and type in the following: # ipkg update # ipkg install ctorrent This will download CTorrent and install it automatically. Do the same for lsof: # ipkg install lsof There are several preferences in either of the scripts that will need to be adapted to your situation, I will explain these in their separate sections. On the webserverBefore you can install the scripts on your webserver, you’ll have to change some default values. After unzipping, you’ll find these in a file called // System-wide settings define( 'QCOOK', 'Q3' ); define( 'QTIME', time() + ( 14 * 86400 ) ); define( 'REDIR', false ); // User settings $user[] = array( 'user' => 'Admin', 'pass' => 'changeme' ); The value you want to change is “changeme”, that’s your password… ;o) After these simple changes, you can upload all files in the “website” directory to your webserver. There is one thing you have to do to complete this step. You need to make the directory On the MSSI’ve set apart a seperate share for any torrent activity, but you are free to set the script up in any way you want. On my MSS I have an “incoming”-share where I keep the script, the torrents and the data as it downloads. When the download is finished, the script moves it to another location. You can change these settings in the script, just as with the PHP script. Let’s assume you have a dir called “Downloads” in your Public share on the MSS and rss=http://YOURWEBSITE/cron.php?rss=YOUR_RSS_ID dst=/shares/mss-hdd/Public/Other own=guest The rss setting can be copied and pasted from the website (the little orange RSS icon is the url to your RSS feed). In watchdog.sh make sure you copy the YOUR_RSS_ID bit from your actual RSS feed url over here:
If you don’t want to use the website functionality, simply change the rss and url settings to “no” in both After setting up the variables to reflect the situation on your MSS. It’s time to set up a cron job. Cron is built into Busybox, but it’s not part of the Busybox in OpenMSS 1.2.2-rc3. If you are running OpenMSS 1.2.2-rc3, it’s time to update Busybox using ipkg: # ipkg install busybox After installing the new Busybox, you can try typing: # crontab -e If you get an error (which I did the first time), it means cron is just missing some directories. Just type this: # mkdir -p /opt/var/spool/cron/crontabs That should solve the problem. Now, when you do crontab -e you can add the torrent script, but first we’re going to make sure cron starts every time the MSS boots. Type the following: # cd /opt/etc/init.d # vi S99Local VI can be a bit annoying, but to edit something, you first have to enter “edit mode” by pressing “i”. Then, add “crond &” after “utelnetd &”, like this: !/bin/sh utelnetd & crond & ~ Exit “edit mode” by pressing “Esc” and type the following to exit the vi editor and save your changes: “:x” and press enter. Now, simply start up cron by hand by typing: # crond & And you’re all ready to add the 3 */6 * * * /shares/mss-hdd/Public/Downloads/q3.sh Let me break that down: The first bit with the stars determines when cron will start the second bit. It consists of: minutes, hours, day, month, weekday. In our case it’s set to: every third minute, every 4 hours (24/6), any day, any month, any weekday. So every four hours it will start: /shares/mss-hdd/Public/Downloads/q3.sh - simple as that. InstructionsAfter a succesful installation, you can see whether the # cd /shares/mss-hdd/Public/Downloads/log # tail progress.log ================================ Q3 Download manager started at: Sat Feb 3 12:03:02 CET 2007 Downloading RSS feed... Fetching new torrent files... Checking the inbox for new torrents... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All torrents processed, ending at: Sat Feb 3 12:03:06 CET 2007 Removing pid... This means it’s time to add some torrents to your queue! Go to the following url to log in (where The script will present you with a login page. Type in your username in the first box and your password in the second and press “Login” to log in. Next, you’ll see a screen consisting of four parts: Manage Queue, Manage Subscriptions, Search Miscellaneous and Search Television. I will explain them in reverse order. Search Television: This allows you to search from a selection of television shows and subscribe to them. When you subscribe to a show, new episodes will automatically be added to your download queue when they become available. The search function is a suggested search, just enter a few letters and all the available options will automatically appear. Click on a show to see the available episodes. Keep in mind that most older episodes are usually not available. You can subscribe to a show by clicking on the title of an episode. If you wish to make changes to your subscription, you can do that on the Manage Subscriptions tab. Search Miscellaneous: This is the main search. You can search on several well-known torrent search engines, just enter a search term, select a search engine and click “Find” to see a list of results. The results are colour-coded: Green = good, Blue = reasonable and Red = difficult to impossible. Also, some search engines return torrents that require registration, these are listed in italics. Simply click on a title to add the torrent to your queue. Manage Subscriptions: This is an overview of all the television shows you are subscribed to, you can edit the settings by clicking on a title. You can then change several options, the most important being the episode number you are at right now. Sometimes, a certain episode won’t download successfully, so you’ll need to come back here and change the episode number back to the most recent one in your possession, this will trigger a new download of the following episodes. Manage Queue: The queue lists all torrents that are waiting to be downloaded. You can edit torrents by clicking on their title, this way you can change their name, priority or remove them from the queue. Torrents that have been downloaded to the inbox on your MSS/Kurobox are marked as “Fetched” with a priority of 0. They remain at the bottom of the queue, and you can remove them by clicking “Clear old queue entries” when they’re done. That’s about it! I hope this works for you as well as it does for me! AddendumAdditional search enginesIn the |