movieDB 0.2.1 → 0.2.2

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.
data/README.md CHANGED
@@ -50,13 +50,13 @@ Or install it yourself as:
50
50
 
51
51
  > require 'themoviedb'
52
52
 
53
- ## Usage - Collecting Movie Data From IMDb
53
+ ## Usage - Collect Movie Data From IMDb (3 Steps)
54
54
 
55
- > MovieDB::Movie.clear_data_store ** ONLY IF YOUR WANT TO EMPTY YOUR DATASTORE (ARRAY)
55
+ > MovieDB::Movie.clear_data_store /* ONLY IF YOUR WANT TO EMPTY YOUR DATASTORE (ARRAY) */
56
56
 
57
57
  > MovieDB::Movie.send(:get_multiple_imdb_movie_data, "2024544", "1800241", "0791314")
58
58
 
59
- ** YOU CAN ADD AS MANY IMDB UNIQUE NUMBERS. DO NOT EXCEED MAXIMUM REQUEST RATE.
59
+ /* YOU CAN ADD AS MANY IMDB UNIQUE NUMBERS. DO NOT EXCEED MAXIMUM REQUEST RATE.*/
60
60
 
61
61
  > MovieDB::DataExport.export_movie_data
62
62
 
@@ -64,9 +64,9 @@ Or install it yourself as:
64
64
 
65
65
  The exported movie data is stored in your reports directory.
66
66
 
67
- $ cd /reports/imdb_raw_data_20131216.xls
67
+ $ open /reports/imdb_raw_data_20131216.xls
68
68
 
69
- ## Usage - Analysing Data and Generating Stats
69
+ ## Usage - Analyse Data and Generate Statistic Results (4 Steps)
70
70
 
71
71
  $ irb
72
72
 
@@ -74,7 +74,7 @@ The exported movie data is stored in your reports directory.
74
74
 
75
75
  > require 'MovieDB/data_process'
76
76
 
77
- > MovieDB::DataProcess.send(:basic_statistics, 'imdb_raw_data_20131216.xls')
77
+ > MovieDB::DataProcess.send(:basic_statistic, 'imdb_raw_data_20131216.xls')
78
78
 
79
79
  ### Exported - Analyzed Data
80
80
 
data/lib/movieDB.rb CHANGED
@@ -79,7 +79,7 @@ unless defined? MovieDB::Movie
79
79
  DEFAULT_LANGUAGES = ["English", "German", "Italian"]
80
80
  DEFAULT_COUNTRIES = ["USA", "Germany", "Italy"]
81
81
  DEFAULT_LENGTH = 146
82
- DEFAULT_PLOT = ["David Black, a 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"]
82
+ DEFAULT_PLOT = ["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"]
83
83
  DEFAULT_POSTER = "http://ia.media-imdb.com/images/M/MV5BMTY@@.jpg"
84
84
  DEFAULT_RATING = 9.9
85
85
  DEFAULT_VOTES = 110636
@@ -155,6 +155,18 @@ unless defined? MovieDB::Movie
155
155
  # # MovieDB::Movie.instance_eval{filter_movie_attr("title")}
156
156
 
157
157
  def get_multiple_imdb_movie_data(*args)
158
+
159
+ ##
160
+ # Notify user to input in 2 or more imdb id's
161
+
162
+ if args.size == 1
163
+ puts "*"*41
164
+ puts "* A minimum of 2 Imdb id's are required *"
165
+ puts "* To perform statistical data analysis *"
166
+ puts "* You only have ONE Imdb id entered *"
167
+ puts "*"*41
168
+ end
169
+
158
170
  args.each do |value|
159
171
  get_imdb_movie_data(value)
160
172
  @movie_DS ||=[]
@@ -164,7 +176,7 @@ unless defined? MovieDB::Movie
164
176
  # query themoviedb.org for film revenue
165
177
  # Will return a 0 revenue if record doesn't exist at
166
178
  # themoviedb.org
167
-
179
+
168
180
  tmdb_arr = []
169
181
  tmdb_key = MovieDB::Movie.key
170
182
  Tmdb::Api.key(tmdb_key)
@@ -218,7 +230,7 @@ unless defined? MovieDB::Movie
218
230
  raise ArgumentError, 'invalid imbd id'
219
231
  end
220
232
  end
221
-
233
+
222
234
  return @movie_DS
223
235
 
224
236
  ##
@@ -12,23 +12,37 @@ module MovieDB
12
12
 
13
13
  def basic_statistic (directory_name)
14
14
  open_spreadsheet(directory_name)
15
- perform_computation
16
- insert_data_to_existing_xls_file
15
+
16
+ if check_imdb_count == true
17
+ puts "*"*41
18
+ puts "* A minimum of 2 Imdb id's are required *"
19
+ puts "* To perform statistical data analysis *"
20
+ puts "* You only have ONE Imdb id entered *"
21
+ puts "*"*41
22
+ else
23
+ perform_computation
24
+ insert_data_to_existing_xls_file
25
+ end
17
26
  end
18
27
 
19
28
  def open_spreadsheet(directory_name)
20
29
  @book = Spreadsheet.open File.join('reports', directory_name)
21
30
  @sheet = @book.worksheet(0)
22
31
 
23
- title_format = Spreadsheet::Format.new :color => :blue,
24
- :weight => :bold,
25
- :size => 13
32
+ ##
33
+ # Add document formatting
26
34
 
35
+ title_format = Spreadsheet::Format.new :color => :blue,
36
+ :weight => :bold,
37
+ :size => 13
27
38
 
28
- # set default format
29
39
  @sheet.column(22).width = "worldwide_gross".length
30
40
  end
31
41
 
42
+ def check_imdb_count
43
+ @sheet.rows.count - 1 == 1
44
+ end
45
+
32
46
  def perform_computation
33
47
 
34
48
  total_columns = 22
@@ -1,3 +1,3 @@
1
1
  module MovieDB
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -8,7 +8,7 @@ describe MovieDB::DataProcess do
8
8
  let(:basic_stat) {MovieDB::DataProcess}
9
9
 
10
10
  it "should return the cof" do
11
- basic_stat.send(:basic_statistic, 'imdb_raw_data_2013122109.xls').should == []
11
+ basic_stat.send(:basic_statistic, 'imdb_raw_data_2013122312.xls').should == []
12
12
  end
13
13
 
14
14
  it "raise error if file does not exist" do
data/spec/movieDB_spec.rb CHANGED
@@ -12,6 +12,7 @@ describe MovieDB do
12
12
 
13
13
  MovieDB::Movie.send(:clear_data_store)
14
14
  MovieDB::Movie.send(:get_multiple_imdb_movie_data, "0120338", "0120815", "0120915")
15
+ #MovieDB::Movie.send(:get_multiple_imdb_movie_data, "0120338")
15
16
  MovieDB::DataExport.export_movie_data
16
17
 
17
18
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: movieDB
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: