imdb_movies 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08eaec2d38a2b2ea5220be1f57eb3c0990325bd6
4
- data.tar.gz: bf8cdb67a8dba50a0f965c95c9e16e389aa0df92
3
+ metadata.gz: 0358af84ea07e6522acd36a70735567d372d46a0
4
+ data.tar.gz: ae8259f1a5cedd56ed433956f827d388bff30957
5
5
  SHA512:
6
- metadata.gz: df6ac6219b59a209c4c584ed86e5e49dee833525af76384b837b977b361ca8d49388f2687de31bdd2fe2527d63e25f5be7a7ccb21dd7419ae3086224e404d7f7
7
- data.tar.gz: d88ddb4724b05455729679502a125f680c6afc3fc8f3b4fb1cba68e1f0f4f0007edd5a3c4c964b2d2a7680ef76f73e99728b3065aa3a206abbec49de4114bfb0
6
+ metadata.gz: d4ff009df862f8ca7cd9c95bcb02304cb17ca90ee9ad88307687489c2e8bd670553a7176bea63f59ddfd9aa4f2b1131e8459a8a000c1fde73eb018ae8abfc1d7
7
+ data.tar.gz: 31014695b1c78565ce2976ac9265a0a127c67a9d48acbc24a232f3c573d301cb467cc99bb035b36ad59b47398c606fdd714e83bbd0f261d2bcf06d0aaf1f43cd
@@ -1,16 +1,22 @@
1
1
  # CLI Controller
2
- class ImdbMovies::CLI
2
+ class ImdbMovies::CLI
3
3
 
4
- attr_accessor :imdb_page, :nav_links, :movie_links
4
+ attr_accessor :opening_movie_names, :opening_week, :now_playing_movie_names, :coming_soon_movie_names, :coming_soon_week, :all_movie_names, :all_movie_links
5
5
 
6
6
  SKIP_MENU_DISPLAY = ["1", "2", "3", "opening this week", "now playing", "coming soon", "exit", "quit", ""]
7
7
 
8
8
  def initialize
9
- @nav_links, @movie_links = [], []
10
- @imdb_page = ImdbScraper.new.scrape
9
+
10
+ imdb_movies_info = ImdbScraper.new.scrape
11
+
12
+ @opening_movie_names = imdb_movies_info[0]
13
+ @opening_week = imdb_movies_info[1]
14
+ @now_playing_movie_names = imdb_movies_info[2]
15
+ @coming_soon_movie_names = imdb_movies_info[3]
16
+ @coming_soon_week = imdb_movies_info[4]
17
+ @all_movie_names = imdb_movies_info[5]
18
+ @all_movie_links = imdb_movies_info[6]
11
19
 
12
- @imdb_page.each{|cat| @nav_links << cat[0][1] }
13
- @imdb_page.each{|cat| cat[1].movie_links.each{|movie| @movie_links << movie}}
14
20
  end
15
21
 
16
22
  # Main CLI
@@ -23,52 +29,72 @@
23
29
 
24
30
  until user_input == "exit" || user_input == "quit"
25
31
  puts "\nYou can enter 1-3, a specific movie name, 'menu' or 'exit/quit'."
26
- print "Input : "
32
+ puts "The movie name does not have to be case sensitive to get the info."
33
+ print "\nInput : "
27
34
 
28
35
  user_input = gets.strip.downcase
29
- input(user_input, movie_links)
36
+ input(user_input)
30
37
 
31
38
  # Only displays the menu again if they entered a movie name or 'menu'
32
39
  main_menu if !SKIP_MENU_DISPLAY.include?(user_input)
33
40
  end
34
41
 
35
- puts "\n\nThank You for using IMDB Movies."
42
+ puts "\nThank You for using IMDB Movies."
36
43
  end
37
44
 
38
- # Displays categories (opening this week, now playing, coming soon)
45
+ # Displays movie categories (now playing, opening this week, coming soon) as well as first 5 movies if applicable
39
46
  def main_menu
40
47
 
48
+ # Displays movies already in theaters
49
+ puts "\n1 - Now Playing"
50
+ @now_playing_movie_names[0...5].each {|movie_name| puts "\t\t#{movie_name}"}
51
+ puts "\tEnter '1' to see more movies that are playing."
52
+
53
+ # Displays opening week movies
54
+ puts "\n2 - #{opening_week}"
55
+ @opening_movie_names[0...5].each {|movie_name| puts "\t\t#{movie_name}"}
56
+ puts "\tEnter '2' to see more movies that are opening this week."
57
+
41
58
  # Displays categories
