movies_client 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Binary file
Binary file
Binary file
@@ -4,6 +4,8 @@ class MoviesObject
4
4
 
5
5
  include AttributeHelper
6
6
 
7
+ attr_accessor :result
8
+
7
9
  def initialize(hash)
8
10
  self.attributes = hash
9
11
  end
@@ -43,7 +43,7 @@ class TmdbClient
43
43
  Tmdb::Api.language("fr")
44
44
  trailer = Tmdb::Movie.trailers(id)
45
45
  link = ''
46
- unless trailer["youtube"][0].nil?
46
+ unless trailer["youtube"].nil? || trailer["youtube"][0].nil?
47
47
  source = trailer["youtube"][0]["source"]
48
48
  link = 'https://www.youtube.com/watch?v='+source.to_s
49
49
  end
@@ -56,13 +56,15 @@ class TmdbClient
56
56
  credit = Tmdb::Movie.credits(id)
57
57
  credits = {}
58
58
  cred = {}
59
- credit["crew"].each do |r|
60
- key = r["job"]
61
- value = r["name"]
62
- if cred.has_key?(key)
63
- cred[key] << value
64
- else
65
- cred.store(key, [value])
59
+ unless credit['crew'].nil?
60
+ credit["crew"].each do |r|
61
+ key = r["job"]
62
+ value = r["name"]
63
+ if cred.has_key?(key)
64
+ cred[key] << value
65
+ else
66
+ cred.store(key, [value])
67
+ end
66
68
  end
67
69
  end
68
70
  credits.store(:credit, cred)
@@ -1,3 +1,3 @@
1
1
  module MoviesClient
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
data/lib/movies_client.rb CHANGED
@@ -9,6 +9,7 @@ module MoviesClient
9
9
  @config = { :prog => "../../data/PROG_GB_JUILLET_2014.ods",
10
10
  :key => ""
11
11
  }
12
+ @logger = Logger.new(STDOUT)
12
13
 
13
14
  def self.configure_file_path(path)
14
15
  @config[:prog] = path
@@ -23,6 +24,7 @@ module MoviesClient
23
24
  listresult = {}
24
25
  list.each_pair do |k, v|
25
26
  id = TmdbClient.get_id_from_title(v, @config[:key])
27
+ @logger.info "Retrieving data for movie #{v}"
26
28
  movie = TmdbClient.get_movie_details(id, @config[:key])
27
29
  casting = TmdbClient.get_movie_casts(id, @config[:key])
28
30
  credits = TmdbClient.get_credits(id, @config[:key])
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = MoviesClient::VERSION
9
9
  spec.authors = ["jeanbaptistevilain","SimonRonzani"]
10
10
  spec.email = ["jbvilain@gmail.com","ronzani.simon@gmail.com"]
11
- spec.description = "specific parser for cinema and showtimes information"
11
+ spec.description = "Small client that gathers data about movies using an input spreadsheet and the TMDB API"
12
12
  spec.summary = "Parse ods file with roo, get information about movie from the TMDB API"
13
13
  spec.homepage = "https://github.com/jeanbaptistevilain/movies_client"
14
14
  spec.license = "MIT"
