Notice: Undefined index: path in /home/resavr/public_html/comment.php on line 78
Write some Ruby or Python - save the world

Write some Ruby or Python - save the world

Even in ruby it's easier. All you need is nokogiri, addressable and some kind of db to keep track of things (I like sequel gem with mysql).

For me it's much more satisfying to write these little snippets of code than the work I do at the office. As these little snippets solve my problems and automate my own life.

I used to write these little scripts that scrap photo galleries of porn sites and neatly organize them. I even thought of writing some kind of image recognition to group related photos or to eliminate duplicate ones. But everyday I would eventually get tired and lose interest :-P.

Now a days I use my ruby scripts to download subtitles & automate transmission.

My transmission script can do these little things.

  • adjust active download queue size to use full bandwidth.
  • adjust number of peers per torrent based on download speed of a torrent. As the download speed increases number peers get decreased to prevent network congestion (I am not sure about this but I am able to browse web while downloading after doing this).
  • I have a file called keywords.txt that contains list of regex strings to match torrents and order them based on the regex position in the keywords.txt. So I can have a s\d+e\d+ at the top of the keywords.txt file and have the tv episodes download before other torrents. If necessary adjust queue position. Torrent that don't match these patterns are queued based on the availability of the peers to utilize full bandwidth.
  • Go to . Get list of movies sorted by peers and filtered by YIFY 720p, and filter out dvdrip sdrip camrip etc.. and add the top one to transmission. And some file based mechanism to prevent re downloading the same torrent twice.
  • Generate stats of the current downloads write into text file in the BTSync folder every hour.
  • If I create an empty file st.txt in BTSync folder. As soon as my script reads this file it will go to sleep(stop all torrents) for an hour and then automatically resume. Don't have to worry about forgetting resuming paused torrents.
  • Adjust upload speed so that download speed is not affected. You can seed the torrent without affecting your download speed.

This is all done on raspberry pi. But for some reason python on pi runs much faster than ruby. For ruby to start it takes about half a minute.

For my next pet project I am thinking about taking something like rtorrent and creating a complete web frontend for it. With all the above features mentioned above and more.

/r/programming Thread Link -