42
- @imdb_page.each.with_index(1){|section, index|
43
- puts "\n#{index} - #{section[0][0].gsub(/\(\w+\)/, '')}"
44
- section[1].movie_links[0...5].each{|movie|
45
- puts "\t\t#{movie[0]}"
46
- }
47
- puts "\tEnter '#{index}' to see more."
48
- }
59
+ puts "\n3 - #{coming_soon_week}"
60
+ @coming_soon_movie_names[0...5].each {|movie_name| puts "\t\t#{movie_name}"}
61
+ puts "\tEnter '3' to see more movies that are coming after this week."
49
62
  end
50
63
 
51
64
  # Gets user's input and calls a different navigation methood based on input
52
- def input(user_input, movie_links)
65
+ def input(user_input)
53
66
 
54
67
  case user_input
55
68
  when "", "menu", "exit", "quit"
56
69
  when "1", "opening this week"
57
- Display.new(@imdb_page[0][1]).opening
70
+ display_movie_names(@opening_movie_names)
58
71
  when "2", "now playing"
59
- Display.new(@imdb_page[1][1]).now_playing
72
+ display_movie_names(@now_playing_movie_names)
60
73
  when "3", "coming soon"
61
- Display.new(@imdb_page[2][1]).coming_soon
74
+ display_movie_names(@coming_soon_movie_names)
62
75
 
63
- # When movie is entered it calls Display.movie
64
- # Otherwise it outputs a message.
76
+ # When movie is found is entered it creates a new instance of Movie from
65
77
  else
66
- # Nil if movie was not found
67
- movie_link = movie_links.detect { |m|
68
- m[0].downcase.gsub(/[^\w\s]+/, '').squeeze(" ").include?(user_input) }
69
-
70
- movie_link ? (Display.new().movie(movie_link[1])) : (puts "\nI'm sorry I don't know what you mean.")
78
+ # Search inside the @all_movie_names array. If you user input is included inside a movie title then store the index you found it at
79
+ found_movie_index = @all_movie_names.index{|movie_name| movie_name.downcase.gsub(/[^\w\s]+/, '').squeeze(" ").include?(user_input)}
80
+
81
+ # Create a new instance of Movie and have it display the info
82
+ # Otherwise show a message saying you're not sure what that was and display the menu again
83
+ if found_movie_index
84
+ movie = Movie.new(@all_movie_links[found_movie_index])
85
+ movie.display_info
86
+
87
+ print "\nDo you want to see the trailer on Youtube? Y / N "
88
+ input = gets.strip.downcase
89
+ movie.open_trailer if input == "yes" || input == "y"
90
+ else
91
+ puts "\nI'm sorry I don't know what you mean."
92
+ end
71
93
  end
72
94
  end
73
95
 
96
+ def display_movie_names(movie_names)
97
+ movie_names.each{|movie_name| puts "\t\t#{movie_name}"}
98
+ end
99
+
74
100
  end
@@ -3,49 +3,65 @@
3
3
 
4
4
  IMDB = "http://www.imdb.com"
5
5
 
6
- attr_accessor :category_info
6
+ attr_accessor :opening_movie_names, :opening_movie_links, :opening_week, :now_playing_movie_names, :now_playing_movie_links, :coming_soon_movie_names, :coming_soon_movie_links, :coming_soon_week, :all_movie_names, :all_movie_links
7
7
 
8
8
  def initialize
9
- @category_info = []
9
+ @opening_movie_names = []
10
+ @opening_movie_links = []
11
+ @opening_week = ""
12
+ @now_playing_movie_names = []
13
+ @now_playing_movie_links = []
14
+ @coming_soon_movie_names = []
15
+ @coming_soon_movie_links = []
16
+ @coming_soon_week = ""
17
+ @all_movie_names = []
18
+ @all_movie_links = []
10
19
  end
11
20
 
12
21
  def scrape
13
22
  doc = Nokogiri::HTML(open(IMDB))
23
+
24
+ # Gets the HTML for the divs on the sidebar
14
25
  sections = doc.css("#sidebar div.aux-content-widget-2")
15
26
 
16
- categories = []
27
+ # For each section, it gets and stores the movie names, links and the week if applicable
28
+ sections.each do |section|
17
29
 