@@ -17,7 +17,6 @@ class ScheduleParserTest < Test::Unit::TestCase
17
17
  result = {"SOUS LES JUPES DES FILLES"=>["SOUS+LES+JUPES+DES+FILLES"], "BABYSITTING"=>["BABYSITTING"], "DEUX JOURS UNE NUIT"=>["DEUX+JOURS+UNE+NUIT"], "DE TOUTES NOS FORCES"=>["DE+TOUTES+NOS+FORCES"], "QU EST CE QU'ON A FAIT AU BON DIEU\u00A0?"=>["QU+EST+CE+QU%27ON+A+FAIT+AU+BON+DIEU%C2%A0%3F"], "RIO 2"=>["RIO+2"], "BARBECUE"=>["BARBECUE"], "LA LISTE DE MES ENVIES"=>["LA+LISTE+DE+MES+ENVIES"], "DRAGONS 2"=>["DRAGONS+2"], "MALEFIQUE"=>["MALEFIQUE"], "ON A FAILLI \u00CATRE AMIES"=>["ON+A+FAILLI+%C3%8ATRE+AMIES"], "LA RITOURNELLE"=>["LA+RITOURNELLE"], "LES VACANCES DU PETIT NICOLAS"=>["LES+VACANCES+DU+PETIT+NICOLAS"], "TRANSFORMERS L AGE DE L'EXTINCTION"=>["TRANSFORMERS+L+AGE+DE+L%27EXTINCTION"], "TRANSCENDANCE"=>["TRANSCENDANCE"], "PLANES 2"=>["PLANES+2"]}
18
18
 
19
19
  @result = ScheduleParser.parse_ods(@ods_path)
20
- puts @result
21
20
  assert_equal daily_schedule , @result[:daily_schedule]
22
21
  assert_equal result, @result[:result]
23
22
  assert_equal result_expected , @result
@@ -39,7 +38,6 @@ class ScheduleParserTest < Test::Unit::TestCase
39
38
  result_expected = {:mois=>"JUILLET", :cinema1=>"LES RHODOS VILLAGE", :cinema2=>"LE CHARMIEUX CHINAILLON", :daily_schedule=>{"5"=>{:horaire1=>"17h30", :film1=>"SOUS LES JUPES DES FILLES", :date=>"SAM 5", :film2=>"BABYSITTING", :horaire2=>"21H", :film3=>"SOUS LES JUPES DES FILLES", :film4=>"BABYSITTING"}}, :result=>{"SOUS LES JUPES DES FILLES"=>["SOUS+LES+JUPES+DES+FILLES"], "BABYSITTING"=>["BABYSITTING"]}}
40
39
 
41
40
  @result = ScheduleParser.parse_ods_with_day(@ods_path, '5')
42
- puts @result
43
41
  assert_equal result_expected , @result
44
42
  assert_equal 'JUILLET' , @result[:mois]
45
43
  assert_equal 'LES RHODOS VILLAGE' , @result[:cinema1]
@@ -50,7 +50,7 @@ class MoviesClientTest < Test::Unit::TestCase
50
50
  should 'do the whole process' do
51
51
  #Define result expected
52
52
  result_expected = {}
53
- @result = MoviesClient.get_info(File.join('..', 'data', 'PROG_GB_JUILLET_2014.ods'), '7f0b035c164b74d6eec69ebcd8ff8d12', 'w500')
53
+ @result = MoviesClient.get_info(File.join('..', 'data', 'PROG_GB_FEVRIER_2015.ods'), '7f0b035c164b74d6eec69ebcd8ff8d12', 'w500')
54
54
  assert_equal result_expected, @result
55
55
  end
56
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: movies_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-10-13 00:00:00.000000000 Z
13
+ date: 2015-02-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -124,7 +124,8 @@ dependencies:
124
124
  - - ! '>='
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
- description: specific parser for cinema and showtimes information
127
+ description: Small client that gathers data about movies using an input spreadsheet
128
+ and the TMDB API
128
129
  email:
129
130
  - jbvilain@gmail.com
130
131
  - ronzani.simon@gmail.com
@@ -138,6 +139,9 @@ files:
138
139
  - README.md
139
140
  - Rakefile
140
141
  - data/PROG_GB_AOUT_2014.ods
142
+ - data/PROG_GB_DECEMBRE_2014.ods
143
+ - data/PROG_GB_FEVRIER_2015.ods
144
+ - data/PROG_GB_JANVIER_2015.ods
141
145
  - data/PROG_GB_JUILLET_2014.ods
142
146
  - lib/movies_client.rb
143
147
  - lib/movies_client/attribute_helper.rb