movieDB 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.travis.yml +13 -22
- data/Changelog.md +33 -0
- data/README.md +22 -13
- data/Rakefile +7 -0
- data/lib/movieDB.rb +45 -30
- data/lib/movieDB/data_analysis.rb +2 -1
- data/lib/movieDB/version.rb +1 -1
- data/movieDB.gemspec +2 -5
- data/test/unit/test_movie_db.rb +100 -0
- metadata +9 -59
- data/lib/movieDB/genre_parser.rb +0 -15
- data/lib/movieDB/genres/en.txt +0 -28
- data/lib/movieDB/person.rb +0 -134
- data/spec/.DS_Store +0 -0
- data/spec/data_export_spec.rb +0 -15
- data/spec/data_process_spec.rb +0 -17
- data/spec/person_spec.rb +0 -23
- data/spec/spec_helper.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68334b883ec9779ff8af09572abf86e198bf961d
|
4
|
+
data.tar.gz: e9d628939efba68b613bd5691110e0874687a778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91331899578db5d4d806665a4bcd8b241a6c9b28b04bfcc0c0b3f5c26677118bdb2e41c7bfc5eb227fba2f821c8521c006f8e01d0a694e155e4a54dce74ab354
|
7
|
+
data.tar.gz: b3bde0df28b95fab130d24e7196c61bf01b7314430a5cb3542f3bc07ba4d16d747ceea412a61876d080a5cbdddda4114c5b54208c8a2f7615812e2ee489b9ce2
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,30 +1,21 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.2.2
|
4
|
+
env:
|
5
|
+
- TEST_SUITE = units
|
1
6
|
before_script:
|
2
|
-
|
3
|
-
#- export DISPLAY=99:0
|
7
|
+
- rm -rf reports/*.8
|
4
8
|
bundler_args: --without development production --quiet
|
5
|
-
env:
|
6
|
-
#- GEM DB=sqlite
|
7
|
-
#- GEM DB=mysql
|
8
|
-
#- GEM DB=postgres
|
9
9
|
before_install:
|
10
|
-
|
11
|
-
script:
|
12
|
-
|
10
|
+
- cd $GEM; export BUNDLE_GEMFILE="`pwd`/Gemfile"
|
11
|
+
script:
|
12
|
+
- bundle exec rake test:$TEST_SUITE
|
13
13
|
matrix:
|
14
14
|
allow_failures:
|
15
15
|
- rvm: 2.2.2
|
16
|
-
|
17
|
-
#- rvm: rbx
|
18
|
-
#- rvm: ree
|
19
|
-
|
16
|
+
cache: bundler
|
20
17
|
notifications:
|
21
18
|
email: kotn_ep1@hotmail.com
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
rvm:
|
27
|
-
- 2.2.2
|
28
|
-
# - 1.9.7
|
29
|
-
# - 2.2.2
|
30
|
-
# - 2.1.0
|
19
|
+
webhooks:
|
20
|
+
on_success: always
|
21
|
+
on_failure: always
|
data/Changelog.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
## Change Log
|
2
|
+
|
3
|
+
Below is a complete listing of changes for each revision of movieDB.
|
4
|
+
|
5
|
+
### 0.3.3 / Jun 22, 2015
|
6
|
+
* Changed test suite from rspec to unit test.
|
7
|
+
* Updated the README.md with better instructions.
|
8
|
+
* Applied OOP design for base code.
|
9
|
+
* More test unit code.
|
10
|
+
|
11
|
+
### 0.1.5 - 0.3.2 / Dec 10, 2013 - Jun 20, 2015
|
12
|
+
* Fix styling
|
13
|
+
* Added Gitter badge
|
14
|
+
* Added coverall
|
15
|
+
|
16
|
+
### 0.1.4 / Dec 10, 2013
|
17
|
+
* more changes to data_analysis
|
18
|
+
|
19
|
+
### 0.1.3 / Dec 4, 2013
|
20
|
+
* Added range stats
|
21
|
+
* added the travis CI
|
22
|
+
|
23
|
+
### 0.1.2 / Nov 24, 2013
|
24
|
+
* Fixing naming convention
|
25
|
+
* Formatted write xls
|
26
|
+
|
27
|
+
### 0.1.1 / Nov 23, 2013
|
28
|
+
* modified movieDB, person and version files
|
29
|
+
* modified readme, added home page url and dependency gems
|
30
|
+
# Added imdb and zimdb gem for extracting movie data
|
31
|
+
|
32
|
+
### 0.1.0
|
33
|
+
* Initial release.
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
## MovieDB
|
2
2
|
|
3
3
|
MovieDB is a ruby wrapper for fetching raw Movie or TV Data from IMDb and performing a variety of statistical analysis and computation.
|
4
|
-
The objective and usage of this tool is to media producers make high level structured
|
4
|
+
The objective and usage of this tool is to help media producers make high level structured decisions based on realistic analysis of actual data.
|
5
5
|
|
6
|
-
The fetched data is stored in memory using Redis
|
6
|
+
The fetched data is stored in memory using Redis and has an expiration time of 1800 seconds for all cached objects.
|
7
7
|
|
8
8
|
- [![Join the chat at https://gitter.im/keeperofthenecklace/movieDB](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/keeperofthenecklace/movieDB?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
9
9
|
- [![Coverage Status](https://coveralls.io/repos/keeperofthenecklace/movieDB/badge.svg)](https://coveralls.io/r/keeperofthenecklace/movieDB)
|
@@ -16,9 +16,14 @@
|
|
16
16
|
* Data Analysis
|
17
17
|
* Exploratory Data Analysis
|
18
18
|
* Confirmatory Data Analysis
|
19
|
+
* More to come...
|
19
20
|
|
20
21
|
## Installation
|
21
22
|
|
23
|
+
Please make sure you have redis installed.
|
24
|
+
|
25
|
+
This tutorial doesn't cover redis installation.
|
26
|
+
|
22
27
|
Add this line to your application's Gemfile:
|
23
28
|
|
24
29
|
gem 'movieDB'
|
@@ -41,7 +46,7 @@ Or install it yourself as:
|
|
41
46
|
|
42
47
|
$> imdb_ids = ["0369610", "3079380"]
|
43
48
|
|
44
|
-
$> MovieDB::Movie.
|
49
|
+
$> MovieDB::Movie.find_imdb_id(imdb_ids)
|
45
50
|
|
46
51
|
/* YOU CAN ADD AS MANY IMDB IDs AS YOU LIKE. BUT DO NOT EXCEED THE MAXIMUM REQUEST RATE. */
|
47
52
|
|
@@ -49,17 +54,21 @@ Or install it yourself as:
|
|
49
54
|
|
50
55
|
When IMDb data is fetched, two things happen.
|
51
56
|
|
52
|
-
First a reports folder is created in the movieDB gem.
|
57
|
+
First, a reports folder is created in the movieDB gem folder.
|
58
|
+
|
59
|
+
Next, the fetched data is written to an xls format and stored in the reports directory.
|
60
|
+
|
61
|
+
From your terminal you can locate movieDB gem directory like this:
|
53
62
|
|
54
|
-
|
63
|
+
$ gem content movieDB
|
55
64
|
|
56
|
-
|
65
|
+
If you use our above IMDb id, you should find the following xls file.
|
57
66
|
|
58
|
-
|
67
|
+
Feel free to open it.
|
59
68
|
|
60
|
-
$ open
|
69
|
+
$ open ../reports/imdb_JurassicWorld_Spy_.xls
|
61
70
|
|
62
|
-
## Usage -
|
71
|
+
## Usage - Analyzing Data From IMDb.
|
63
72
|
|
64
73
|
$ irb
|
65
74
|
|
@@ -67,13 +76,13 @@ For example, the fetched data used
|
|
67
76
|
|
68
77
|
> require 'MovieDB/data_process'
|
69
78
|
|
70
|
-
> MovieDB::DataProcess.send(:basic_statistic, '
|
79
|
+
> MovieDB::DataProcess.send(:basic_statistic, 'imdb_JurassicWorld_Spy_.xls')
|
71
80
|
|
72
|
-
|
81
|
+
A statistical computation is performed and the results is written to movieDB gem reports folder.
|
73
82
|
|
74
|
-
|
83
|
+
Feel free to open it.
|
75
84
|
|
76
|
-
$
|
85
|
+
$ open ../reports/Statistic_imdb_JurassicWorld_Spy.xls
|
77
86
|
|
78
87
|
## What's Next
|
79
88
|
|
data/Rakefile
CHANGED
data/lib/movieDB.rb
CHANGED
@@ -10,9 +10,10 @@ require "MovieDB/secret"
|
|
10
10
|
require "MovieDB/data_export"
|
11
11
|
require "redis"
|
12
12
|
require "json"
|
13
|
+
require 'highline/import'
|
13
14
|
|
14
15
|
unless defined? MovieDB::Movie
|
15
|
-
module MovieDB
|
16
|
+
module MovieDB
|
16
17
|
# Create a new movie record. The values are stored in the key-value data store.
|
17
18
|
#
|
18
19
|
# Default values are supplement during the instantiation of the class.
|
@@ -93,60 +94,74 @@ unless defined? MovieDB::Movie
|
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
96
|
-
#
|
97
|
-
#
|
98
|
-
# Futire release of this software will be using the boxofficemojoAPI
|
97
|
+
# Future release of this software will scrap IMDb data from boxofficemojoAPI.com
|
99
98
|
# https://github.com/skozilla/BoxOfficeMojo/tree/master/boxofficemojoAPI
|
100
99
|
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
# end
|
104
|
-
|
105
|
-
# You can Imdb movie data like this:
|
106
|
-
#
|
107
|
-
# MovieDB::Movie.send(:get_multiple_imdb_movie_data, "2024544", "1800241")
|
100
|
+
# You can fetch IMDb movie data like this:
|
101
|
+
# ids = ["2024544", "1800241" ]
|
108
102
|
#
|
109
|
-
#
|
103
|
+
# MovieDB::Movie.get_data(ids)
|
110
104
|
#
|
111
|
-
#
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
105
|
+
# The fetch data is stored in redis for 1800 seconds
|
106
|
+
# And then written to a xls file.
|
107
|
+
def self.find_imdb_id(*args)
|
108
|
+
raise ArgumentError if args.empty?
|
109
|
+
|
110
|
+
get_imdb_movie_data(args)
|
111
|
+
get_tmdb_movie_data(args)
|
112
|
+
cache_movie_data_to_redis(args)
|
113
|
+
write_imdb_data_to_xls
|
114
|
+
end
|
116
115
|
|
116
|
+
def self.get_imdb_movie_data(*args) #:nodoc:
|
117
117
|
@imdb_id = []
|
118
|
+
@imdb_movie_data = []
|
119
|
+
|
120
|
+
args.flatten.each do |value|
|
121
|
+
@imdb_id << value
|
118
122
|
|
123
|
+
Movie.new # Instantiate a movie object.
|
124
|
+
@imdb_movie_data << Imdb::Movie.new(value)
|
125
|
+
end
|
126
|
+
@imdb_movie_data
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.get_tmdb_movie_data(*args) #:nodoc:
|
130
|
+
@tmdb_movie_data = []
|
119
131
|
Tmdb::Api.key(Movie.key)
|
120
132
|
|
121
133
|
args.flatten.each do |value|
|
122
|
-
@
|
134
|
+
@tmdb_movie_data << Tmdb::Movie.detail("tt#{value}")
|
135
|
+
end
|
136
|
+
@tmdb_movie_data
|
137
|
+
end
|
123
138
|
|
124
|
-
|
125
|
-
|
139
|
+
def self.cache_movie_data_to_redis(*args) #:nodoc:
|
140
|
+
@db_redis ||= Redis.new
|
141
|
+
@db_redis.del "revenue"
|
126
142
|
|
127
|
-
|
143
|
+
args.flatten.each_with_index do |value, idx|
|
144
|
+
imdb_movie_data = @imdb_movie_data[idx]
|
145
|
+
tmdb_movie_data = @tmdb_movie_data[idx]
|
128
146
|
|
129
147
|
$IMDB_ATTRIBUTES_HEADERS.each do |attr_key|
|
130
|
-
begin
|
131
|
-
attr_value =
|
132
|
-
rescue
|
133
|
-
attr_value =
|
148
|
+
begin imdb_movie_data.send(attr_key)
|
149
|
+
attr_value = imdb_movie_data.send(attr_key)
|
150
|
+
rescue
|
151
|
+
attr_value = tmdb_movie_data['revenue']
|
134
152
|
end
|
135
153
|
|
136
154
|
@db_redis.hset "movie:#{value}", "#{attr_key}", "#{attr_value}" # Adding a hash data type.
|
137
|
-
|
138
155
|
@db_redis.lpush "#{attr_key}", "#{attr_value}" if attr_value.is_a? Numeric # Adding a list data type.
|
139
156
|
|
140
157
|
@db_redis.expire "#{attr_key}", 1800
|
141
|
-
|
142
158
|
@db_redis.expire "movie:#{value}", 1800
|
143
159
|
end
|
144
160
|
end
|
145
|
-
|
146
|
-
write_imdb_data_to_xls
|
161
|
+
@db_redis
|
147
162
|
end
|
148
163
|
|
149
|
-
def self.write_imdb_data_to_xls
|
164
|
+
def self.write_imdb_data_to_xls #:nodoc:
|
150
165
|
Movie.export_movie_data(@db_redis, @imdb_id)
|
151
166
|
end
|
152
167
|
end
|
@@ -9,6 +9,7 @@ module MovieDB
|
|
9
9
|
module Statistic
|
10
10
|
def basic_statistic(directory_name)
|
11
11
|
open_spreadsheet(directory_name)
|
12
|
+
@directory_name = directory_name
|
12
13
|
|
13
14
|
if check_imdb_count == true
|
14
15
|
puts "*"*41
|
@@ -128,7 +129,7 @@ module MovieDB
|
|
128
129
|
module_nesting = Module.nesting[0].to_s.gsub('::', ' ').split()
|
129
130
|
count = module_nesting.size
|
130
131
|
@data_analysis_name = module_nesting[count - 1]
|
131
|
-
@data_analysis_name << '_' <<
|
132
|
+
@data_analysis_name << '_' << @directory_name.gsub('_.xls', '')
|
132
133
|
end
|
133
134
|
|
134
135
|
def insert_data_to_existing_xls_file
|
data/lib/movieDB/version.rb
CHANGED
data/movieDB.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Albert McKeever"]
|
10
10
|
spec.email = ["kotn_ep1@hotmail.com"]
|
11
11
|
spec.description = %q{Perform Data Analysis on IMDB Movies}
|
12
|
-
spec.summary = %q{Movie/Film/TV Statistic and Data Analysis}
|
12
|
+
spec.summary = %q{Movie/Film/TV Statistic and Data Analysis Tool}
|
13
13
|
spec.homepage = "https://github.com/keeperofthenecklace/movieDB"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -20,10 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency "
|
24
|
-
spec.add_development_dependency 'highline'
|
25
|
-
spec.add_development_dependency 'fakeweb'
|
26
|
-
spec.add_dependency "activesupport", ">= 4.0.0"
|
23
|
+
spec.add_development_dependency "test-unit"
|
27
24
|
spec.add_dependency "spreadsheet"
|
28
25
|
spec.add_dependency "themoviedb"
|
29
26
|
spec.add_dependency "redis"
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require "imdb"
|
3
|
+
require "redis"
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'MovieDB'
|
8
|
+
rescue MovieError
|
9
|
+
end
|
10
|
+
|
11
|
+
class TestMovieDB < Test::Unit::TestCase
|
12
|
+
|
13
|
+
# This unit test writes an excel file to the reports directory
|
14
|
+
# in your gem folder.
|
15
|
+
#
|
16
|
+
# So, this method removes and empty the reports folder of
|
17
|
+
# all or andy pre-existing test files.
|
18
|
+
def remove_test_files_from_reports_directory
|
19
|
+
testxlsfiles = File.join("**", "reports", "*.xls")
|
20
|
+
FileUtils.rm Dir.glob(testxlsfiles)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_movie_new
|
24
|
+
m = MovieDB::Movie.new
|
25
|
+
assert_instance_of MovieDB::Movie, m
|
26
|
+
assert_equal "Method Missing 2: Rails Roars!", m.title
|
27
|
+
assert_equal ["David Black", "Paola Perotta", "Obie Fernandez", "David Chelimsky"], m.cast_members
|
28
|
+
assert_equal ["David Black => Developer", "Paola Perotta => Police Officer", "Obie Fernandez =>Hunter", "David Chelimsky =>Hostage"], m.cast_members_characters
|
29
|
+
assert_equal ["nm3901234", "nm4901244", "nm5901235", "nm3601266"], m.cast_member_ids
|
30
|
+
assert_equal "http://imdb.com/video/screenplay/vi581042457/", m.trailer_url
|
31
|
+
assert_equal "Yukihiro 'Matz' Matsumoto", m.director
|
32
|
+
assert_equal 'David Heinemeier Hansson', m.writers
|
33
|
+
assert_equal ["Manhattan, New York, USA"], m.filming_locations
|
34
|
+
assert_equal "Open Source Community Film Corporation", m.company
|
35
|
+
assert_equal ["Bromantic", "Syfy"], m.genres
|
36
|
+
assert_equal ["English", "German", "Italian"], m.languages
|
37
|
+
assert_equal ["USA", "Germany", "Italy"], m.countries
|
38
|
+
assert_equal 146, m.length
|
39
|
+
assert_equal ["David Black, a ruby developer, tries to write his flagship ruby book 'The Well-Grounded Rubyist vol. 186' only to find out that Ruby 9.0.2 and Rails 16.0.3 release dates have been postponed"], m.plot
|
40
|
+
assert_equal "http://ia.media-imdb.com/images/M/MV5BMTY@@.jpg", m.poster
|
41
|
+
assert_equal 9.9, m.rating
|
42
|
+
assert_equal 110636, m.votes
|
43
|
+
assert_equal "Rated R for dynamic OOD language usage and private methods access (certificate 33087)", m.mpaa_rating
|
44
|
+
assert_equal 'Only One MVC Will Rule Them All.', m.tagline
|
45
|
+
assert_equal 2013, m.year
|
46
|
+
assert_equal "11 October 2013 (USA)", m.release_date
|
47
|
+
assert_equal 456790, m.revenue
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_find_imdb_id
|
51
|
+
assert_raise(ArgumentError) { MovieDB::Movie.find_imdb_id() }
|
52
|
+
assert_equal("imdb_JurassicWorld_.xls", MovieDB::Movie.find_imdb_id('0369610'))
|
53
|
+
|
54
|
+
remove_test_files_from_reports_directory
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_get_imdb_movie_data
|
58
|
+
imdb_ids = ['0369610', '2395427']
|
59
|
+
wrong_ids = ['abcd', 'cdef']
|
60
|
+
|
61
|
+
assert_equal(2, MovieDB::Movie.get_imdb_movie_data(imdb_ids).length)
|
62
|
+
assert_nil(nil, MovieDB::Movie.get_imdb_movie_data(wrong_ids))
|
63
|
+
|
64
|
+
m = MovieDB::Movie.get_imdb_movie_data(imdb_ids)
|
65
|
+
assert_equal("Jurassic World", m[0].title)
|
66
|
+
assert_equal("Avengers: Age of Ultron", m[1].title)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_get_tmdb_movie_data
|
70
|
+
imdb_ids = ['0078748', '0120338']
|
71
|
+
assert_equal(2, MovieDB::Movie.get_tmdb_movie_data(imdb_ids).length)
|
72
|
+
|
73
|
+
m = MovieDB::Movie.get_tmdb_movie_data(imdb_ids)
|
74
|
+
assert_equal(104931801, m[0]['revenue'])
|
75
|
+
assert_equal(1845034188, m[1]['revenue'])
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_store_movie_data_to_redis
|
79
|
+
imdb_ids = ["0369610"]
|
80
|
+
|
81
|
+
MovieDB::Movie.get_imdb_movie_data(imdb_ids)
|
82
|
+
MovieDB::Movie.get_tmdb_movie_data(imdb_ids)
|
83
|
+
|
84
|
+
m = MovieDB::Movie.cache_movie_data_to_redis(imdb_ids)
|
85
|
+
assert_equal("Jurassic World", (m.hget "movie:0369610", "title"))
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_write_imdb_data_to_xls
|
89
|
+
imdb_ids = ['0369610', '2395427']
|
90
|
+
|
91
|
+
MovieDB::Movie.get_imdb_movie_data(imdb_ids)
|
92
|
+
MovieDB::Movie.get_tmdb_movie_data(imdb_ids)
|
93
|
+
m = MovieDB::Movie.cache_movie_data_to_redis(imdb_ids)
|
94
|
+
|
95
|
+
assert_equal("imdb_JurassicWorld_Avengers:AgeofUltron_.xls", MovieDB::Movie.export_movie_data(m, imdb_ids))
|
96
|
+
|
97
|
+
remove_test_files_from_reports_directory
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: movieDB
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Albert McKeever
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: test-unit
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -52,48 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: highline
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: fakeweb
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: activesupport
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 4.0.0
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 4.0.0
|
97
55
|
- !ruby/object:Gem::Dependency
|
98
56
|
name: spreadsheet
|
99
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,6 +131,7 @@ extra_rdoc_files: []
|
|
173
131
|
files:
|
174
132
|
- ".gitignore"
|
175
133
|
- ".travis.yml"
|
134
|
+
- Changelog.md
|
176
135
|
- Gemfile
|
177
136
|
- LICENSE.txt
|
178
137
|
- README.md
|
@@ -183,19 +142,13 @@ files:
|
|
183
142
|
- lib/movieDB/data_analysis.rb
|
184
143
|
- lib/movieDB/data_export.rb
|
185
144
|
- lib/movieDB/data_process.rb
|
186
|
-
- lib/movieDB/genre_parser.rb
|
187
|
-
- lib/movieDB/genres/en.txt
|
188
145
|
- lib/movieDB/movie_error.rb
|
189
|
-
- lib/movieDB/person.rb
|
190
146
|
- lib/movieDB/secret.rb
|
191
147
|
- lib/movieDB/status_checker.rb
|
192
148
|
- lib/movieDB/version.rb
|
193
149
|
- movieDB.gemspec
|
194
|
-
-
|
195
|
-
-
|
196
|
-
- spec/data_process_spec.rb
|
197
|
-
- spec/person_spec.rb
|
198
|
-
- spec/spec_helper.rb
|
150
|
+
- test/.DS_Store
|
151
|
+
- test/unit/test_movie_db.rb
|
199
152
|
homepage: https://github.com/keeperofthenecklace/movieDB
|
200
153
|
licenses:
|
201
154
|
- MIT
|
@@ -219,10 +172,7 @@ rubyforge_project:
|
|
219
172
|
rubygems_version: 2.4.6
|
220
173
|
signing_key:
|
221
174
|
specification_version: 4
|
222
|
-
summary: Movie/Film/TV Statistic and Data Analysis
|
175
|
+
summary: Movie/Film/TV Statistic and Data Analysis Tool
|
223
176
|
test_files:
|
224
|
-
-
|
225
|
-
-
|
226
|
-
- spec/data_process_spec.rb
|
227
|
-
- spec/person_spec.rb
|
228
|
-
- spec/spec_helper.rb
|
177
|
+
- test/.DS_Store
|
178
|
+
- test/unit/test_movie_db.rb
|
data/lib/movieDB/genre_parser.rb
DELETED
data/lib/movieDB/genres/en.txt
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
Action
|
2
|
-
Adventure
|
3
|
-
Animation
|
4
|
-
Biography
|
5
|
-
Comedy
|
6
|
-
Crime
|
7
|
-
Documentary
|
8
|
-
Drama
|
9
|
-
Family
|
10
|
-
Fantasy
|
11
|
-
Film-Noir
|
12
|
-
Game-Show
|
13
|
-
History
|
14
|
-
Horror
|
15
|
-
Music
|
16
|
-
Musical
|
17
|
-
Mystery
|
18
|
-
News
|
19
|
-
Reality-TV
|
20
|
-
Romance
|
21
|
-
Sci-Fi
|
22
|
-
Scifi
|
23
|
-
Sport
|
24
|
-
Suspense
|
25
|
-
Talk-Show
|
26
|
-
Thriller
|
27
|
-
War
|
28
|
-
Western
|
data/lib/movieDB/person.rb
DELETED
@@ -1,134 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'time'
|
3
|
-
# Create an actor instance and return the values for the actor variable.
|
4
|
-
#
|
5
|
-
# actor = MovieDB::Actor.instance_eval{create_with_info("Brittany Murphy", "F", "1977-11-10", "2009-12-20")}
|
6
|
-
# actor = MovieDB::Actor.instance_eval{create_with_info("George Clooney", "M", "1961-05-06", nil)}
|
7
|
-
|
8
|
-
# Example to find the actor name:
|
9
|
-
#
|
10
|
-
# actor_name = actor.map(&:name) #=> ["Brittany Murphy"]
|
11
|
-
#
|
12
|
-
# Example to see if an actoyre is alive:
|
13
|
-
# actor_name = actor.map(&:alive?) #=> [false, true]
|
14
|
-
#
|
15
|
-
# Example to find an actor's age:
|
16
|
-
# actor_name = actor.map(&:age) #=> [32, 52]
|
17
|
-
module MovieDB
|
18
|
-
class Person
|
19
|
-
attr_accessor :name, :gender, :birth_date, :death_date, :birthplace
|
20
|
-
|
21
|
-
def initialize(name = nil, gender = nil, birth_date = nil, death_date = nil, birth_place = nil, opt={})
|
22
|
-
@name = name
|
23
|
-
@gender = gender
|
24
|
-
@birth_date = birth_date
|
25
|
-
@death_date = death_date
|
26
|
-
@birth_place = birth_place
|
27
|
-
end
|
28
|
-
|
29
|
-
def age
|
30
|
-
if alive?
|
31
|
-
a = Time.now - Time.parse(@birth_date)
|
32
|
-
else
|
33
|
-
a = Time.parse(@death_date) - Time.parse(@birth_date)
|
34
|
-
end
|
35
|
-
|
36
|
-
return (a/60/60/24/365).to_i
|
37
|
-
end
|
38
|
-
|
39
|
-
def alive?
|
40
|
-
!@death_date.nil?
|
41
|
-
end
|
42
|
-
|
43
|
-
class << self
|
44
|
-
def create_with_info(name, gender, birth_date, death_date)
|
45
|
-
@person_DS ||= []
|
46
|
-
person = MovieDB::Person.new
|
47
|
-
person.name = name
|
48
|
-
person.gender = gender
|
49
|
-
person.birth_date = birth_date
|
50
|
-
person.death_date = death_date
|
51
|
-
|
52
|
-
return @person_DS << person
|
53
|
-
end
|
54
|
-
|
55
|
-
def filter_person(attr)
|
56
|
-
attr = attr.to_sym
|
57
|
-
raise ArgumentError "#{attr} can only be name or age" if !attr == :age && :name
|
58
|
-
|
59
|
-
return @person_DS.select{|s| s.alive?}.map(&attr)
|
60
|
-
end
|
61
|
-
|
62
|
-
# Returns a random parameter integer between min to max,
|
63
|
-
# rather than a float between min to max.(Ruby 2.0.0)
|
64
|
-
def sample_attr(attr)
|
65
|
-
randgen = Object.new
|
66
|
-
attr_array = self.instance_eval{filter_person(attr)}
|
67
|
-
attr_array.sample(random: randgen)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
private_class_method :create_with_info, :filter_person
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
class Actor < Person
|
76
|
-
attr_accessor :filmography
|
77
|
-
|
78
|
-
def initialize(filmography = [])
|
79
|
-
super()
|
80
|
-
@filmography = filmography
|
81
|
-
end
|
82
|
-
|
83
|
-
def addFilms film
|
84
|
-
@filmology ||= []
|
85
|
-
end
|
86
|
-
|
87
|
-
def actor_actress_gender(person)
|
88
|
-
case
|
89
|
-
when person.gender == 'F'
|
90
|
-
return "actress"
|
91
|
-
when person.gender == "M"
|
92
|
-
return "actor"
|
93
|
-
else
|
94
|
-
"N/A"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
class << self
|
99
|
-
def filter_actor_alive(attr)
|
100
|
-
attr = attr.to_sym
|
101
|
-
raise ArgumentError "#{attr} can only be name or age" if !attr == :age && :name
|
102
|
-
|
103
|
-
return @person_DS.select{|s| s.alive?}.map(&"#{attr.to_sym}")
|
104
|
-
end
|
105
|
-
|
106
|
-
def filter_actor_deceased(actor)
|
107
|
-
return @person_DS.select{ |s| !s.alive?}.map{ |m| "#{m.age}" } if attr == "age"
|
108
|
-
return @person_DS.select{ |s| !s.alive?}.map{ |m| "#{m.name}" } if attr == "name"
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
class Writer < Person
|
115
|
-
attr_accessor :published_work
|
116
|
-
alias :published? :published_work
|
117
|
-
|
118
|
-
def initialize(published_work = [])
|
119
|
-
super()
|
120
|
-
@published_work = published_work
|
121
|
-
end
|
122
|
-
|
123
|
-
end
|
124
|
-
|
125
|
-
class Director < Person
|
126
|
-
attr_accessor :filmography
|
127
|
-
|
128
|
-
def initialize(filmography = [])
|
129
|
-
super()
|
130
|
-
@filmography = filmography
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
134
|
-
end
|
data/spec/.DS_Store
DELETED
Binary file
|
data/spec/data_export_spec.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MovieDB::DataExport do
|
4
|
-
|
5
|
-
describe "#fetch_movie_data_from_imdb" do
|
6
|
-
MovieDB::Movie.get_data("2024544", "1800241", "0791314")
|
7
|
-
|
8
|
-
let(:file_name) {MovieDB::Movie.write_imdb_data_to_xls}
|
9
|
-
|
10
|
-
it 'writes the fetched data as an xls file to the reports directory' do
|
11
|
-
expect(File.exist?(File.join('reports', file_name))).to eql(true)
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
data/spec/data_process_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MovieDB::DataProcess do
|
4
|
-
|
5
|
-
describe "#AnalysisOfVariance" do
|
6
|
-
describe "#LeastSquares" do
|
7
|
-
describe "#Coefficient_Of_Determination" do
|
8
|
-
let(:basic_stat) {MovieDB::DataProcess}
|
9
|
-
|
10
|
-
it "should return the cof" do
|
11
|
-
# pending
|
12
|
-
basic_stat.send(:basic_statistic, 'imdb_12YearsaSlave_AmericanHustle_KeeperoftheNecklace.xls').should == 'Statistic_2015061319.xls'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/spec/person_spec.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MovieDB::Person do
|
4
|
-
|
5
|
-
context "#filter_person" do
|
6
|
-
it "should return attributes" do
|
7
|
-
MovieDB::Person.instance_eval{ create_with_info("Brittany Murphy", "F", "1977-11-10", "2009-12-20") }
|
8
|
-
MovieDB::Person.instance_eval{ create_with_info("George Clooney", "M", "1961-05-06", "") }
|
9
|
-
|
10
|
-
expect(MovieDB::Person.instance_eval{ filter_person('name') }).to eq(['Brittany Murphy', 'George Clooney'])
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context "#filter attribute" do
|
15
|
-
it "should return a random integer bewteen min to max" do
|
16
|
-
age = MovieDB::Person.instance_eval{ filter_person('age') }
|
17
|
-
moviePerson = MovieDB::Person.instance_eval{ sample_attr('age') }
|
18
|
-
|
19
|
-
# moviePerson.should be_in(age)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
$:.unshift File.expand_path('..', __FILE__)
|
2
|
-
$:.unshift File.expand_path('../../lib/', __FILE__)
|
3
|
-
|
4
|
-
require 'coveralls'
|
5
|
-
Coveralls.wear!
|
6
|
-
require 'movieDB'
|
7
|
-
require 'MovieDB/base'
|
8
|
-
require "MovieDB/person"
|
9
|
-
require 'MovieDB/status_checker'
|
10
|
-
require 'MovieDB/movie_error'
|
11
|
-
require "MovieDB/data_process"
|
12
|
-
require "MovieDB/data_export"
|
13
|
-
|
14
|
-
RSpec.configure do |config|
|
15
|
-
# config.include SimpleBdd
|
16
|
-
end
|