18
- sections.each{|s|
19
- category = s.css(".widget_header .oneline h3").text
20
- begin
21
- category_link = IMDB + s.css(".seemore a").attr("href").value if category != ""
22
- rescue NoMethodError
23
- end
30
+ # Stores the category header in category.
31
+ # We only want the movies, not the television or social media
32
+ category = section.css(".widget_header .oneline h3").text
33
+
34
+ case category
35
+ when "Opening This Week", "Now Playing (Box Office)", "Coming Soon"
36
+
37
+ # Gets the see more url so that MovieLinksScraper knows where to get the movie links from
38
+ category_link = IMDB + section.css(".seemore a").attr("href").value
39
+
40
+ # Looks inside the linked page to get the movies for that category
41
+ # Stores the array of movie names and links inside @movie_names and @movie_links to be flattened later
42
+ category_movies = MovieLinksScraper.new(category_link)
43
+ case category
44
+ when "Opening This Week"
45
+ @opening_movie_names, @opening_movie_links, @opening_week = category_movies.opening
46
+ when "Now Playing (Box Office)"
47
+ @now_playing_movie_names, @now_playing_movie_links = category_movies.now_playing
48
+ when "Coming Soon"
49
+ @coming_soon_movie_names, @coming_soon_movie_links, @coming_soon_week = category_movies.coming_soon
50
+ @coming_soon_week = "Coming Soon - Week of " + @coming_soon_week
51
+ end
24
52
 
25
- begin
26
- category_movies = MovieLinksScraper.new(category_link)
27
- case category
28
- when "Opening This Week"
29
- category_movies.opening
30
- when "Now Playing (Box Office)"
31
- category_movies.now_playing
32
- when "Coming Soon"
33
- category_movies.coming_soon
34
53
  end
35
- movie_links = category_movies
36
- rescue NoMethodError
37
54
  end
38
55
 
39
- # Only save parts with movies
40
- # IMDB's site uses the same classes for every sidebar div
41
- # No ids to differentiate movies from tv shows and social media
42
- case category
43
- when "Opening This Week", "Now Playing (Box Office)", "Coming Soon"
44
- categories.push([[category, category_link], movie_links])
45
- end
46
- }
56
+ @all_movie_names = [@opening_movie_names, @now_playing_movie_names, @coming_soon_movie_names].flatten
57
+ @all_movie_links = [@opening_movie_links, @now_playing_movie_links, @coming_soon_movie_links].flatten
58
+
59
+ # Returning all the categories, movie names and links to the CLI to store
60
+ # We are sending back the category's link so that the Display class can look inside that page and get each movie name
61
+ # The CLI will not know what movies belong in which category, so it doesn't know how to display them
62
+ # The CLI calls the Display class so it can search for
47
63
 
48
- categories
64
+ return @opening_movie_names, @opening_week, @now_playing_movie_names, @coming_soon_movie_names, @coming_soon_week, @all_movie_names, @all_movie_links
49
65
  end
50
66
 
51
67
  end
@@ -1,86 +1,103 @@
1
- # Accepts a url from IMDB on initialization and scrapes info for that movie
1
+ # Accepts a url from IMDB on initialization and scrapes info from IMDB
2
2
  class Movie
3
- attr_accessor :url, :name, :movie_rating, :length, :genres, :release_date, :imdb_rating, :description, :directors, :writers, :cast, :trailer_link
3
+ attr_accessor :url, :name, :movie_rating, :length, :genres, :release_date, :imdb_rating, :description, :directors, :writers, :cast, :trailer_link
4
4
 
5
- def initialize(url)
6
- @url = url
5
+ def initialize(url)
6
+ @url = url
7
+ scrape_info
8
+ end
9
+
10
+ # Scrapes and stores movie's info from IMDB page
11
+ def scrape_info
12
+ info = Nokogiri::HTML(open(@url)).css(".article.title-overview")
13
+
14
+ @name = info.css("tbody h1.header span[itemprop = 'name']").text.strip
15
+
16
+ begin
17
+ @movie_rating = info.css(".infobar meta[itemprop = 'contentRating']").attr("content").value.strip
18
+ rescue NoMethodError
19
+ end
20
+
21
+ @length = info.css(".infobar time[itemprop = 'duration']").text.strip
22
+ @release_date = info.css("a[title = 'See all release dates']").text.strip.gsub(/\s+/, " ")
23
+ @imdb_rating = info.css(".titlePageSprite.star-box-giga-star").text.strip
24
+ @description = info.css("p[itemprop = 'description']").text.strip
7
25
 
8
- scrape_info
9
- end
26
+ genres = info.css("span[itemprop = 'genre']")
27
+ @genres = []
28
+ genres.each{|g| @genres << g.text }
29
+ @genres = @genres.join(", ")
10
30
 
11
- # Scrape and store info
12
- def scrape_info
13
- info = Nokogiri::HTML(open(@url)).css(".article.title-overview")
31
+ directors = info.css("div[itemprop = 'director'] span[itemprop = 'name']")
32
+ @directors = []
33
+ directors.each{|d| @directors << d.text}
14
34
 
15
- @name = info.css("tbody h1.header span[itemprop = 'name']").text.strip
16
-
17
- begin
18
- @movie_rating = info.css(".infobar meta[itemprop = 'contentRating']").attr("content").value.strip
19
- rescue NoMethodError
35
+ writers = info.css("div[itemprop = 'creator'] span[itemprop = 'name']")
36
+ @writers = []
37
+ writers.each{|w| @writers << w.text}
38
+
39
+ cast = info.css("div[itemprop = 'actors'] span[itemprop = 'name']")
40
+ @cast = []
41
+ cast.each{|c| @cast << c.text}
42
+
43
+ @trailer_link = trailer
20
44
  end
21
45
 
22
- @length = info.css(".infobar time[itemprop = 'duration']").text.strip
23
- @release_date = info.css("a[title = 'See all release dates']").text.strip.gsub(/\s+/, " ")
24
- @imdb_rating = info.css(".titlePageSprite.star-box-giga-star").text.strip
25
- @description = info.css("p[itemprop = 'description']").text.strip
26
-
27
- genres = info.css("span[itemprop = 'genre']")
28
- @genres = []
29
- genres.each{|g| @genres << g.text }
30
- @genres = @genres.join(", ")
31
-
32
- directors = info.css("div[itemprop = 'director'] span[itemprop = 'name']")
33
- @directors = []
34
- directors.each{|d| @directors << d.text}
35
-
36
- writers = info.css("div[itemprop = 'creator'] span[itemprop = 'name']")
37
- @writers = []
38
- writers.each{|w| @writers << w.text}
39
-
40
- cast = info.css("div[itemprop = 'actors'] span[itemprop = 'name']")
41
- @cast = []
42
- cast.each{|c| @cast << c.text}
43
-
44
- @trailer_link = trailer
45
- end
46
-
47
- # Scrapes Youtube search results for first video link
48
- # searches movie name + ' trailer'
49
- def trailer
50
- name = @name.downcase.split(/\W+/).join("+")
51
- youtube_search = "https://www.youtube.com/results?search_query="
52
- youtube_search_query = Nokogiri::HTML(open(youtube_search + name + "+trailer", ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE))
53
-
54
- trailer_link = "https://youtube.com" + youtube_search_query.css("#results ol.section-list li ol.item-section li div.yt-lockup-dismissable div.yt-lockup-content h3.yt-lockup-title a").attr("href").value
55
- end
56
-
57
- def display_info
58
- puts "\n#{@name}\n\n"
59
- puts "Movie Rating: \t#{@movie_rating}"
60
- puts "Length: \t#{@length}"
61
- puts "Genre: \t\t#{@genres}"
62
- puts "Release Date: \t#{@release_date}"
63
- @imdb_rating != "" ? (puts "IMDB Rating: \t#{@imdb_rating}/10.0") : (puts "IMDB Rating: \tNo Ratings Yet")
64
- puts "Description: \t#{@description}"
65
- puts "Director(s): \t#{@directors.join(", ")}"
66
- puts "Writer(s): \t#{@writers.join(", ")}"
67
- puts "Cast: \t\t#{@cast.join(", ")}"
68
- puts "\nTrailer: \t#{@trailer_link}"
69
- end
70
-
71
- def open_trailer
72
- begin
73
- exec("open #{@trailer_link}")
74
- rescue SystemCallError
46
+ # Scrapes Youtube search results for first video link
47
+ # searches movie name + ' trailer'
48
+ def trailer
49
+ movie_name = @name.downcase.split(/\W+/).join("+")
50
+ youtube_search = "https://www.youtube.com/results?search_query=" + movie_name + "+trailer"
51
+
52
+ # Scrapes HTML for Youtube search results
53
+ # 'ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE' is to get past SSL verification for open-uri when getting Youtube's HTML
54
+ youtube_search_query = Nokogiri::HTML(open(youtube_search, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE))
55
+
56
+ # Scrape first link
57
+ trailer_link = "https://youtube.com" + youtube_search_query.css("#results ol.section-list li ol.item-section li div.yt-lockup-dismissable div.yt-lockup-content h3.yt-lockup-title a").attr("href").value
75
58
  end
76
- begin
77
- exec("start #{@trailer_link}")
78
- rescue SystemCallError
59
+
60
+ def display_info
61
+ puts "\n#{@name}\n\n"
62
+ puts "Movie Rating: \t#{@movie_rating}"
63
+ puts "Length: \t#{@length}"
64
+ puts "Genre: \t\t#{@genres}"
65
+ puts "Release Date: \t#{@release_date}"
66
+
67
+ if @imdb_rating != ""
68
+ puts "IMDB Rating: \t#{@imdb_rating}/10.0"
69
+ else
70
+ puts "IMDB Rating: \tNo Ratings Yet"
71
+ end
72
+
73
+ puts "Description: \t#{@description}"
74
+ puts "Director(s): \t#{@directors.join(", ")}"
75
+ puts "Writer(s): \t#{@writers.join(", ")}"
76
+ puts "Cast: \t\t#{@cast.join(", ")}"
77
+ puts "\nTrailer: \t#{@trailer_link}"
79
78
  end
80
- begin
81
- exec("xdg-open #{@trailer_link}")
82
- rescue SystemCallError
79
+
80
+ # Executes command to open youtube link inside browser
81
+ def open_trailer
82
+
83
+ # Mac OS X
84
+ begin
85
+ exec("open #{@trailer_link}")
86
+ rescue SystemCallError
87
+ end
88
+
89
+ # Windows
90
+ begin
91
+ exec("start #{@trailer_link}")
92
+ rescue SystemCallError
93
+ end
94
+
95
+ # Linux/Unix
96
+ begin
97
+ exec("xdg-open #{@trailer_link}")
98
+ rescue SystemCallError
99
+ end
100
+
83
101
  end
84
- end
85
102
  end
86
103
 
@@ -1,46 +1,63 @@
1
1
  class MovieLinksScraper
2
- attr_accessor :movie_links, :url, :opening_week
2
+ attr_accessor :url, :movie_names, :movie_links, :opening_week, :upcomming_week
3
3
 
4
- IMDB = "http://www.imdb.com"
4
+ IMDB = "http://www.imdb.com"
5
5
 
6
- def initialize(url)
7
- # Array of arrays, each with movie name and link
8
- @movie_links = []
6
+ def initialize(url)
7
+ @url = url
8
+ @movie_names = []
9
+ @movie_links = []
10
+ @opening_week = ""
11
+ @comming_soon_week = ""
12
+ end
13
+
14
+ # Gets the links and opening week from IMDB for the movies that are opening up this week
15
+ # The movie names and links to the movies' IMDB pages are returned back to ImdbScraper
16
+ def opening
17
+ doc = Nokogiri::HTML(open(@url))
18
+ movie_links = doc.css(".article .list")[1].css(".list_item h4[itemprop = 'name'] a")
19
+ add_movie_name_and_links(movie_links)
9
20
 
10
- @url = url
11
- end
21
+ # Stores the header that is shown on the opening week movies page
22
+ # Example: 'Opening This Week - January 22' is stored
23
+ @opening_week = doc.css(".article .list h3").first.text
12
24
 
13
- def opening
14
- doc = Nokogiri::HTML(open(@url))
15
- movie_links = doc.css(".article .list")[1].css(".list_item h4[itemprop = 'name'] a")
16
- begin
17
- movie_links.each{|m_link| @movie_links.push( [ m_link.text.gsub(/\(\w+\)/, ""), (IMDB + m_link.attr("href")) ] )}
18
- rescue NoMethodError
25
+ return @movie_names, @movie_links, @opening_week
19
26
  end
20
27
 
21
- @opening_week = doc.css(".article .list h3").first.text
22
- @movie_links
23
- end
28
+ # Gets the links from IMDB for the movies that are popular and in theaters now
29
+ # The movie names and links to the movies' IMDB pages are returned back to ImdbScraper
30
+ def now_playing
31
+ doc = Nokogiri::HTML(open(@url))
32
+ movie_links = doc.css("tbody tr td.titleColumn a")
33
+ add_movie_name_and_links(movie_links)
24
34
 
