Created
December 8, 2008 05:55
-
-
Save dagbrown/33369 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# tvrss - a BitTorrent torrent-RSS puller | |
# | |
# Make a directory called ~/.tvrss | |
# Make another called ~/.tvrss/torrents | |
# Put URLs of RSS feeds in ~/.tvrss/feeds | |
# Bob's your uncle! | |
require 'rubygems' | |
require 'simple-rss' | |
require 'open-uri' | |
urls = [] | |
File.open(ENV["HOME"]+"/.tvrss/feeds").each_line do |line| | |
next if line =~ /^#/ or line =~ /^\s*$/ | |
urls.unshift(line.chomp) | |
end | |
Dir.chdir(ENV["HOME"]+"/.tvrss/torrents") | |
urls.each do |url| | |
rss = SimpleRSS.parse open(url).read | |
rss.entries.each do |entry| | |
next if File.exists? entry.title+".torrent" | |
File.open(entry.title+".torrent","w") do |fh| | |
fh.write open(entry.link).read | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment