what_to_watch 0.1.1
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/.DS_Store +0 -0
- data/.gitignore +8 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +30 -0
- data/LICENSE.txt +21 -0
- data/README.md +48 -0
- data/Rakefile +2 -0
- data/bin/console +21 -0
- data/bin/setup +8 -0
- data/bin/what_to_watch +6 -0
- data/lib/.DS_Store +0 -0
- data/lib/what_to_watch/best_movies.rb +27 -0
- data/lib/what_to_watch/best_tv.rb +26 -0
- data/lib/what_to_watch/cli.rb +254 -0
- data/lib/what_to_watch/recently_added.rb +26 -0
- data/lib/what_to_watch/scraper.rb +40 -0
- data/lib/what_to_watch/show.rb +72 -0
- data/lib/what_to_watch/version.rb +3 -0
- data/lib/what_to_watch.rb +18 -0
- data/what_to_watch.gemspec +46 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fc62fe0cde36b6df0b7b3eefef15af609b8750c7b07accd0c00ed62a6416ea5d
|
4
|
+
data.tar.gz: 399f92b05cfa3cbf992ee15d006e63e1637bc167ff1678b6e93e90dd78ffe9f5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7a3f7a94ec6c272480d77dafc3736680289084f5e1295689b7aab8d995ef15f87f84ac8668f73438b1d36ecc245f8cce477aecfca567c645383c9801d6cf784b
|
7
|
+
data.tar.gz: fce9a7874ecfcace8d9963d9c3b7f43526678b160a53b8450d081b00cb878ce3e901776b986025424a6a08a78921eca7bea7858f3ca81cdc55476b7892861f7d
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at 'gpianka1@gmail.com'. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
what_to_watch (0.1.1)
|
5
|
+
nokogiri
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
coderay (1.1.2)
|
11
|
+
method_source (0.9.0)
|
12
|
+
mini_portile2 (2.3.0)
|
13
|
+
nokogiri (1.8.4)
|
14
|
+
mini_portile2 (~> 2.3.0)
|
15
|
+
pry (0.11.3)
|
16
|
+
coderay (~> 1.1.0)
|
17
|
+
method_source (~> 0.9.0)
|
18
|
+
rake (10.5.0)
|
19
|
+
|
20
|
+
PLATFORMS
|
21
|
+
ruby
|
22
|
+
|
23
|
+
DEPENDENCIES
|
24
|
+
bundler (~> 1.16)
|
25
|
+
pry
|
26
|
+
rake (~> 10.0)
|
27
|
+
what_to_watch!
|
28
|
+
|
29
|
+
BUNDLED WITH
|
30
|
+
1.16.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 'George Pianka'
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# WhatToWatch
|
2
|
+
### Best Reviewed and Recently Added Movies/Television Based on User's Streaming Subscriptions
|
3
|
+
|
4
|
+
This Ruby Gem provides a CLI to view Highest Rated/Recently Added Movies and Television according to Vulture.com Streaming Recommendations, and provides additional details on the user's selection according to IMDB.com.
|
5
|
+
The Gem asks which popular streaming services the user has access to and whether the user wants recommendations for Highest Reviewed Films, Highest Reviewed Television, or Most Recent Additions.
|
6
|
+
The Gem returns a filtered list of recommendatons from Vulture.com and then further details/information from IMDB.com upon user request.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
### Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```
|
13
|
+
gem 'what_to_watch'
|
14
|
+
```
|
15
|
+
|
16
|
+
### And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
|
21
|
+
### Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install what_to_watch
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Type the below and follow the on screen prompts.
|
28
|
+
|
29
|
+
$ what_to_watch
|
30
|
+
|
31
|
+
## Development
|
32
|
+
|
33
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then run `bin/console` for an interactive prompt that will allow you to experiment.
|
34
|
+
|
35
|
+
`bin/console` is coded with a #reload! method to refresh the state of the codebase during the console session. By default, the #reload! method reloads all `./lib` files in the current console session
|
36
|
+
|
37
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
Bug reports and pull requests are welcome on GitHub at
|
42
|
+
### https://github.com/NotoriousCottonball/what_to_watch.
|
43
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
44
|
+
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "what_to_watch"
|
5
|
+
|
6
|
+
require "pry"
|
7
|
+
|
8
|
+
|
9
|
+
def reload!
|
10
|
+
puts "Reloading ..."
|
11
|
+
load "./lib/what_to_watch.rb"
|
12
|
+
load "./lib/what_to_watch/cli.rb"
|
13
|
+
load "./lib/what_to_watch/best_movies.rb"
|
14
|
+
load "./lib/what_to_watch/recently_added.rb"
|
15
|
+
load "./lib/what_to_watch/best_tv.rb"
|
16
|
+
load "./lib/what_to_watch/scraper.rb"
|
17
|
+
load "./lib/what_to_watch/show.rb"
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
pry.start
|
data/bin/setup
ADDED
data/bin/what_to_watch
ADDED
data/lib/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class WhatToWatch::BestMovies < WhatToWatch::Show
|
2
|
+
|
3
|
+
@@all = []
|
4
|
+
|
5
|
+
def self.all
|
6
|
+
@@all
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.reset!
|
10
|
+
@@all = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.rows
|
14
|
+
[10, 11]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.list(hash)
|
18
|
+
puts ""
|
19
|
+
puts "======================"
|
20
|
+
puts " Best Reviewed Movies "
|
21
|
+
puts "======================"
|
22
|
+
puts ""
|
23
|
+
self.print_list(hash)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class WhatToWatch::BestTV < WhatToWatch::Show
|
2
|
+
|
3
|
+
@@all = []
|
4
|
+
|
5
|
+
def self.all
|
6
|
+
@@all
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.reset!
|
10
|
+
@@all = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.rows
|
14
|
+
[7, 8, 9]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.list(hash)
|
18
|
+
puts ""
|
19
|
+
puts "=========================="
|
20
|
+
puts " Best Reviewed Television "
|
21
|
+
puts "=========================="
|
22
|
+
puts ""
|
23
|
+
self.print_list(hash)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,254 @@
|
|
1
|
+
class WhatToWatch::CLI
|
2
|
+
attr_accessor :input, :streaming_services
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@input = ""
|
6
|
+
@streaming_services = {netflix: "n", amazon_prime: "n", hbo_now: "n", hulu: "n", showtime: "n"}
|
7
|
+
puts "=========================================="
|
8
|
+
puts %q[
|
9
|
+
__ ___ _ _
|
10
|
+
\ \ / / |__ __ _| |_ | |_ ___
|
11
|
+
\ \ /\ / /| '_ \ / _` | __| | __/ _ \
|
12
|
+
\ V V / | | | | (_| | |_ | || (_) |
|
13
|
+
__ \_/\_/ _|_| |_|\__,_|\__| \__\___/
|
14
|
+
\ \ / /_ _| |_ ___| |__
|
15
|
+
\ \ /\ / / _` | __/ __| '_ \
|
16
|
+
\ V V / (_| | || (__| | | |
|
17
|
+
\_/\_/ \__,_|\__\___|_| |_|
|
18
|
+
|
19
|
+
]
|
20
|
+
puts "=========================================="
|
21
|
+
puts ""
|
22
|
+
puts "Welcome to What To Watch!"
|
23
|
+
puts ""
|
24
|
+
which_streaming_services
|
25
|
+
end
|
26
|
+
|
27
|
+
def start
|
28
|
+
while !exit?
|
29
|
+
main_commands
|
30
|
+
while !exit?
|
31
|
+
case @input
|
32
|
+
when "1"
|
33
|
+
WhatToWatch::BestMovies.add_shows
|
34
|
+
WhatToWatch::BestMovies.list(@streaming_services)
|
35
|
+
options
|
36
|
+
while !exit?
|
37
|
+
if valid_number?(WhatToWatch::BestMovies.all)
|
38
|
+
WhatToWatch::BestMovies.print_item(@input)
|
39
|
+
item_options
|
40
|
+
while !exit?
|
41
|
+
if @input == "y"
|
42
|
+
options
|
43
|
+
break
|
44
|
+
elsif @input == "n"
|
45
|
+
WhatToWatch::BestMovies.reset!
|
46
|
+
start
|
47
|
+
else
|
48
|
+
invalid_command
|
49
|
+
end
|
50
|
+
end
|
51
|
+
else
|
52
|
+
invalid_command
|
53
|
+
end
|
54
|
+
end
|
55
|
+
when "2"
|
56
|
+
WhatToWatch::BestTV.add_shows
|
57
|
+
WhatToWatch::BestTV.list(@streaming_services)
|
58
|
+
options
|
59
|
+
while !exit?
|
60
|
+
if valid_number?(WhatToWatch::BestTV.all)
|
61
|
+
WhatToWatch::BestTV.print_item(@input)
|
62
|
+
item_options
|
63
|
+
while !exit?
|
64
|
+
if @input == "y"
|
65
|
+
options
|
66
|
+
break
|
67
|
+
elsif @input == "n"
|
68
|
+
WhatToWatch::BestTV.reset!
|
69
|
+
start
|
70
|
+
else
|
71
|
+
invalid_command
|
72
|
+
end
|
73
|
+
end
|
74
|
+
else
|
75
|
+
invalid_command
|
76
|
+
end
|
77
|
+
end
|
78
|
+
when "3"
|
79
|
+
WhatToWatch::RecentlyAdded.add_shows
|
80
|
+
WhatToWatch::RecentlyAdded.list(@streaming_services)
|
81
|
+
options
|
82
|
+
while !exit?
|
83
|
+
if valid_number?(WhatToWatch::RecentlyAdded.all)
|
84
|
+
WhatToWatch::RecentlyAdded.print_item(@input)
|
85
|
+
item_options
|
86
|
+
while !exit?
|
87
|
+
if @input == "y"
|
88
|
+
options
|
89
|
+
break
|
90
|
+
elsif @input == "n"
|
91
|
+
WhatToWatch::RecentlyAdded.reset!
|
92
|
+
start
|
93
|
+
else
|
94
|
+
invalid_command
|
95
|
+
end
|
96
|
+
end
|
97
|
+
else
|
98
|
+
invalid_command
|
99
|
+
end
|
100
|
+
end
|
101
|
+
else
|
102
|
+
invalid_command
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
exit
|
107
|
+
end
|
108
|
+
|
109
|
+
#CLI Dialogue Methods
|
110
|
+
|
111
|
+
def main_commands
|
112
|
+
puts ""
|
113
|
+
puts "---------"
|
114
|
+
puts "MAIN MENU:"
|
115
|
+
puts "---------"
|
116
|
+
puts "1. Enter 1 to see the Best-Reviewed MOVIES you can stream now."
|
117
|
+
puts "2. Enter 2 to see the Best-Reviewed TELEVISION you can stream now."
|
118
|
+
puts "3. Enter 3 to see Recently-Added MOVIES/TELEVISION you can stream now."
|
119
|
+
puts ""
|
120
|
+
puts "Exit: Type exit"
|
121
|
+
puts "---------------"
|
122
|
+
puts ""
|
123
|
+
@input = gets.strip
|
124
|
+
end
|
125
|
+
|
126
|
+
def options
|
127
|
+
puts ""
|
128
|
+
puts "-------"
|
129
|
+
puts "OPTIONS:"
|
130
|
+
puts "-------"
|
131
|
+
puts "Enter The Number of the Selection to See Details and Information."
|
132
|
+
puts ""
|
133
|
+
puts "Exit: Type exit"
|
134
|
+
puts "---------------"
|
135
|
+
puts ""
|
136
|
+
@input = gets.strip
|
137
|
+
end
|
138
|
+
|
139
|
+
def item_options
|
140
|
+
puts ""
|
141
|
+
puts "-------"
|
142
|
+
puts "OPTIONS"
|
143
|
+
puts "-------"
|
144
|
+
puts "Enter y to Get Info/Details for Another Selection"
|
145
|
+
puts "Enter n to Go Back to MAIN MENU"
|
146
|
+
puts ""
|
147
|
+
puts "Exit: Type exit"
|
148
|
+
puts "---------------"
|
149
|
+
puts ""
|
150
|
+
@input = gets.strip.downcase
|
151
|
+
end
|
152
|
+
|
153
|
+
def invalid_command
|
154
|
+
puts ""
|
155
|
+
puts "I'm sorry, I don't recognize that Command."
|
156
|
+
puts "Please Try Again"
|
157
|
+
puts ""
|
158
|
+
@input = gets.strip.downcase
|
159
|
+
end
|
160
|
+
|
161
|
+
def exit
|
162
|
+
puts ""
|
163
|
+
puts "**********************************************************"
|
164
|
+
puts "See You Next Time for More Great Movie/TV Recommendations!"
|
165
|
+
puts "**********************************************************"
|
166
|
+
end
|
167
|
+
|
168
|
+
def which_streaming_services
|
169
|
+
puts ""
|
170
|
+
puts "Which Streaming Services do You Have Access To?"
|
171
|
+
puts ""
|
172
|
+
puts "Please Enter y or n to Answer each Question:"
|
173
|
+
|
174
|
+
puts "1. Do You have Netflix?"
|
175
|
+
@input = gets.strip.downcase
|
176
|
+
while !exit?
|
177
|
+
if @input == "y"
|
178
|
+
@streaming_services[:netflix] = "y"
|
179
|
+
break
|
180
|
+
elsif @input == "n"
|
181
|
+
@streaming_services[:netflix] = "n"
|
182
|
+
break
|
183
|
+
else
|
184
|
+
invalid_command
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
puts "2. Do You have Amazon Prime?"
|
189
|
+
@input = gets.strip.downcase
|
190
|
+
while !exit?
|
191
|
+
if @input == "y"
|
192
|
+
@streaming_services[:amazon_prime] = "y"
|
193
|
+
break
|
194
|
+
elsif @input == "n"
|
195
|
+
@streaming_services[:amazon_prime] = "n"
|
196
|
+
break
|
197
|
+
else
|
198
|
+
invalid_command
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
puts "3. Do You have HBO?"
|
203
|
+
@input = gets.strip.downcase
|
204
|
+
while !exit?
|
205
|
+
if @input == "y"
|
206
|
+
@streaming_services[:hbo_now] = "y"
|
207
|
+
break
|
208
|
+
elsif @input == "n"
|
209
|
+
@streaming_services[:hbo_now] = "n"
|
210
|
+
break
|
211
|
+
else
|
212
|
+
invalid_command
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
puts "4. Do You have HULU?"
|
217
|
+
@input = gets.strip.downcase
|
218
|
+
while !exit?
|
219
|
+
if @input == "y"
|
220
|
+
@streaming_services[:hulu] = "y"
|
221
|
+
break
|
222
|
+
elsif @input == "n"
|
223
|
+
@streaming_services[:hulu] = "n"
|
224
|
+
break
|
225
|
+
else
|
226
|
+
invalid_command
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
puts "5. Do You have Showtime?"
|
231
|
+
@input = gets.strip.downcase
|
232
|
+
while !exit?
|
233
|
+
if @input == "y"
|
234
|
+
@streaming_services[:showtime] = "y"
|
235
|
+
break
|
236
|
+
elsif @input == "n"
|
237
|
+
@streaming_services[:showtime] = "n"
|
238
|
+
break
|
239
|
+
else
|
240
|
+
invalid_command
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
#CLI Logic Methods
|
246
|
+
|
247
|
+
def exit?
|
248
|
+
@input.downcase == "exit"
|
249
|
+
end
|
250
|
+
|
251
|
+
def valid_number?(array)
|
252
|
+
@input.to_i.between?(1, array.size)
|
253
|
+
end
|
254
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class WhatToWatch::RecentlyAdded < WhatToWatch::Show
|
2
|
+
|
3
|
+
@@all = []
|
4
|
+
|
5
|
+
def self.all
|
6
|
+
@@all
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.reset!
|
10
|
+
@@all = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.rows
|
14
|
+
[1, 2, 3, 4, 5]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.list(hash)
|
18
|
+
puts ""
|
19
|
+
puts "=========================="
|
20
|
+
puts " Recently Added Movies/TV "
|
21
|
+
puts "=========================="
|
22
|
+
puts ""
|
23
|
+
self.print_list(hash)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class WhatToWatch::Scraper
|
2
|
+
|
3
|
+
|
4
|
+
def self.scrape_vulture(model)
|
5
|
+
doc = Nokogiri::HTML(open("http://vulture.com/streaming"))
|
6
|
+
model.rows.each do |row|
|
7
|
+
block = doc.css("div.what-to-watch.row-#{row}")
|
8
|
+
block.css("ul.row li").each do |item|
|
9
|
+
model.new(
|
10
|
+
item.css("a.title").attr("title").text.strip,
|
11
|
+
block.css("h4").text.strip
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
#Scrape Search Page on imdb.com to determine the Item Page URL
|
18
|
+
|
19
|
+
def self.get_item_page(object)
|
20
|
+
search_results_page = Nokogiri::HTML(open("https://www.imdb.com/find?s=tt&q=" +
|
21
|
+
CGI::escape(object.title.gsub("Season ", ""))))
|
22
|
+
|
23
|
+
url = "https://www.imdb.com" +
|
24
|
+
"#{search_results_page.css("td a").attribute("href").value}"
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def self.scrape_imdb(object)
|
29
|
+
object.url = self.get_item_page(object)
|
30
|
+
item_page = Nokogiri::HTML(open(object.url))
|
31
|
+
object.description = item_page.css("div.summary_text").text.strip
|
32
|
+
object.genre_year = item_page.css("div.subtext a").collect{|tag| tag.text.strip.gsub("\u2013","-")}.join(" | ")
|
33
|
+
object.cast = {}
|
34
|
+
item_page.css("div.credit_summary_item").each do |category|
|
35
|
+
object.cast[category.css("h4").text.strip] = category.css("a").collect{|tag|tag.text.strip}.
|
36
|
+
join(", ").gsub(", See full cast & crew", "")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
class WhatToWatch::Show
|
2
|
+
attr_accessor :title, :streaming_service, :url, :description, :genre_year, :cast
|
3
|
+
|
4
|
+
# WhatToWatch::BestMovies.add_shows
|
5
|
+
# WhatToWatch::BestMovies.list()
|
6
|
+
# {netflix: "y", amazon_prime: "n", hbo_now: "y", hulu: "n", showtime: "y"}
|
7
|
+
|
8
|
+
def initialize(title="", streaming_service="")
|
9
|
+
@title = title
|
10
|
+
@streaming_service = streaming_service
|
11
|
+
self.class.all << self
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.add_shows
|
15
|
+
WhatToWatch::Scraper.scrape_vulture(self)
|
16
|
+
end
|
17
|
+
|
18
|
+
#Determine Display Based On User Input Recorded in CLI.streaming_services
|
19
|
+
|
20
|
+
def self.services(hash)
|
21
|
+
services = hash.collect do |service, value|
|
22
|
+
if value == "y"
|
23
|
+
service.to_s.split('_').map(&:capitalize).join(' ')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
services.compact!
|
27
|
+
if services.include?("Hbo Now")
|
28
|
+
services << "HBO Now"
|
29
|
+
end
|
30
|
+
services
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def self.print_list(hash)
|
35
|
+
self.all.each.with_index(1) do |object, index|
|
36
|
+
if self.services(hash).include?(object.streaming_service)
|
37
|
+
puts ""
|
38
|
+
puts "Available! #{index}. #{object.title.upcase}. Watch Now on #{object.streaming_service}."
|
39
|
+
puts ""
|
40
|
+
else
|
41
|
+
puts ""
|
42
|
+
puts "Sorry..... #{index}. #{object.title.upcase}. Only on #{object.streaming_service}."
|
43
|
+
puts ""
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
def self.print_item(input)
|
50
|
+
object = self.all[input.to_i-1]
|
51
|
+
WhatToWatch::Scraper.scrape_imdb(object)
|
52
|
+
puts ""
|
53
|
+
puts "===================================="
|
54
|
+
puts " #{object.title.upcase}"
|
55
|
+
puts "===================================="
|
56
|
+
puts "#{object.genre_year}"
|
57
|
+
puts ""
|
58
|
+
puts "*** Available on #{object.streaming_service} ***"
|
59
|
+
puts ""
|
60
|
+
object.cast.each{|role, people| puts "#{role} #{people}"}
|
61
|
+
puts ""
|
62
|
+
puts "---Description---"
|
63
|
+
puts ""
|
64
|
+
puts "#{object.description}"
|
65
|
+
puts "[...]"
|
66
|
+
puts ""
|
67
|
+
puts "For more information"
|
68
|
+
puts ""
|
69
|
+
puts "===> #{object.url}"
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "open-uri"
|
2
|
+
require "nokogiri"
|
3
|
+
require "cgi"
|
4
|
+
require "pry"
|
5
|
+
|
6
|
+
|
7
|
+
# File Dependencies.
|
8
|
+
#Load version.rb first
|
9
|
+
#to define Module WhatToWatch.
|
10
|
+
|
11
|
+
require "what_to_watch/version"
|
12
|
+
require "what_to_watch/cli"
|
13
|
+
require "what_to_watch/scraper"
|
14
|
+
require "what_to_watch/show"
|
15
|
+
require "what_to_watch/best_movies"
|
16
|
+
require "what_to_watch/best_tv"
|
17
|
+
require "what_to_watch/recently_added"
|
18
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "what_to_watch/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "what_to_watch"
|
8
|
+
spec.version = WhatToWatch::VERSION
|
9
|
+
spec.authors = ["'George Pianka'"]
|
10
|
+
spec.email = ["'gpianka1@gmail.com'"]
|
11
|
+
|
12
|
+
spec.summary = "Best Reviewed and Recently Added Movies/Television Based on User's Streaming Subscriptions"
|
13
|
+
spec.description = <<-DESCRIPTION
|
14
|
+
Provides Current Recommendations and Reviews from Vulture.com
|
15
|
+
for Best Reviewed and Recently Added Movies/Television
|
16
|
+
Depending on the Streaming Services a User Indicates
|
17
|
+
They have Access to.
|
18
|
+
DESCRIPTION
|
19
|
+
spec.homepage = "https://github.com/NotoriousCottonball/what_to_watch"
|
20
|
+
spec.license = "MIT"
|
21
|
+
|
22
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
23
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
24
|
+
if spec.respond_to?(:metadata)
|
25
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
26
|
+
else
|
27
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
28
|
+
"public gem pushes."
|
29
|
+
end
|
30
|
+
|
31
|
+
# Specify which files should be added to the gem when it is released.
|
32
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
33
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
34
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
35
|
+
end
|
36
|
+
spec.bindir = "bin"
|
37
|
+
spec.executables = ["what_to_watch"]
|
38
|
+
spec.require_paths = ["lib"]
|
39
|
+
|
40
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
41
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
42
|
+
spec.add_development_dependency "pry"
|
43
|
+
|
44
|
+
spec.add_runtime_dependency "nokogiri"
|
45
|
+
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: what_to_watch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "'George Pianka'"
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-09-08 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.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
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: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '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: " Provides Current Recommendations and Reviews from Vulture.com \n for
|
70
|
+
Best Reviewed and Recently Added Movies/Television\n Depending on the Streaming
|
71
|
+
Services a User Indicates \n They have Access to.\n"
|
72
|
+
email:
|
73
|
+
- "'gpianka1@gmail.com'"
|
74
|
+
executables:
|
75
|
+
- what_to_watch
|
76
|
+
extensions: []
|
77
|
+
extra_rdoc_files: []
|
78
|
+
files:
|
79
|
+
- ".DS_Store"
|
80
|
+
- ".gitignore"
|
81
|
+
- CODE_OF_CONDUCT.md
|
82
|
+
- Gemfile
|
83
|
+
- Gemfile.lock
|
84
|
+
- LICENSE.txt
|
85
|
+
- README.md
|
86
|
+
- Rakefile
|
87
|
+
- bin/console
|
88
|
+
- bin/setup
|
89
|
+
- bin/what_to_watch
|
90
|
+
- lib/.DS_Store
|
91
|
+
- lib/what_to_watch.rb
|
92
|
+
- lib/what_to_watch/best_movies.rb
|
93
|
+
- lib/what_to_watch/best_tv.rb
|
94
|
+
- lib/what_to_watch/cli.rb
|
95
|
+
- lib/what_to_watch/recently_added.rb
|
96
|
+
- lib/what_to_watch/scraper.rb
|
97
|
+
- lib/what_to_watch/show.rb
|
98
|
+
- lib/what_to_watch/version.rb
|
99
|
+
- what_to_watch.gemspec
|
100
|
+
homepage: https://github.com/NotoriousCottonball/what_to_watch
|
101
|
+
licenses:
|
102
|
+
- MIT
|
103
|
+
metadata:
|
104
|
+
allowed_push_host: https://rubygems.org
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.7.7
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Best Reviewed and Recently Added Movies/Television Based on User's Streaming
|
125
|
+
Subscriptions
|
126
|
+
test_files: []
|