-
-
Save caius/1340158 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
Film.find_each do |f| | |
next if Film_imdb.find_by_title(f.title) | |
# Try to find it | |
imdb_search = Imdb::Search.new(f.title) | |
m = imdb_search.movies.first | |
# Check we found a movie | |
unless m | |
logger.error "couldn't find film for #{f.title.inspect} on IMDB" | |
next | |
end | |
# Save what we found! | |
f.update_attributes( | |
:IMDBurl => m.url, | |
:poster => m.poster, | |
:length => m.length, | |
:rating => m.rating, | |
:plot => m.plot, | |
:year => m.year, | |
:imdb_title => m.title, | |
:tagline => m.tagline | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment