new_york_films 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/new_york_films +4 -0
- data/bin/setup +8 -0
- data/lib/new_york_films/cli.rb +98 -0
- data/lib/new_york_films/film_finder.rb +103 -0
- data/lib/new_york_films/new_york_films.rb +9 -0
- data/lib/new_york_films/screening.rb +13 -0
- data/lib/new_york_films/version.rb +3 -0
- metadata +108 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: e6f92151b1232cc9f4a61cb72e2cd4d06dcd23ec
|
|
4
|
+
data.tar.gz: c86c2597111eb97c1b5f86aaee42e2e139762141
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 478ebf02597bb72c29a0b0a4aeff7bbdf152686b35bde9744afdfb767d690ee5e0e33bb69d81f54b849dedfa105bae24b00262017aaed9f9b7cc4950fead23e1
|
|
7
|
+
data.tar.gz: bf0c77d116b6d5c1fb3416d112c4defbd305d202a67cc4b45d581ec6b90f736fdcea13a56bcc9c9ac9f4a77b0f62ed34ac4bff7f7a3d7815436d71f401549175
|
data/bin/new_york_films
ADDED
data/bin/setup
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
require_relative "film_finder.rb"
|
|
2
|
+
|
|
3
|
+
class NewYorkFilms::CLI
|
|
4
|
+
|
|
5
|
+
def call
|
|
6
|
+
prompt
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def prompt(input=nil)
|
|
11
|
+
if input == nil
|
|
12
|
+
puts "\n" + "Welcome to today's listing for arthouse film screenings in NYC. \nWould you like to see 1. All or 2. Listings by theater?"
|
|
13
|
+
input = gets.chomp
|
|
14
|
+
case input
|
|
15
|
+
when "1", "all", "1."
|
|
16
|
+
show_all
|
|
17
|
+
when "2", "by theater", "2."
|
|
18
|
+
theater_select
|
|
19
|
+
when "exit"
|
|
20
|
+
hard_out
|
|
21
|
+
else
|
|
22
|
+
puts "Please type 1 or 2 to see listings."
|
|
23
|
+
prompt
|
|
24
|
+
end
|
|
25
|
+
elsif input == "1"
|
|
26
|
+
show_all
|
|
27
|
+
elsif input == "2"
|
|
28
|
+
theater_select
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def show_all
|
|
33
|
+
puts "Give me just one minute to get those for you..."
|
|
34
|
+
NewYorkFilms::FilmFinder.scraper
|
|
35
|
+
x = NewYorkFilms::FilmFinder.all
|
|
36
|
+
x.each do |film|
|
|
37
|
+
puts "\n" + "THEATER: #{film.theater}\n" + "FILM: #{film.title}\n" + "DIRECTOR: #{film.director}\n" + "YEAR: #{film.year} - LENGTH: #{film.length}\n" + "TIMES: #{film.times}\n" + "MORE INFO: #{film.website}\n" + "LOCATION: #{film.location}"
|
|
38
|
+
end
|
|
39
|
+
what_next?
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def theater_select
|
|
44
|
+
puts "Enter the number of the theater you'd like to see:"
|
|
45
|
+
NewYorkFilms::FilmFinder.theater_scraper
|
|
46
|
+
x = NewYorkFilms::FilmFinder.theaters.uniq
|
|
47
|
+
x.each.with_index(1) do |film,index|
|
|
48
|
+
puts "#{index}. #{film}"
|
|
49
|
+
end
|
|
50
|
+
answer = gets.chomp
|
|
51
|
+
puts "Give me just one minute to get that for you..."
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
theater_choice = "#{x.at(answer.to_i - 1)}"
|
|
55
|
+
if answer.to_i.between?(1,x.length+1)
|
|
56
|
+
choose_theater(theater_choice)
|
|
57
|
+
elsif answer == "exit"
|
|
58
|
+
hard_out
|
|
59
|
+
else
|
|
60
|
+
puts "Please enter a correct number."
|
|
61
|
+
prompt("2")
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def choose_theater(input)
|
|
68
|
+
NewYorkFilms::FilmFinder.scraper
|
|
69
|
+
NewYorkFilms::FilmFinder.all.each do |film|
|
|
70
|
+
if film.theater == input
|
|
71
|
+
puts "\n" + "THEATER: #{film.theater}\n" + "FILM: #{film.title}\n" + "DIRECTOR: #{film.director}\n" + "YEAR: #{film.year} - LENGTH: #{film.length}\n" + "TIMES: #{film.times}\n" + "MORE INFO: #{film.website}\n" + "LOCATION: #{film.location}"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
what_next?
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def what_next?
|
|
78
|
+
puts "\n"+"Would you like to 1. Go back to main menu or 2. Exit?"
|
|
79
|
+
input = gets.chomp.downcase
|
|
80
|
+
case input
|
|
81
|
+
when "1", "menu", "1."
|
|
82
|
+
prompt
|
|
83
|
+
when "2", "2.", "exit"
|
|
84
|
+
hard_out
|
|
85
|
+
else
|
|
86
|
+
puts "Not sure what you meant. Please enter 1 to go to the menu or 2 to exit."
|
|
87
|
+
what_next?
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def hard_out
|
|
92
|
+
puts "\n"+"'No art passes our conscience in the way film does, and goes directly to our feelings, deep down into the dark rooms of our souls.'\n -Ingmar Bergman"
|
|
93
|
+
exit
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'nokogiri'
|
|
2
|
+
require 'open-uri'
|
|
3
|
+
# require_relative "./screening.rb"
|
|
4
|
+
|
|
5
|
+
class NewYorkFilms::Screening
|
|
6
|
+
attr_accessor :theater, :title, :times, :director, :year, :length, :website, :location
|
|
7
|
+
def initialize(attributes = {})
|
|
8
|
+
@theater = attributes[:theater]
|
|
9
|
+
@title = attributes[:title]
|
|
10
|
+
@director = attributes[:director]
|
|
11
|
+
@times = attributes[:times]
|
|
12
|
+
@year = attributes[:year]
|
|
13
|
+
@length = attributes[:length]
|
|
14
|
+
@website = attributes[:website]
|
|
15
|
+
@location = attributes[:location]
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class NewYorkFilms::FilmFinder
|
|
21
|
+
|
|
22
|
+
@@all_films = []
|
|
23
|
+
@@theaters = []
|
|
24
|
+
|
|
25
|
+
def self.theaters
|
|
26
|
+
@@theaters
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.all
|
|
30
|
+
@@all_films
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.scraper
|
|
34
|
+
doc = Nokogiri::HTML(open("http://www.screenslate.com/"))
|
|
35
|
+
|
|
36
|
+
doc.search("ul li.screenings__venue___2EEUR li.screenings__screening___2wxaa").map do |film|
|
|
37
|
+
@@all_films << screening = NewYorkFilms::Screening.new
|
|
38
|
+
|
|
39
|
+
if film.parent.parent.css("h3") != nil
|
|
40
|
+
screening.theater = film.parent.parent.css("h3").text
|
|
41
|
+
else
|
|
42
|
+
screening.theater = "not provided"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if film.css("a.screening__link___1rTIP") != nil
|
|
46
|
+
screening.title = film.css("a.screening__link___1rTIP").text
|
|
47
|
+
else
|
|
48
|
+
screening.title = "not provided"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
if film.search("div.screening__details___2yckE span")[0] != nil
|
|
53
|
+
screening.director = film.search("div.screening__details___2yckE span")[0].text
|
|
54
|
+
else
|
|
55
|
+
screening.director = "Not listed."
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
if film.search("div.screening__details___2yckE span")[1] != nil
|
|
59
|
+
screening.year = film.search("div.screening__details___2yckE span")[1].text
|
|
60
|
+
else
|
|
61
|
+
screening.year = "not provided"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
if film.search("div.screening__details___2yckE span")[2] != nil
|
|
65
|
+
screening.length = film.search("div.screening__details___2yckE span")[2].text
|
|
66
|
+
else
|
|
67
|
+
screening.length = "not provided"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if film.search("div.screening__showtimespacing___17fBg span.screening__showtime___3oJD6") != nil
|
|
71
|
+
screening.times = film.search("div.screening__showtimespacing___17fBg span.screening__showtime___3oJD6").text.gsub("pm","pm ").gsub("am", "am ")
|
|
72
|
+
else
|
|
73
|
+
screening.times = "not provided"
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if film.search("a.screening__link___1rTIP").attribute('href') == nil
|
|
77
|
+
film.attribute('href').value = "http://www.screenslate.com/"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
screening.website = film.search("a.screening__link___1rTIP").attribute("href").value
|
|
81
|
+
|
|
82
|
+
contact = film.parent.parent.css("a").attribute("href").value
|
|
83
|
+
venue = Nokogiri::HTML(open("http://www.screenslate.com#{contact}"))
|
|
84
|
+
|
|
85
|
+
if venue.css("div.venue__info___2bLnH p") != nil
|
|
86
|
+
screening.location = venue.css("div.venue__info___2bLnH p").first.text.gsub("Location ", "") if venue.css("div.venue__info___2bLnH p").first.text.include?(", NY")
|
|
87
|
+
screening.location = venue.css("div.venue__info___2bLnH p")[1].text.gsub("Location ", "") if venue.css("div.venue__info___2bLnH p")[1].text.include?(", NY")
|
|
88
|
+
else
|
|
89
|
+
screening.location = "please see theater's website."
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def self.theater_scraper
|
|
95
|
+
doc = Nokogiri::HTML(open("http://www.screenslate.com/"))
|
|
96
|
+
doc.search("ul li.screenings__venue___2EEUR li.screenings__screening___2wxaa").each do |film|
|
|
97
|
+
@@theaters << film.parent.parent.css("h3").text
|
|
98
|
+
end
|
|
99
|
+
@@theaters
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class NewYorkFilms::Screening
|
|
2
|
+
attr_accessor :theater, :title, :times, :director, :year, :length, :website, :location
|
|
3
|
+
def initialize(attributes = {})
|
|
4
|
+
@theater = attributes[:theater]
|
|
5
|
+
@title = attributes[:title]
|
|
6
|
+
@director = attributes[:director]
|
|
7
|
+
@times = attributes[:times]
|
|
8
|
+
@year = attributes[:year]
|
|
9
|
+
@length = attributes[:length]
|
|
10
|
+
@website = attributes[:website]
|
|
11
|
+
@location = attributes[:location]
|
|
12
|
+
end
|
|
13
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: new_york_films
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.4
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Ben Norris
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-08-12 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.12'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.12'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: nokogiri
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
description: Art house films across the city
|
|
70
|
+
email:
|
|
71
|
+
- bennorris07@gmail.com
|
|
72
|
+
executables:
|
|
73
|
+
- new_york_films
|
|
74
|
+
extensions: []
|
|
75
|
+
extra_rdoc_files: []
|
|
76
|
+
files:
|
|
77
|
+
- bin/new_york_films
|
|
78
|
+
- bin/setup
|
|
79
|
+
- lib/new_york_films/cli.rb
|
|
80
|
+
- lib/new_york_films/film_finder.rb
|
|
81
|
+
- lib/new_york_films/new_york_films.rb
|
|
82
|
+
- lib/new_york_films/screening.rb
|
|
83
|
+
- lib/new_york_films/version.rb
|
|
84
|
+
homepage: http://www.github.com/bennorris
|
|
85
|
+
licenses:
|
|
86
|
+
- MIT
|
|
87
|
+
metadata: {}
|
|
88
|
+
post_install_message:
|
|
89
|
+
rdoc_options: []
|
|
90
|
+
require_paths:
|
|
91
|
+
- lib
|
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
|
+
requirements:
|
|
99
|
+
- - ">="
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: '0'
|
|
102
|
+
requirements: []
|
|
103
|
+
rubyforge_project:
|
|
104
|
+
rubygems_version: 2.5.1
|
|
105
|
+
signing_key:
|
|
106
|
+
specification_version: 4
|
|
107
|
+
summary: Today's independent movies in NYC
|
|
108
|
+
test_files: []
|