25
- def now_playing
26
- doc = Nokogiri::HTML(open(@url))
27
- movie_links = doc.css("tbody tr td.titleColumn a")
28
- begin
29
- movie_links.each{|m_link| @movie_links.push( [ m_link.text.gsub(/\(\w+\)/, ""), (IMDB + m_link.attr("href")) ] )}
30
- rescue NoMethodError
35
+ return @movie_names, @movie_links
31
36
  end
32
- @movie_links
33
- end
34
-
35
- def coming_soon
36
- doc = Nokogiri::HTML(open(@url))
37
- movie_links = doc.css(".list.detail .list_item h4[itemprop = 'name'] a")
38
- begin
39
- movie_links.each{|m_link| @movie_links.push( [ m_link.text.gsub(/\(\w+\)/, ""), (IMDB + m_link.attr("href")) ] )}
40
- rescue NoMethodError
37
+
38
+ # Gets the links and opening week from IMDB for the movies that are comming up in 2 weeks
39
+ # The movie names and links to the movies' IMDB pages are returned back to ImdbScraper
40
+ def coming_soon
41
+ doc = Nokogiri::HTML(open(@url))
42
+ movie_links = doc.css(".list.detail .list_item h4[itemprop = 'name'] a")
43
+ add_movie_name_and_links(movie_links)
44
+
45
+ # Stores the header that is show on the coming soon movies page
46
+ # Example: 'January 29' is stored
47
+ @coming_soon_week = doc.css(".list.detail h4.li_group a").first.text
48
+ return @movie_names, @movie_links, @coming_soon_week
41
49
  end
42
50
 
43
- @opening_week = doc.css(".list.detail h4.li_group a").first.text
44
- @movie_links
45
- end
51
+ # Gets an array movie links that were scraped from an IMDB
52
+ # Each movie link has the movie name as the text.
53
+ # We are pushing each movie name and link inside @movie_names and @movie_links
54
+ def add_movie_name_and_links(movie_links)
55
+ # Pulls anchors which are movie names with links to that movie's page on IMDB
56
+ movie_links.each do |link|
57
+ # Gets the movie name from text
58
+ @movie_names << link.text.gsub(/\(\w+\)/, '')
59
+ # Gets the movie's url
60
+ @movie_links << IMDB + link.attr("href")
61
+ end
62
+ end
46
63
  end
@@ -1,3 +1,3 @@
1
1
  module ImdbMovies
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
data/lib/imdb_movies.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require_relative "./imdb_movies/version"
2
2
  require_relative "./imdb_movies/cli"
3
- require_relative "./imdb_movies/display"
4
3
  require_relative "./imdb_movies/imdb_scraper"
5
4
  require_relative "./imdb_movies/movie.rb"
6
5
  require_relative "./imdb_movies/movie_links_scraper"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imdb_movies
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - azheng249
@@ -102,7 +102,6 @@ files:
102
102
  - imdb_movies.gemspec
103
103
  - lib/imdb_movies.rb
104
104
  - lib/imdb_movies/cli.rb
105
- - lib/imdb_movies/display.rb
106
105
  - lib/imdb_movies/imdb_scraper.rb
107
106
  - lib/imdb_movies/movie.rb
108
107
  - lib/imdb_movies/movie_links_scraper.rb
@@ -1,35 +0,0 @@
1
- class Display
2
-
3
- attr_accessor :links
4
-
5
- def initialize(links = nil)
6
- @links = links
7
- end
8
-
9
- def opening
10
- puts @links.opening_week + "\n\n"
11
- @links.movie_links.each{|m| puts "\t\t#{m[0]}"}
12
-
13
- end
14
-
15
- def now_playing
16
- puts "Now Playing\n\n"
17
- @links.movie_links.each{|m| puts "\t\t#{m[0]}"}
18
- end
19
-
20
- def coming_soon
21
- puts "Coming Soon - \t" + @links.opening_week + "\n\n"
22
- @links.movie_links.each{|m| puts "\t\t#{m[0]}"}
23
- end
24
-
25
- def movie(movie_url)
26
- movie = Movie.new(movie_url)
27
- movie.display_info
28
-
29
- print "\nDo you want to see the trailer for this movie (Y/N):\t"
30
- user_input = gets.strip.downcase
31
-
32
- movie.open_trailer if user_input == "y" || user_input == "yes"
33
- end
34
-
35
- end