11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/popcorn.rb', line 11
def import(movie_filename)
@moviemgr = Popcorn::MovieManager.new
while true
puts "Please enter search term for movie name: "
movie = STDIN.gets.chomp
@moviemgr.lookup(movie, movie_filename)
puts
puts "Looking up #{movie}"
unless @moviemgr.movie.nil?
puts "Title: #{@moviemgr.movie[:title]}"
puts "Year: #{@moviemgr.movie[:year]}"
print "Is this correct? (y/n): "
if STDIN.gets.chomp =~ /y/i
begin
@moviemgr.save_to_library
puts "Movie successfully imported."
rescue Exception => e
puts e.message
end
break
end
end
end
end
|