movieDB 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/README.md +21 -5
- data/lib/movieDB.rb +76 -45
- data/lib/movieDB/.DS_Store +0 -0
- data/lib/movieDB/base.rb +2 -0
- data/lib/movieDB/data_analysis.rb +10 -2
- data/lib/movieDB/data_export.rb +141 -0
- data/lib/movieDB/version.rb +1 -1
- data/npm-debug.log +0 -0
- data/spec/data_analysis_spec.rb +5 -1
- data/spec/data_export_spec.rb +17 -0
- data/spec/movieDB_spec.rb +19 -45
- data/spec/spec_helper.rb +1 -0
- metadata +32 -46
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3efb92c595bb3d14436ac5d595e9d378ca83eb5e
|
4
|
+
data.tar.gz: 216c9621dcc376e6114c813541c24c6d65ed2721
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3fcd5d8b26beed7ffa085a2b4c971f3e088611736a9b76564a76c764e4f7ea9a7777a4309fc8b0088a1dde749f541d3db3b855cbb6d134d88c8179aa52983ab9
|
7
|
+
data.tar.gz: dfa8c5c43d868f2eb31d7451f6c16389c29c89151126f4654869aa9103b9350f5a9fc08a4874e9a011f6be6474a1721aef7408e2b195f3526b61bd79ce00df2b
|
data/.DS_Store
ADDED
Binary file
|
data/README.md
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
## Description
|
4
4
|
|
5
|
-
Although the name
|
6
|
-
The objective is to help movie/film producers make decisions based on archival data.
|
5
|
+
Although the name suggests a datastore gem, MovieDB is actually a ruby wrapper that inspects, cleans, transform and model imdb data and provides useful data analysis information, suggesting conclusion. The objective is provide a tool that will help movie/film producers make decisions based on archival imdb data.
|
7
6
|
|
8
7
|
Basic functions and Data Analysis:
|
9
8
|
* Data Analysis
|
@@ -12,7 +11,7 @@ Basic functions and Data Analysis:
|
|
12
11
|
|
13
12
|
## Requirements
|
14
13
|
|
15
|
-
|
14
|
+
ruby 1.9.x
|
16
15
|
|
17
16
|
## Installation
|
18
17
|
|
@@ -28,6 +27,23 @@ Or install it yourself as:
|
|
28
27
|
|
29
28
|
$ gem install movieDB
|
30
29
|
|
31
|
-
## Usage
|
30
|
+
## Usage - Collecting Movie Data From IMDb
|
31
|
+
|
32
|
+
$ irb
|
33
|
+
|
34
|
+
> require 'movieDB'
|
35
|
+
|
36
|
+
> MovieDB::Movie.send(:get_multiple_imdb_movie_data, "2024544", "1800241", "0791314")
|
37
|
+
|
38
|
+
> MovieDB::DataExport.export_movie_data
|
39
|
+
|
40
|
+
## Exported Document
|
41
|
+
|
42
|
+
The excel document is stored in the reports directory.
|
43
|
+
|
44
|
+
$ cd /reports/data_analysis_20131203.xls
|
45
|
+
|
46
|
+
## Usage - Data Analysis
|
47
|
+
|
48
|
+
$ wip
|
32
49
|
|
33
|
-
work-in-progress
|
data/lib/movieDB.rb
CHANGED
@@ -96,7 +96,7 @@ unless defined? MovieDB::Movie
|
|
96
96
|
DEFAULT_WORLDWIDE_GROSS = "$124.6M" # Not provided by imdb api.
|
97
97
|
|
98
98
|
def initialize(attributes = {})
|
99
|
-
movie_attr = %w(title cast_members cast_characters cast_member_ids cast_members_characters
|
99
|
+
$IMDB_ATTRIBUTES_HEADERS = movie_attr = %w(title cast_members cast_characters cast_member_ids cast_members_characters
|
100
100
|
trailer_url director writer filming_locations company genres languages countries
|
101
101
|
length plot poster rating votes mpaa_rating tagline year release_date unique_id
|
102
102
|
academy_award_nomination academy_award_wins golden_globe_nominations golden_globe_wins
|
@@ -125,7 +125,9 @@ unless defined? MovieDB::Movie
|
|
125
125
|
class << self
|
126
126
|
|
127
127
|
##
|
128
|
-
# Get the data from imdb
|
128
|
+
# Get the single data from imdb
|
129
|
+
#
|
130
|
+
# TODO: This method should be deprecated in the next version release.
|
129
131
|
|
130
132
|
def get_imdb_movie_data(value)
|
131
133
|
puts zimdb_value = "tt" << value.to_s
|
@@ -139,47 +141,68 @@ unless defined? MovieDB::Movie
|
|
139
141
|
@movie_search = Imdb::Movie.search(name.to_s)
|
140
142
|
end
|
141
143
|
|
142
|
-
def
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
144
|
+
def global_movie_data_store
|
145
|
+
return $GLOBAL_MOVIE_DS
|
146
|
+
end
|
147
|
+
|
148
|
+
|
149
|
+
##
|
150
|
+
# You can add multiple Imdb ids
|
151
|
+
#
|
152
|
+
# USAGE # MovieDB::Movie.send(:get_multiple_imdb_movie_data, "2024544", "1800241")
|
153
|
+
# #
|
154
|
+
# # Example: You can collect the arrays of the title attributes
|
155
|
+
# #
|
156
|
+
# # MovieDB::Movie.instance_eval{filter_movie_attr("title")}
|
157
|
+
|
158
|
+
def get_multiple_imdb_movie_data(*args)
|
159
|
+
begin
|
160
|
+
args.each do |value|
|
161
|
+
get_imdb_movie_data(value)
|
162
|
+
@movie_DS ||=[]
|
163
|
+
movie_info = Movie.new
|
164
|
+
movie_info.title = Array.new << @movie_data.title
|
165
|
+
movie_info.cast_members = @movie_data.cast_members.flatten
|
166
|
+
movie_info.cast_characters = @movie_data.cast_characters
|
167
|
+
movie_info.cast_member_ids = @movie_data.cast_member_ids
|
168
|
+
movie_info.cast_members_characters = @movie_data.cast_members_characters
|
169
|
+
movie_info.trailer_url = @movie_data.trailer_url.nil? ? 'No Trailer' : @movie_data.trailer_url
|
170
|
+
movie_info.director = @movie_data.director.flatten
|
171
|
+
movie_info.writer = Array.new << @zimdb_data.writer
|
172
|
+
movie_info.filming_locations = @movie_data.filming_locations.flatten.join(', ')
|
173
|
+
movie_info.company = Array.new << @movie_data.company
|
174
|
+
movie_info.genres = @movie_data.genres.flatten.join(' ').sub(' ' , ', ')
|
175
|
+
movie_info.languages = Array.new << @movie_data.languages.flatten.join(' ').sub(' ' , ', ')
|
176
|
+
movie_info.countries = Array.new << @movie_data.countries.flatten.join(' ').sub(' ' , ', ')
|
177
|
+
movie_info.length = Array.new << @movie_data.length
|
178
|
+
movie_info.plot = Array.new << @movie_data.plot
|
179
|
+
movie_info.poster = Array.new << @movie_data.poster
|
180
|
+
movie_info.rating = Array.new << @movie_data.rating
|
181
|
+
movie_info.votes = Array.new << @movie_data.votes
|
182
|
+
movie_info.mpaa_rating = Array.new << @movie_data.mpaa_rating == [nil] ? ["No Ratings"] : [@movie_data.mpaa_rating]
|
183
|
+
movie_info.tagline = Array.new << @movie_data.tagline
|
184
|
+
movie_info.year = Array.new << @movie_data.year
|
185
|
+
movie_info.release_date = Array.new << @movie_data.release_date
|
186
|
+
movie_info.unique_id = @unique_id
|
187
|
+
|
188
|
+
##
|
189
|
+
# TODO: Write API to request data from AMPAS.
|
190
|
+
|
191
|
+
#movie_info.academy_award_nomination = academy_award_nomination
|
192
|
+
#movie_info.academy_award_wins = academy_award_wins
|
193
|
+
#movie_info.golden_globe_nominations = golden_globe_nominations
|
194
|
+
#movie_info.golden_globe_wins = golden_globe_wins
|
195
|
+
#movie_info.bafta_nomination = bafta_nomination
|
196
|
+
#movie_info.bafta_wins = bafta_wins
|
197
|
+
#movie_info.worldwide_gross = worldwide_gross
|
198
|
+
$GLOBAL_MOVIE_DS = @movie_DS << movie_info
|
199
|
+
end
|
200
|
+
rescue
|
201
|
+
raise ArgumentError, 'invalid imbd id'
|
202
|
+
end
|
203
|
+
|
204
|
+
return @movie_DS
|
169
205
|
|
170
|
-
##
|
171
|
-
# TODO: Write API for the AMPAS.
|
172
|
-
|
173
|
-
#movie_info.academy_award_nomination = academy_award_nomination
|
174
|
-
#movie_info.academy_award_wins = academy_award_wins
|
175
|
-
#movie_info.golden_globe_nominations = golden_globe_nominations
|
176
|
-
#movie_info.golden_globe_wins = golden_globe_wins
|
177
|
-
#movie_info.bafta_nomination = bafta_nomination
|
178
|
-
#movie_info.bafta_wins = bafta_wins
|
179
|
-
#movie_info.worldwide_gross = worldwide_gross
|
180
|
-
@movie_DS << movie_info
|
181
|
-
return @movieDS
|
182
|
-
|
183
206
|
##
|
184
207
|
#TODO: Include this for later data analysis computation
|
185
208
|
|
@@ -191,6 +214,14 @@ unless defined? MovieDB::Movie
|
|
191
214
|
|
192
215
|
end
|
193
216
|
|
217
|
+
# Empty the data store
|
218
|
+
# Reset to nil
|
219
|
+
|
220
|
+
def clear_data_store
|
221
|
+
@movie_DS = []
|
222
|
+
return @movie_DS
|
223
|
+
end
|
224
|
+
|
194
225
|
##
|
195
226
|
# Filter the data store for the movie attributes. Return an array of the attributes.
|
196
227
|
#
|
@@ -202,11 +233,11 @@ unless defined? MovieDB::Movie
|
|
202
233
|
attr_sym = attr.to_sym
|
203
234
|
|
204
235
|
raise ArgumentError, "#{attr_sym} is not a valid attribute." if !attr_sym == :director && :cast_members
|
205
|
-
filtered = @movie_DS.select{|ds| ds.attr_title?}.map(&attr_sym)
|
206
|
-
attr_raw == 'title' ? filtered : filtered
|
236
|
+
filtered = @movie_DS.select{|ds| ds.attr_title?}.map(&attr_sym)#.flatten
|
237
|
+
attr_raw == ('languages' && 'title') ? filtered : filtered#.uniq
|
207
238
|
end
|
208
239
|
end
|
209
|
-
private_class_method :
|
240
|
+
private_class_method :get_multiple_imdb_movie_data, :filter_movie_attr, :get_imdb_movie_data
|
210
241
|
|
211
242
|
def attr_title
|
212
243
|
!@title.nil?
|
Binary file
|
data/lib/movieDB/base.rb
CHANGED
@@ -6,9 +6,11 @@ module MovieDB #:nodoc
|
|
6
6
|
# MoviesDB v0.1.x is not a datastore gem. Rather is performs mathematical computations for analyzing film data from imdb. can manage the data store of pre-production, production and final film releases.
|
7
7
|
# Its a solution to the common problem of building a multi-database that utilizes both SQL and NoSQL
|
8
8
|
# combined features to increase speed and performance for reading records.
|
9
|
+
|
9
10
|
class Base
|
10
11
|
include StatusChecker
|
11
12
|
include MovieError
|
12
13
|
end
|
14
|
+
|
13
15
|
end
|
14
16
|
$:.unshift File.expand_path('..', __FILE__)
|
@@ -1,12 +1,20 @@
|
|
1
|
+
require 'MovieDB'
|
2
|
+
|
1
3
|
module MovieDB
|
2
4
|
|
3
5
|
##
|
4
6
|
# Analysing, inspecting, cleaning, transforming and modeling data.
|
5
7
|
|
6
|
-
class DataAnalysis
|
8
|
+
class DataAnalysis < MovieDB::Movie
|
7
9
|
module AnalysisOfVariance
|
8
10
|
module LeastSquares
|
9
|
-
module Coefficient_Of_Determination
|
11
|
+
module Coefficient_Of_Determination
|
12
|
+
def cod
|
13
|
+
@headers = %w(title x_value y_value)
|
14
|
+
#return @headers
|
15
|
+
#'my coefficiency'
|
16
|
+
end
|
17
|
+
end
|
10
18
|
module Discrete_Least_Squares_Meshless_Method; end
|
11
19
|
module Explained_Sum_Of_Squares; end
|
12
20
|
module Fraction_Of_Variance_Unexplained; end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require "spreadsheet"
|
2
|
+
require "MovieDB/data_analysis"
|
3
|
+
require "MovieDB"
|
4
|
+
|
5
|
+
# This module will write xls document to file
|
6
|
+
#
|
7
|
+
# Usage @book = Spreadsheet::Workbook.new
|
8
|
+
|
9
|
+
module MovieDB
|
10
|
+
class DataExport < MovieDB::Movie
|
11
|
+
PATH_AOV = MovieDB::DataAnalysis::AnalysisOfVariance::LeastSquares
|
12
|
+
include PATH_AOV::Coefficient_Of_Determination
|
13
|
+
include PATH_AOV::Explained_Sum_Of_Squares
|
14
|
+
include PATH_AOV::Fraction_Of_Variance_Unexplained
|
15
|
+
include PATH_AOV::Gauss_Newton_Algorithm
|
16
|
+
include PATH_AOV::Iteratively_Reweighted_Least_Squares
|
17
|
+
include PATH_AOV::Lack_Of_Fit_Sum_Of_Squares
|
18
|
+
include PATH_AOV::Least_Squares_Support_Vector_Machine
|
19
|
+
include PATH_AOV::Mean_Squared_Error
|
20
|
+
include PATH_AOV::Moving_Least_Squares
|
21
|
+
include PATH_AOV::Non_Linear_Iterative_Partial_Least_Squares
|
22
|
+
include PATH_AOV::Non_Linear_Least_Squares
|
23
|
+
include PATH_AOV::Ordinary_Least_Squares
|
24
|
+
include PATH_AOV::Partial_Least_Squares_Regression
|
25
|
+
include PATH_AOV::Partition_Of_Sums_Of_Squares
|
26
|
+
include PATH_AOV::Residual_Sum_Of_Squares
|
27
|
+
include PATH_AOV::Total_Least_Squares
|
28
|
+
include PATH_AOV::Total_Sum_Of_Squares
|
29
|
+
|
30
|
+
class << self
|
31
|
+
#TODO: Check the data analysis type and input inot generate method as an attribute
|
32
|
+
|
33
|
+
def export_movie_data
|
34
|
+
create_spreadsheet_file
|
35
|
+
create_spreadsheet_report
|
36
|
+
write_xls_file
|
37
|
+
end
|
38
|
+
|
39
|
+
def create_spreadsheet_file
|
40
|
+
directory_name = ('reports')
|
41
|
+
create_directory(directory_name)
|
42
|
+
Spreadsheet.client_encoding = 'UTF-8'
|
43
|
+
@book = Spreadsheet::Workbook.new
|
44
|
+
@sheet = @book.create_worksheet name: "Data Analysis: #{$DATA_ANALYSIS_NAME}" # the analysis nameshould be an input
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_directory(directory_name)
|
49
|
+
Dir.mkdir(directory_name) unless File.exists? directory_name
|
50
|
+
end
|
51
|
+
|
52
|
+
def create_spreadsheet_report
|
53
|
+
create_spreadsheet_header
|
54
|
+
create_spreadsheet_body
|
55
|
+
end
|
56
|
+
|
57
|
+
def create_spreadsheet_header
|
58
|
+
@sheet.row(0).concat $IMDB_ATTRIBUTES_HEADERS
|
59
|
+
|
60
|
+
format = Spreadsheet::Format.new :color => :blue,
|
61
|
+
:weight => :bold,
|
62
|
+
:size => 18
|
63
|
+
@sheet.row(0).default_format = format
|
64
|
+
end
|
65
|
+
|
66
|
+
# Loop through array of and array imbd data. Each row has the
|
67
|
+
# the information about the film/movie
|
68
|
+
# The Data is obtained from MovieDB::Movie
|
69
|
+
# example
|
70
|
+
# catching fire |
|
71
|
+
def create_spreadsheet_body
|
72
|
+
$IMDB_ATTRIBUTES_HEADERS.each do |header|
|
73
|
+
case header
|
74
|
+
when 'title' then spreadsheet_body_text_data("title")
|
75
|
+
when 'cast_members' then spreadsheet_body_count_data("cast_members")
|
76
|
+
when 'cast_characters' then spreadsheet_body_count_data("cast_characters")
|
77
|
+
when 'cast_member_ids' then spreadsheet_body_count_data("cast_member_ids")
|
78
|
+
when 'cast_members_characters' then spreadsheet_body_count_data("cast_members_characters")
|
79
|
+
when 'trailer_url' then spreadsheet_body_text_data("trailer_url")
|
80
|
+
when 'director' then spreadsheet_body_text_data("director")
|
81
|
+
when 'writer' then spreadsheet_body_text_data("writer")
|
82
|
+
when 'filming_locations' then spreadsheet_body_text_data("filming_locations")
|
83
|
+
when 'company' then spreadsheet_body_text_data("company")
|
84
|
+
when 'genres' then spreadsheet_body_text_data("genres")
|
85
|
+
when 'languages' then spreadsheet_body_text_data("languages")
|
86
|
+
when 'countries' then spreadsheet_body_text_data("countries")
|
87
|
+
when 'length' then spreadsheet_body_numeric_data("length")
|
88
|
+
when 'plot' then spreadsheet_body_text_data("plot")
|
89
|
+
when 'poster' then spreadsheet_body_text_data("poster")
|
90
|
+
when 'rating' then spreadsheet_body_numeric_data("rating")
|
91
|
+
when 'votes' then spreadsheet_body_numeric_data("votes")
|
92
|
+
when 'mpaa_rating' then spreadsheet_body_numeric_data("mpaa_rating")
|
93
|
+
when 'year' then spreadsheet_body_numeric_data("year")
|
94
|
+
when 'release_date' then spreadsheet_body_numeric_data("release_date")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def spreadsheet_body_text_data(header_title)
|
100
|
+
@e_t = element_title = MovieDB::Movie.instance_eval{filter_movie_attr(header_title)}.flatten
|
101
|
+
|
102
|
+
element_title.each_with_index do |element2,i|
|
103
|
+
element_array = element_title[(i)].split(' ',)
|
104
|
+
@sheet.row(1 + i).concat element_array
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def spreadsheet_body_count_data(header_title)
|
109
|
+
element_cast = MovieDB::Movie.instance_eval{filter_movie_attr(header_title)}
|
110
|
+
|
111
|
+
0.upto(@e_t.length - 1) do |i|
|
112
|
+
element_array = []
|
113
|
+
|
114
|
+
element_array << element_cast[i].length
|
115
|
+
@sheet.row(1 + i).concat element_array
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def spreadsheet_body_numeric_data(header_title)
|
120
|
+
@e_t = element_title = MovieDB::Movie.instance_eval{filter_movie_attr(header_title)}
|
121
|
+
|
122
|
+
element_title.each_with_index do |element2,i|
|
123
|
+
element_array = element_title[(i)]
|
124
|
+
@sheet.row(1 + i).concat element_array
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def report_name
|
129
|
+
name = "imdb_raw_data_".to_s.downcase
|
130
|
+
name << "#{Time.now.to_s.gsub(':', '').gsub('-', '').gsub(' ', '').split('')[0..9].join}"
|
131
|
+
end
|
132
|
+
|
133
|
+
def write_xls_file
|
134
|
+
filename = ("#{report_name}.xls")
|
135
|
+
@book.write File.join('reports', filename)
|
136
|
+
return filename
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
data/lib/movieDB/version.rb
CHANGED
data/npm-debug.log
ADDED
File without changes
|
data/spec/data_analysis_spec.rb
CHANGED
@@ -5,7 +5,11 @@ describe MovieDB::DataAnalysis do
|
|
5
5
|
describe "#AnalysisOfVariance" do
|
6
6
|
describe "#LeastSquares" do
|
7
7
|
describe "#Coefficient_Of_Determination" do
|
8
|
-
|
8
|
+
let(:cof) {MovieDB::DataAnalysis::AnalysisOfVariance::LeastSquares::Coefficient_Of_Determination.cod}
|
9
|
+
|
10
|
+
it "should return the cof" do
|
11
|
+
cof.send(:cod).should == []
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
describe "#Discrete_Least_Squares_Meshless_Method" do
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MovieDB::DataExport do
|
4
|
+
|
5
|
+
describe "#export_movie_data" do
|
6
|
+
MovieDB::Movie.send(:clear_data_store)
|
7
|
+
MovieDB::Movie.send(:get_multiple_imdb_movie_data, "2024544", "1800241", "0791314")
|
8
|
+
MovieDB::DataExport.export_movie_data
|
9
|
+
|
10
|
+
let(:file_name) {MovieDB::DataExport.write_xls_file}
|
11
|
+
|
12
|
+
it 'writes the exported data as an xls file to the reports directory' do
|
13
|
+
File.exist?(File.join('reports', file_name)).should == true
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
data/spec/movieDB_spec.rb
CHANGED
@@ -6,57 +6,31 @@ require "zimdb"
|
|
6
6
|
describe MovieDB do
|
7
7
|
|
8
8
|
describe "#get_imdb_movie_data" do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
movie_info.cast_member_ids[0, 4].should == ["nm2225369", "nm2955013", "nm4425051", "nm1193262"]
|
16
|
-
movie_info.cast_characters[0, 4].should == ["Katniss Everdeen", "Gale Hawthorne", "Marvel", "Ripper"]
|
17
|
-
movie_info.cast_members_characters[0, 4].should == ["Jennifer Lawrence => Katniss Everdeen", "Liam Hemsworth => Gale Hawthorne", "Jack Quaid => Marvel", "Taylor St. Clair => Ripper"]
|
18
|
-
movie_info.trailer_url.should == "http://imdb.com/video/screenplay/vi365471769/"
|
19
|
-
movie_info.director.should == ["Francis Lawrence"]
|
20
|
-
#movie_info.writer.should == "Simon Beaufoy, Michael Arndt"
|
21
|
-
movie_info.filming_locations[0, 2].should == ["Oakland, New Jersey, USA", "O'ahu, Hawaii, USA"]
|
22
|
-
movie_info.company.should == "Color Force"
|
23
|
-
movie_info.genres.should == ["Action", "Adventure", "Sci-Fi", "Thriller"]
|
24
|
-
movie_info.languages.should == ["English"]
|
25
|
-
movie_info.countries.should == ["USA"]
|
26
|
-
movie_info.length.should == 146
|
27
|
-
movie_info.plot.should == "Katniss Everdeen and Peeta Mellark become targets of the Capitol after their victory in the 74th Hunger Games sparks a rebellion in the Districts of Panem."
|
28
|
-
movie_info.poster.should == "http://ia.media-imdb.com/images/M/MV5BMTAyMjQ3OTAxMzNeQTJeQWpwZ15BbWU4MDU0NzA1MzAx.jpg"
|
29
|
-
movie_info.rating.should == 8.2
|
30
|
-
movie_info.votes.should == 110636
|
31
|
-
movie_info.mpaa_rating.should == "Rated PG-13 for intense sequences of violence and action, some frightening images, thematic elements, a suggestive situation and language"
|
32
|
-
movie_info.tagline.should == "Every revolution begins with a spark. »"
|
33
|
-
movie_info.year.should == 2013
|
34
|
-
movie_info.release_date.should == "22 November 2013 (USA)"
|
35
|
-
end
|
36
|
-
end
|
9
|
+
|
10
|
+
context "Get multiple movie data from IMDb" do
|
11
|
+
#
|
12
|
+
MovieDB::Movie.send(:clear_data_store)
|
13
|
+
MovieDB::Movie.send(:get_multiple_imdb_movie_data, "2024544", "1800241", "0791314")
|
14
|
+
MovieDB::DataExport.export_movie_data
|
37
15
|
|
38
|
-
it "allows you to update attributes" do
|
39
|
-
movie_info.title = "Rails 4 Games: Turbolinks Reloaded!"
|
40
|
-
movie_info.title.should == "Rails 4 Games: Turbolinks Reloaded!"
|
41
|
-
end
|
42
|
-
end
|
43
16
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
movie_DS = MovieDB::Movie.instance_eval{create_movie_info("1800241")}
|
48
|
-
end
|
17
|
+
it "Should return titles of movies" do
|
18
|
+
MovieDB::Movie.instance_eval{filter_movie_attr("title")}.should == [["12 Years a Slave"], ["American Hustle"], ["Keeper of the Necklace"]]
|
19
|
+
end
|
49
20
|
|
50
|
-
|
51
|
-
|
21
|
+
it "Should return directors movies" do
|
22
|
+
MovieDB::Movie.instance_eval{filter_movie_attr("director")}.should == [["Steve McQueen"], ["David O. Russell"], ["Albert McKeever"]]
|
23
|
+
end
|
52
24
|
end
|
25
|
+
end
|
53
26
|
|
54
|
-
|
55
|
-
MovieDB::Movie.instance_eval{filter_movie_attr("director")}.should == ["Steve McQueen", "David O. Russell"]
|
56
|
-
end
|
27
|
+
describe "validation" do
|
57
28
|
|
58
|
-
|
59
|
-
|
29
|
+
context "invalid id number" do
|
30
|
+
|
31
|
+
it "should raise an error" do
|
32
|
+
expect {MovieDB::Movie.send(:get_multiple_imdb_movie_data, "9024544")}.to raise_error('invalid imbd id')
|
33
|
+
end
|
60
34
|
end
|
61
35
|
end
|
62
36
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,158 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: movieDB
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Albert_McKeever
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: imdb
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: zimdb
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: highline
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ">="
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - ">="
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: fakeweb
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - ">="
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: activesupport
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - ">="
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: 4.0.0
|
134
118
|
type: :runtime
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - ">="
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: 4.0.0
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: spreadsheet
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
|
-
- -
|
129
|
+
- - ">="
|
148
130
|
- !ruby/object:Gem::Version
|
149
131
|
version: '0'
|
150
132
|
type: :runtime
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
|
-
- -
|
136
|
+
- - ">="
|
156
137
|
- !ruby/object:Gem::Version
|
157
138
|
version: '0'
|
158
139
|
description: Perform Data Analysis on IMDB Movies
|
@@ -162,14 +143,17 @@ executables: []
|
|
162
143
|
extensions: []
|
163
144
|
extra_rdoc_files: []
|
164
145
|
files:
|
165
|
-
- .
|
146
|
+
- ".DS_Store"
|
147
|
+
- ".gitignore"
|
166
148
|
- Gemfile
|
167
149
|
- LICENSE.txt
|
168
150
|
- README.md
|
169
151
|
- Rakefile
|
170
152
|
- lib/movieDB.rb
|
153
|
+
- lib/movieDB/.DS_Store
|
171
154
|
- lib/movieDB/base.rb
|
172
155
|
- lib/movieDB/data_analysis.rb
|
156
|
+
- lib/movieDB/data_export.rb
|
173
157
|
- lib/movieDB/genre_parser.rb
|
174
158
|
- lib/movieDB/genres/en.txt
|
175
159
|
- lib/movieDB/movie_error.rb
|
@@ -177,39 +161,41 @@ files:
|
|
177
161
|
- lib/movieDB/status_checker.rb
|
178
162
|
- lib/movieDB/version.rb
|
179
163
|
- movieDB.gemspec
|
164
|
+
- npm-debug.log
|
180
165
|
- spec/.DS_Store
|
181
166
|
- spec/data_analysis_spec.rb
|
167
|
+
- spec/data_export_spec.rb
|
182
168
|
- spec/movieDB_spec.rb
|
183
169
|
- spec/person_spec.rb
|
184
170
|
- spec/spec_helper.rb
|
185
171
|
homepage: https://github.com/keeperofthenecklace/movieDB
|
186
172
|
licenses:
|
187
173
|
- MIT
|
174
|
+
metadata: {}
|
188
175
|
post_install_message:
|
189
176
|
rdoc_options: []
|
190
177
|
require_paths:
|
191
178
|
- lib
|
192
179
|
required_ruby_version: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
180
|
requirements:
|
195
|
-
- -
|
181
|
+
- - ">="
|
196
182
|
- !ruby/object:Gem::Version
|
197
183
|
version: '0'
|
198
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
|
-
none: false
|
200
185
|
requirements:
|
201
|
-
- -
|
186
|
+
- - ">="
|
202
187
|
- !ruby/object:Gem::Version
|
203
188
|
version: '0'
|
204
189
|
requirements: []
|
205
190
|
rubyforge_project:
|
206
|
-
rubygems_version: 1.
|
191
|
+
rubygems_version: 2.1.11
|
207
192
|
signing_key:
|
208
|
-
specification_version:
|
193
|
+
specification_version: 4
|
209
194
|
summary: Movie/Film Statistic and Data Analysis
|
210
195
|
test_files:
|
211
196
|
- spec/.DS_Store
|
212
197
|
- spec/data_analysis_spec.rb
|
198
|
+
- spec/data_export_spec.rb
|
213
199
|
- spec/movieDB_spec.rb
|
214
200
|
- spec/person_spec.rb
|
215
201
|
- spec/spec_helper.rb
|