Last active
December 29, 2015 20:29
-
-
Save simongregory/7724014 to your computer and use it in GitHub Desktop.
This file contains 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/env ruby -wKU | |
file = ARGV[0] | |
unless File.exist?(file) | |
puts "Where's the list of films?" | |
exit | |
end | |
df = IO.readlines(file) | |
print "Search IMDB (i) or Rotten Tomatoes (r)? " | |
search = { :name => "Rotten Tomatoes", :url => "http://www.rottentomatoes.com/search/?search=FILM&sitesearch=rt" } | |
search = { :name => "IMDB", :url => "http://www.imdb.com/find?q=FILM&s=all" } if STDIN.gets =~ /i/i | |
df.each do |film| | |
next if film =~ /^\s*$/ | |
film = File.basename(film, ".*") | |
print "Lookup \033[32m#{film}\033[0m on #{search[:name]}? (y/n) " | |
response = STDIN.gets | |
if response =~ /y/i | |
`open "#{search[:url].sub('FILM',film)}"` | |
elsif response =~ /q/i | |
break | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment