Skip to content

Instantly share code, notes, and snippets.

@simongregory
Last active December 29, 2015 20:29
Show Gist options
  • Save simongregory/7724014 to your computer and use it in GitHub Desktop.
Save simongregory/7724014 to your computer and use it in GitHub Desktop.
#!/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