tmdb_party 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,13 +33,30 @@ Simple ruby wrapper to themoviedb.org (http://api.themoviedb.org/2.0/docs/) usin
33
33
  transformers.genres.collect{|cat| cat.name}.include?("Adventure")
34
34
  # => true
35
35
 
36
+ = recent additions:
37
+
38
+ # Support for browsing movies http://api.themoviedb.org/2.1/methods/Movie.browse
39
+ @tmdb.browse({:query => 'Transformers')
40
+
41
+ # Support for looking up Media info based on the file hash
42
+ # http://api.themoviedb.org/2.1/methods/Media.getInfo
43
+ @tmdb.get_file_info(file)
44
+
45
+ # Support for Language Tags http://api.themoviedb.org/2.1/language-tags
46
+ # All methods support an optional locale as the final method parameter
47
+ @tmdb.search('transformers', 'fr')
48
+
36
49
  = what is themoviedb.org?
37
- It's a movie database, kind of like IMDB except it's more of a community wiki. They also have an api that they're cool with people using. More on the api here: http://api.themoviedb.org/2.0/docs/
50
+ It's a movie database, kind of like IMDB except it's more of a community wiki. They also have an api that they're cool with people using. More on the api here: http://api.themoviedb.org/2.1
38
51
 
39
52
  == Contributors
53
+
40
54
  Jon Maddox (http://github.com/maddox)
55
+
41
56
  Magnus Bergmark (http://github.com/Mange)
57
+
42
58
  Brian Lopez (https://github.com/brianmario)
59
+
43
60
  Federico Ravasio (https://github.com/razielgn)
44
61
 
45
62
  == Copyright
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 8
3
+ :minor: 9
4
4
  :patch: 0
5
5
  :build:
@@ -1,6 +1,6 @@
1
1
  require 'httparty'
2
2
 
3
- %w[core_extensions httparty_icebox attributes video genre person image country studio cast_member movie].each do |class_name|
3
+ %w[extras/httparty_icebox extras/attributes video genre person image country studio cast_member movie extras/movie_hasher].each do |class_name|
4
4
  require "tmdb_party/#{class_name}"
5
5
  end
6
6
 
@@ -19,25 +19,27 @@ module TMDBParty
19
19
  end
20
20
 
21
21
  def search(query, lang = @default_lang)
22
- data = self.class.get(method_url('Movie.search', query, lang)).parsed_response
23
- if data.class != Array || data.first == "Nothing found."
24
- []
25
- else
26
- data.collect { |movie| Movie.new(movie, self) }
27
- end
22
+ data = self.class.get(method_url('Movie.search', lang, query))
23
+
24
+ result_or_empty_array(data, Movie)
25
+ end
26
+
27
+ # Read more about the parameters that can be passed to this method here:
28
+ # http://api.themoviedb.org/2.1/methods/Movie.browse
29
+ def browse(params = {}, lang = @default_lang)
30
+ data = self.class.get(method_url('Movie.browse', lang), :query => {:order => "asc", :order_by => "title"}.merge(params))
31
+
32
+ result_or_empty_array(data, Movie)
28
33
  end
29
34
 
30
35
  def search_person(query, lang = @default_lang)
31
- data = self.class.get(method_url('Person.search', query, lang)).parsed_response
32
- if data.class != Array || data.first == "Nothing found."
33
- []
34
- else
35
- data.collect { |person| Person.new(person, self) }
36
- end
36
+ data = self.class.get(method_url('Person.search', lang, query))
37
+
38
+ result_or_empty_array(data, Person)
37
39
  end
38
40
 
39
41
  def imdb_lookup(imdb_id, lang = @default_lang)
40
- data = self.class.get(method_url('Movie.imdbLookup', imdb_id, lang)).parsed_response
42
+ data = self.class.get(method_url('Movie.imdbLookup', lang, imdb_id)).parsed_response
41
43
  if data.class != Array || data.first == "Nothing found."
42
44
  nil
43
45
  else
@@ -46,29 +48,43 @@ module TMDBParty
46
48
  end
47
49
 
48
50
  def get_info(id, lang = @default_lang)
49
- data = self.class.get(method_url('Movie.getInfo', id, lang)).parsed_response
51
+ data = self.class.get(method_url('Movie.getInfo', lang, id)).parsed_response
50
52
  Movie.new(data.first, self)
51
53
  end
52
-
54
+
55
+ def get_file_info(file, lang=@default_lang)
56
+ hash = TMDBParty::MovieHasher.compute_hash(file)
57
+ bytesize = file.size
58
+ data = self.class.get(method_url('Media.getInfo', lang, hash, bytesize))
59
+
60
+ result_or_empty_array(data, Movie)
61
+ end
62
+
53
63
  def get_person(id, lang = @default_lang)
54
- data = self.class.get(method_url('Person.getInfo', id, lang)).parsed_response
64
+ data = self.class.get(method_url('Person.getInfo', lang, id)).parsed_response
55
65
  Person.new(data.first, self)
56
66
  end
57
67
 
58
68
  def get_genres(lang = @default_lang)
59
- data = self.class.get(method_url('Genres.getList', nil, lang)).parsed_response
69
+ data = self.class.get(method_url('Genres.getList', lang)).parsed_response
60
70
  data[1..-1].collect { |genre| Genre.new(genre) } # Skips the first, see spec/fixtures/genres_results.json
61
71
  end
62
72
 
63
73
  private
64
- def default_path_items
65
- ['json', @api_key]
66
- end
67
-
68
- def method_url(method, value, lang)
69
- url = [method, lang, default_path_items]
70
- url << URI.escape(value.to_s) if value
71
- '/' + url.join('/')
74
+
75
+ def result_or_empty_array(data, klass)
76
+ data = data.parsed_response
77
+ if data.class != Array || data.first == "Nothing found."
78
+ []
79
+ else
80
+ data.collect { |object| klass.new(object, self) }
72
81
  end
82
+ end
83
+
84
+ def method_url(method, lang, *args)
85
+ url = [method, lang, self.class.format, @api_key]
86
+ url += args.collect{ |a| URI.escape(a.to_s) }
87
+ '/' + url.join('/')
88
+ end
73
89
  end
74
90
  end
@@ -12,7 +12,7 @@ module TMDBParty
12
12
 
13
13
  module ClassMethods
14
14
  def attributes(*names)
15
- options = names.extract_options!
15
+ options = names.last.is_a?(::Hash) ? names.pop : {}
16
16
 
17
17
  names.each do |name|
18
18
  attribute name, options unless name.blank?
@@ -60,9 +60,18 @@ module TMDBParty
60
60
 
61
61
  def decode_raw_attribute(value, type)
62
62
  return nil unless value
63
- type.respond_to?(:parse) ? type.parse(value) : value
63
+
64
+ if type.respond_to?(:parse)
65
+ type.parse(value)
66
+ elsif type == Integer
67
+ Integer(value)
68
+ elsif type == Float
69
+ Float(value)
70
+ else
71
+ value
72
+ end
64
73
  end
65
74
 
66
75
  end
67
76
  end
68
- end
77
+ end
@@ -0,0 +1,32 @@
1
+ # MovieHasher based on the one found here:
2
+ # http://trac.opensubtitles.org/projects/opensubtitles/wiki/HashSourceCodes
3
+ #
4
+ # This will compute a unique hash for the movie that can be used for lookups on TMDB
5
+ # The algorithm calculates size + 64bit chksum of the first and last 64k (even if they overlap because the file is smaller than 128k).
6
+ # Make sure to uncomment and run the tests for this before making any changes
7
+ module TMDBParty
8
+ module MovieHasher
9
+ CHUNK_SIZE = 64 * 1024 # in bytes
10
+
11
+ def self.compute_hash(file)
12
+ filesize = file.size
13
+ hash = filesize
14
+
15
+ # Read 64 kbytes, divide up into 64 bits and add each
16
+ # to hash. Do for beginning and end of file.
17
+ # Q = unsigned long long = 64 bit
18
+ file.read(CHUNK_SIZE).unpack("Q*").each do |n|
19
+ hash = hash + n & 0xffffffffffffffff # to remain as 64 bit number
20
+ end
21
+
22
+ file.seek([0, filesize - CHUNK_SIZE].max, IO::SEEK_SET)
23
+
24
+ # And again for the end of the file
25
+ file.read(CHUNK_SIZE).unpack("Q*").each do |n|
26
+ hash = hash + n & 0xffffffffffffffff
27
+ end
28
+
29
+ sprintf("%016x", hash)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,891 @@
1
+ [{
2
+ "score": 4.9083095,
3
+ "popularity": 3,
4
+ "translated": true,
5
+ "adult": false,
6
+ "language": "en",
7
+ "original_name": "Beast Wars: Transformers",
8
+ "name": "Beast Wars: Transformers",
9
+ "alternative_name": null,
10
+ "movie_type": "movie",
11
+ "id": 42311,
12
+ "imdb_id": "tt0115108",
13
+ "url": "http://www.themoviedb.org/movie/42311",
14
+ "votes": 0,
15
+ "rating": 0.0,
16
+ "runtime": 290,
17
+ "certification": "",
18
+ "overview": "The Predacons and Maximals are fighting through space and crash on an unknown planet. The planet is rich in energon and powerful enough to fuel galactic conquest, and so the battle for the planet begins!",
19
+ "released": "",
20
+ "posters": [],
21
+ "backdrops": [],
22
+ "version": 53,
23
+ "last_modified_at": "2011-01-28 15:12:49"
24
+ },
25
+ {
26
+ "score": 2.7063267,
27
+ "popularity": 3,
28
+ "translated": true,
29
+ "adult": false,
30
+ "language": "en",
31
+ "original_name": "Powaqqatsi",
32
+ "name": "Powaqqatsi",
33
+ "alternative_name": "Powwaqatsi: Life in Transformation",
34
+ "movie_type": "movie",
35
+ "id": 24348,
36
+ "imdb_id": "tt0095895",
37
+ "url": "http://www.themoviedb.org/movie/24348",
38
+ "votes": 2,
39
+ "rating": 7.8,
40
+ "runtime": 99,
41
+ "certification": "",
42
+ "overview": "An exploration of technologically developing nations and the effect the transition to Western-style modernization has had on them.",
43
+ "released": "1988-04-29",
44
+ "posters": [{
45
+ "image": {
46
+ "type": "poster",
47
+ "size": "original",
48
+ "height": 2173,
49
+ "width": 1524,
50
+ "url": "http://cf1.themoviedb.org/posters/2d1/4bc96143017a3c57fe02c2d1/powaqqatsi-original.jpg",
51
+ "id": "4bc96143017a3c57fe02c2d1"
52
+ }
53
+ },
54
+ {
55
+ "image": {
56
+ "type": "poster",
57
+ "size": "mid",
58
+ "height": 713,
59
+ "width": 500,
60
+ "url": "http://cf1.themoviedb.org/posters/2d1/4bc96143017a3c57fe02c2d1/powaqqatsi-mid.jpg",
61
+ "id": "4bc96143017a3c57fe02c2d1"
62
+ }
63
+ },
64
+ {
65
+ "image": {
66
+ "type": "poster",
67
+ "size": "cover",
68
+ "height": 264,
69
+ "width": 185,
70
+ "url": "http://cf1.themoviedb.org/posters/2d1/4bc96143017a3c57fe02c2d1/powaqqatsi-cover.jpg",
71
+ "id": "4bc96143017a3c57fe02c2d1"
72
+ }
73
+ },
74
+ {
75
+ "image": {
76
+ "type": "poster",
77
+ "size": "thumb",
78
+ "height": 131,
79
+ "width": 92,
80
+ "url": "http://cf1.themoviedb.org/posters/2d1/4bc96143017a3c57fe02c2d1/powaqqatsi-thumb.jpg",
81
+ "id": "4bc96143017a3c57fe02c2d1"
82
+ }
83
+ }],
84
+ "backdrops": [{
85
+ "image": {
86
+ "type": "backdrop",
87
+ "size": "original",
88
+ "height": 2091,
89
+ "width": 3096,
90
+ "url": "http://cf1.themoviedb.org/backdrops/2cd/4bc96142017a3c57fe02c2cd/powaqqatsi-original.jpg",
91
+ "id": "4bc96142017a3c57fe02c2cd"
92
+ }
93
+ },
94
+ {
95
+ "image": {
96
+ "type": "backdrop",
97
+ "size": "poster",
98
+ "height": 527,
99
+ "width": 780,
100
+ "url": "http://cf1.themoviedb.org/backdrops/2cd/4bc96142017a3c57fe02c2cd/powaqqatsi-poster.jpg",
101
+ "id": "4bc96142017a3c57fe02c2cd"
102
+ }
103
+ },
104
+ {
105
+ "image": {
106
+ "type": "backdrop",
107
+ "size": "thumb",
108
+ "height": 203,
109
+ "width": 300,
110
+ "url": "http://cf1.themoviedb.org/backdrops/2cd/4bc96142017a3c57fe02c2cd/powaqqatsi-thumb.jpg",
111
+ "id": "4bc96142017a3c57fe02c2cd"
112
+ }
113
+ }],
114
+ "version": 30,
115
+ "last_modified_at": "2011-01-28 17:40:32"
116
+ },
117
+ {
118
+ "score": 3.8661811,
119
+ "popularity": 3,
120
+ "translated": true,
121
+ "adult": false,
122
+ "language": "en",
123
+ "original_name": "Resiklo",
124
+ "name": "Resiklo",
125
+ "alternative_name": "Recyclo Transformers",
126
+ "movie_type": "movie",
127
+ "id": 50136,
128
+ "imdb_id": "tt1047877",
129
+ "url": "http://www.themoviedb.org/movie/50136",
130
+ "votes": 0,
131
+ "rating": 0.0,
132
+ "runtime": 110,
133
+ "certification": null,
134
+ "overview": "Set in December 2021, Resiklo is the story of Crisval Sarmiento, an ex-military Colonel who leads a rag-tag group of survivors in the Philippines against the insect-like alien invaders known as the Balangs. Because of the enormous expenditures in resources during the invasion (hinted in the movie's opening credits), the humans are forced to scavenge the destroyed landscape for anything that could be recycled and put to use at their secret sanctuary, called Paraiso (Paradise in English).\r\nHowever, they are in a race against time, as in addition to the resource gathering, the survivors are fighting to eliminate the Balangs and their human collaborators, the Mutanos (mutated humans), while keeping Paraiso's location secret and along the way, uncovering the truth behind the invasion as well.",
135
+ "released": "2009-06-12",
136
+ "posters": [{
137
+ "image": {
138
+ "type": "poster",
139
+ "size": "original",
140
+ "height": 898,
141
+ "width": 690,
142
+ "url": "http://cf1.themoviedb.org/posters/47b/4ce92a267b9aa17c8e00047b/resiklo-original.jpg",
143
+ "id": "4ce92a267b9aa17c8e00047b"
144
+ }
145
+ },
146
+ {
147
+ "image": {
148
+ "type": "poster",
149
+ "size": "mid",
150
+ "height": 651,
151
+ "width": 500,
152
+ "url": "http://cf1.themoviedb.org/posters/47b/4ce92a267b9aa17c8e00047b/resiklo-mid.jpg",
153
+ "id": "4ce92a267b9aa17c8e00047b"
154
+ }
155
+ },
156
+ {
157
+ "image": {
158
+ "type": "poster",
159
+ "size": "cover",
160
+ "height": 241,
161
+ "width": 185,
162
+ "url": "http://cf1.themoviedb.org/posters/47b/4ce92a267b9aa17c8e00047b/resiklo-cover.jpg",
163
+ "id": "4ce92a267b9aa17c8e00047b"
164
+ }
165
+ },
166
+ {
167
+ "image": {
168
+ "type": "poster",
169
+ "size": "thumb",
170
+ "height": 120,
171
+ "width": 92,
172
+ "url": "http://cf1.themoviedb.org/posters/47b/4ce92a267b9aa17c8e00047b/resiklo-thumb.jpg",
173
+ "id": "4ce92a267b9aa17c8e00047b"
174
+ }
175
+ }],
176
+ "backdrops": [],
177
+ "version": 51,
178
+ "last_modified_at": "2011-01-28 14:57:18"
179
+ },
180
+ {
181
+ "score": 3.681232,
182
+ "popularity": 3,
183
+ "translated": true,
184
+ "adult": false,
185
+ "language": "en",
186
+ "original_name": "Riffrax: Transformers: Revenge of the Fallen",
187
+ "name": "Riffrax: Transformers: Revenge of the Fallen",
188
+ "alternative_name": null,
189
+ "movie_type": "movie",
190
+ "id": 48027,
191
+ "imdb_id": "",
192
+ "url": "http://www.themoviedb.org/movie/48027",
193
+ "votes": 0,
194
+ "rating": 0.0,
195
+ "runtime": null,
196
+ "certification": "",
197
+ "overview": "At its heart, Transformers: Revenge of the Fallen is a love story. A love story between two dogs, Mojo and Frankie, who are shown humping several times in the first fifteen minutes of the movie*. Stunningly, this remains a highlight over the next two hours of movie. We don't see much of the dogs after their owner, Shia LaBeouf, leaves for college, but we found our thoughts frequently drifting back to them as the human characters dropped their pants, ran into things, and stammered incoherently. Who was feeding the dogs? Were they getting along with the other dogs at the dog park? How was Frankie adapting to the new diet the vet had put him on back in June?",
198
+ "released": "",
199
+ "posters": [{
200
+ "image": {
201
+ "type": "poster",
202
+ "size": "original",
203
+ "height": 888,
204
+ "width": 666,
205
+ "url": "http://cf1.themoviedb.org/posters/318/4cc464ed7b9aa138d5002318/riffrax-transformers-revenge-of-the-fallen-original.jpg",
206
+ "id": "4cc464ed7b9aa138d5002318"
207
+ }
208
+ },
209
+ {
210
+ "image": {
211
+ "type": "poster",
212
+ "size": "mid",
213
+ "height": 667,
214
+ "width": 500,
215
+ "url": "http://cf1.themoviedb.org/posters/318/4cc464ed7b9aa138d5002318/riffrax-transformers-revenge-of-the-fallen-mid.jpg",
216
+ "id": "4cc464ed7b9aa138d5002318"
217
+ }
218
+ },
219
+ {
220
+ "image": {
221
+ "type": "poster",
222
+ "size": "cover",
223
+ "height": 247,
224
+ "width": 185,
225
+ "url": "http://cf1.themoviedb.org/posters/318/4cc464ed7b9aa138d5002318/riffrax-transformers-revenge-of-the-fallen-cover.jpg",
226
+ "id": "4cc464ed7b9aa138d5002318"
227
+ }
228
+ },
229
+ {
230
+ "image": {
231
+ "type": "poster",
232
+ "size": "thumb",
233
+ "height": 123,
234
+ "width": 92,
235
+ "url": "http://cf1.themoviedb.org/posters/318/4cc464ed7b9aa138d5002318/riffrax-transformers-revenge-of-the-fallen-thumb.jpg",
236
+ "id": "4cc464ed7b9aa138d5002318"
237
+ }
238
+ }],
239
+ "backdrops": [],
240
+ "version": 9,
241
+ "last_modified_at": "2011-01-25 21:10:37"
242
+ },
243
+ {
244
+ "score": 4.9083095,
245
+ "popularity": 3,
246
+ "translated": true,
247
+ "adult": false,
248
+ "language": "en",
249
+ "original_name": "The Transformers: The Movie",
250
+ "name": "The Transformers: The Movie",
251
+ "alternative_name": "The Transformers - The Movie",
252
+ "movie_type": "movie",
253
+ "id": 1857,
254
+ "imdb_id": "tt0092106",
255
+ "url": "http://www.themoviedb.org/movie/1857",
256
+ "votes": 4,
257
+ "rating": 6.8,
258
+ "runtime": 84,
259
+ "certification": "PG",
260
+ "overview": "The heroic Autobots must battle the evil Decepticons as well as a colossal planet-consuming robot named Unicron in order to safeguard the Autobot's Matrix of Leadership.",
261
+ "released": "1986-08-08",
262
+ "posters": [{
263
+ "image": {
264
+ "type": "poster",
265
+ "size": "original",
266
+ "height": 1000,
267
+ "width": 699,
268
+ "url": "http://cf1.themoviedb.org/posters/3bd/4ce860b25e73d6258f0003bd/the-transformers-the-movie-original.jpg",
269
+ "id": "4ce860b25e73d6258f0003bd"
270
+ }
271
+ },
272
+ {
273
+ "image": {
274
+ "type": "poster",
275
+ "size": "mid",
276
+ "height": 715,
277
+ "width": 500,
278
+ "url": "http://cf1.themoviedb.org/posters/3bd/4ce860b25e73d6258f0003bd/the-transformers-the-movie-mid.jpg",
279
+ "id": "4ce860b25e73d6258f0003bd"
280
+ }
281
+ },
282
+ {
283
+ "image": {
284
+ "type": "poster",
285
+ "size": "cover",
286
+ "height": 265,
287
+ "width": 185,
288
+ "url": "http://cf1.themoviedb.org/posters/3bd/4ce860b25e73d6258f0003bd/the-transformers-the-movie-cover.jpg",
289
+ "id": "4ce860b25e73d6258f0003bd"
290
+ }
291
+ },
292
+ {
293
+ "image": {
294
+ "type": "poster",
295
+ "size": "thumb",
296
+ "height": 132,
297
+ "width": 92,
298
+ "url": "http://cf1.themoviedb.org/posters/3bd/4ce860b25e73d6258f0003bd/the-transformers-the-movie-thumb.jpg",
299
+ "id": "4ce860b25e73d6258f0003bd"
300
+ }
301
+ }],
302
+ "backdrops": [{
303
+ "image": {
304
+ "type": "backdrop",
305
+ "size": "original",
306
+ "height": 1080,
307
+ "width": 1920,
308
+ "url": "http://cf1.themoviedb.org/backdrops/2b8/4bc91334017a3c57fe0072b8/the-transformers-the-movie-original.png",
309
+ "id": "4bc91334017a3c57fe0072b8"
310
+ }
311
+ },
312
+ {
313
+ "image": {
314
+ "type": "backdrop",
315
+ "size": "poster",
316
+ "height": 439,
317
+ "width": 780,
318
+ "url": "http://cf1.themoviedb.org/backdrops/2b8/4bc91334017a3c57fe0072b8/the-transformers-the-movie-poster.png",
319
+ "id": "4bc91334017a3c57fe0072b8"
320
+ }
321
+ },
322
+ {
323
+ "image": {
324
+ "type": "backdrop",
325
+ "size": "thumb",
326
+ "height": 169,
327
+ "width": 300,
328
+ "url": "http://cf1.themoviedb.org/backdrops/2b8/4bc91334017a3c57fe0072b8/the-transformers-the-movie-thumb.png",
329
+ "id": "4bc91334017a3c57fe0072b8"
330
+ }
331
+ }],
332
+ "version": 50,
333
+ "last_modified_at": "2011-01-28 17:28:46"
334
+ },
335
+ {
336
+ "score": 9.816619,
337
+ "popularity": 3,
338
+ "translated": true,
339
+ "adult": false,
340
+ "language": "en",
341
+ "original_name": "Transformations",
342
+ "name": "Transformations",
343
+ "alternative_name": null,
344
+ "movie_type": "movie",
345
+ "id": 28800,
346
+ "imdb_id": "tt0094632",
347
+ "url": "http://www.themoviedb.org/movie/28800",
348
+ "votes": 1,
349
+ "rating": 5.5,
350
+ "runtime": 84,
351
+ "certification": "",
352
+ "overview": "No overview found.",
353
+ "released": "1988-09-02",
354
+ "posters": [{
355
+ "image": {
356
+ "type": "poster",
357
+ "size": "original",
358
+ "height": 529,
359
+ "width": 326,
360
+ "url": "http://cf1.themoviedb.org/posters/b32/4bc97113017a3c57fe033b32/transformations-original.jpg",
361
+ "id": "4bc97113017a3c57fe033b32"
362
+ }
363
+ },
364
+ {
365
+ "image": {
366
+ "type": "poster",
367
+ "size": "mid",
368
+ "height": 811,
369
+ "width": 500,
370
+ "url": "http://cf1.themoviedb.org/posters/b32/4bc97113017a3c57fe033b32/transformations-mid.jpg",
371
+ "id": "4bc97113017a3c57fe033b32"
372
+ }
373
+ },
374
+ {
375
+ "image": {
376
+ "type": "poster",
377
+ "size": "cover",
378
+ "height": 300,
379
+ "width": 185,
380
+ "url": "http://cf1.themoviedb.org/posters/b32/4bc97113017a3c57fe033b32/transformations-cover.jpg",
381
+ "id": "4bc97113017a3c57fe033b32"
382
+ }
383
+ },
384
+ {
385
+ "image": {
386
+ "type": "poster",
387
+ "size": "thumb",
388
+ "height": 149,
389
+ "width": 92,
390
+ "url": "http://cf1.themoviedb.org/posters/b32/4bc97113017a3c57fe033b32/transformations-thumb.jpg",
391
+ "id": "4bc97113017a3c57fe033b32"
392
+ }
393
+ }],
394
+ "backdrops": [],
395
+ "version": 43,
396
+ "last_modified_at": "2011-01-28 17:15:41"
397
+ },
398
+ {
399
+ "score": 9.816619,
400
+ "popularity": 3,
401
+ "translated": true,
402
+ "adult": false,
403
+ "language": "en",
404
+ "original_name": "Transformers",
405
+ "name": "Transformers",
406
+ "alternative_name": "The Transformers",
407
+ "movie_type": "movie",
408
+ "id": 1858,
409
+ "imdb_id": "tt0418279",
410
+ "url": "http://www.themoviedb.org/movie/1858",
411
+ "votes": 63,
412
+ "rating": 7.4,
413
+ "runtime": 132,
414
+ "certification": "PG-13",
415
+ "overview": "Young teenager Sam Witwicky becomes involved in the ancient struggle between two extraterrestrial factions of transforming robots, the heroic Autobots and the evil Decepticons. Sam holds the clue to unimaginable power and the Decepticons will stop at nothing to retrieve it.",
416
+ "released": "2007-07-04",
417
+ "posters": [{
418
+ "image": {
419
+ "type": "poster",
420
+ "size": "original",
421
+ "height": 1500,
422
+ "width": 1000,
423
+ "url": "http://cf1.themoviedb.org/posters/233/4c9ea5cf5e73d67049000233/transformers-original.jpg",
424
+ "id": "4c9ea5cf5e73d67049000233"
425
+ }
426
+ },
427
+ {
428
+ "image": {
429
+ "type": "poster",
430
+ "size": "mid",
431
+ "height": 750,
432
+ "width": 500,
433
+ "url": "http://cf1.themoviedb.org/posters/233/4c9ea5cf5e73d67049000233/transformers-mid.jpg",
434
+ "id": "4c9ea5cf5e73d67049000233"
435
+ }
436
+ },
437
+ {
438
+ "image": {
439
+ "type": "poster",
440
+ "size": "cover",
441
+ "height": 278,
442
+ "width": 185,
443
+ "url": "http://cf1.themoviedb.org/posters/233/4c9ea5cf5e73d67049000233/transformers-cover.jpg",
444
+ "id": "4c9ea5cf5e73d67049000233"
445
+ }
446
+ },
447
+ {
448
+ "image": {
449
+ "type": "poster",
450
+ "size": "thumb",
451
+ "height": 138,
452
+ "width": 92,
453
+ "url": "http://cf1.themoviedb.org/posters/233/4c9ea5cf5e73d67049000233/transformers-thumb.jpg",
454
+ "id": "4c9ea5cf5e73d67049000233"
455
+ }
456
+ }],
457
+ "backdrops": [{
458
+ "image": {
459
+ "type": "backdrop",
460
+ "size": "original",
461
+ "height": 1080,
462
+ "width": 1920,
463
+ "url": "http://cf1.themoviedb.org/backdrops/2ce/4bc91339017a3c57fe0072ce/transformers-original.jpg",
464
+ "id": "4bc91339017a3c57fe0072ce"
465
+ }
466
+ },
467
+ {
468
+ "image": {
469
+ "type": "backdrop",
470
+ "size": "poster",
471
+ "height": 439,
472
+ "width": 780,
473
+ "url": "http://cf1.themoviedb.org/backdrops/2ce/4bc91339017a3c57fe0072ce/transformers-poster.jpg",
474
+ "id": "4bc91339017a3c57fe0072ce"
475
+ }
476
+ },
477
+ {
478
+ "image": {
479
+ "type": "backdrop",
480
+ "size": "thumb",
481
+ "height": 169,
482
+ "width": 300,
483
+ "url": "http://cf1.themoviedb.org/backdrops/2ce/4bc91339017a3c57fe0072ce/transformers-thumb.jpg",
484
+ "id": "4bc91339017a3c57fe0072ce"
485
+ }
486
+ }],
487
+ "version": 187,
488
+ "last_modified_at": "2011-01-28 17:28:33"
489
+ },
490
+ {
491
+ "score": 4.9083095,
492
+ "popularity": 3,
493
+ "translated": true,
494
+ "adult": false,
495
+ "language": "en",
496
+ "original_name": "Transformers: Beginnings",
497
+ "name": "Transformers: Beginnings",
498
+ "alternative_name": null,
499
+ "movie_type": "movie",
500
+ "id": 25565,
501
+ "imdb_id": "tt1236486",
502
+ "url": "http://www.themoviedb.org/movie/25565",
503
+ "votes": 1,
504
+ "rating": 7.0,
505
+ "runtime": 22,
506
+ "certification": "",
507
+ "overview": "On their home planet of Cybertron, the Autobots and Decepticons are involved in an explosive battle over the coveted AllSpark. With the fate of the universe at stake, the Autobots send it far from the reach of the ruthless Megatron, leader of the Decepticons. But there are even more surprises in store when it crash-lands on Earth.",
508
+ "released": "1900-01-01",
509
+ "posters": [{
510
+ "image": {
511
+ "type": "poster",
512
+ "size": "original",
513
+ "height": 1500,
514
+ "width": 1000,
515
+ "url": "http://cf1.themoviedb.org/posters/4b0/4bc964ff017a3c57fe02e4b0/transformers-beginnings-original.jpg",
516
+ "id": "4bc964ff017a3c57fe02e4b0"
517
+ }
518
+ },
519
+ {
520
+ "image": {
521
+ "type": "poster",
522
+ "size": "mid",
523
+ "height": 750,
524
+ "width": 500,
525
+ "url": "http://cf1.themoviedb.org/posters/4b0/4bc964ff017a3c57fe02e4b0/transformers-beginnings-mid.jpg",
526
+ "id": "4bc964ff017a3c57fe02e4b0"
527
+ }
528
+ },
529
+ {
530
+ "image": {
531
+ "type": "poster",
532
+ "size": "cover",
533
+ "height": 278,
534
+ "width": 185,
535
+ "url": "http://cf1.themoviedb.org/posters/4b0/4bc964ff017a3c57fe02e4b0/transformers-beginnings-cover.jpg",
536
+ "id": "4bc964ff017a3c57fe02e4b0"
537
+ }
538
+ },
539
+ {
540
+ "image": {
541
+ "type": "poster",
542
+ "size": "thumb",
543
+ "height": 138,
544
+ "width": 92,
545
+ "url": "http://cf1.themoviedb.org/posters/4b0/4bc964ff017a3c57fe02e4b0/transformers-beginnings-thumb.jpg",
546
+ "id": "4bc964ff017a3c57fe02e4b0"
547
+ }
548
+ }],
549
+ "backdrops": [{
550
+ "image": {
551
+ "type": "backdrop",
552
+ "size": "original",
553
+ "height": 720,
554
+ "width": 1280,
555
+ "url": "http://cf1.themoviedb.org/backdrops/4a4/4bc964fe017a3c57fe02e4a4/transformers-beginnings-original.jpg",
556
+ "id": "4bc964fe017a3c57fe02e4a4"
557
+ }
558
+ },
559
+ {
560
+ "image": {
561
+ "type": "backdrop",
562
+ "size": "poster",
563
+ "height": 439,
564
+ "width": 780,
565
+ "url": "http://cf1.themoviedb.org/backdrops/4a4/4bc964fe017a3c57fe02e4a4/transformers-beginnings-poster.jpg",
566
+ "id": "4bc964fe017a3c57fe02e4a4"
567
+ }
568
+ },
569
+ {
570
+ "image": {
571
+ "type": "backdrop",
572
+ "size": "thumb",
573
+ "height": 169,
574
+ "width": 300,
575
+ "url": "http://cf1.themoviedb.org/backdrops/4a4/4bc964fe017a3c57fe02e4a4/transformers-beginnings-thumb.jpg",
576
+ "id": "4bc964fe017a3c57fe02e4a4"
577
+ }
578
+ }],
579
+ "version": 13,
580
+ "last_modified_at": "2011-01-28 16:35:20"
581
+ },
582
+ {
583
+ "score": 4.6044497,
584
+ "popularity": 3,
585
+ "translated": true,
586
+ "adult": false,
587
+ "language": "ru",
588
+ "original_name": "Transformers: Dark of the Moon",
589
+ "name": "Transformers: Dark of the Moon",
590
+ "alternative_name": null,
591
+ "movie_type": "movie",
592
+ "id": 38356,
593
+ "imdb_id": "tt1399103",
594
+ "url": "http://www.themoviedb.org/movie/38356",
595
+ "votes": 0,
596
+ "rating": 0.0,
597
+ "runtime": null,
598
+ "certification": "",
599
+ "overview": "Transformers 3 is the working title for the third and final film in the live action Transformers series, directed by Michael Bay and produced by Steven Spielberg. It is the sequel to Transformers and Transformers: Revenge of the Fallen and is scheduled for release on July 1, 2011 in Real D 3D And IMAX 3D. Shia LaBeouf, Josh Duhamel, Tyrese Gibson, John Turturro and Ram\u00f3n Rodr\u00edguez are set to reprise their starring roles, with Peter Cullen returning as the voice of Optimus Prime, and Hugo Weaving also returning the voice of Megatron. Despite having initially been confirmed for the film, with the film already into principal photography, Megan Fox will not reprise her role. With Fox's character Mikaela being dropped, Sam is now set to be assigned a new love interest, who will be played by English model Rosie Huntington-Whiteley.",
600
+ "released": "2011-07-01",
601
+ "posters": [{
602
+ "image": {
603
+ "type": "poster",
604
+ "size": "original",
605
+ "height": 1441,
606
+ "width": 988,
607
+ "url": "http://cf1.themoviedb.org/posters/280/4d0153bf7b9aa11bc2000280/transformers-dark-of-the-moon-original.jpg",
608
+ "id": "4d0153bf7b9aa11bc2000280"
609
+ }
610
+ },
611
+ {
612
+ "image": {
613
+ "type": "poster",
614
+ "size": "mid",
615
+ "height": 729,
616
+ "width": 500,
617
+ "url": "http://cf1.themoviedb.org/posters/280/4d0153bf7b9aa11bc2000280/transformers-dark-of-the-moon-mid.jpg",
618
+ "id": "4d0153bf7b9aa11bc2000280"
619
+ }
620
+ },
621
+ {
622
+ "image": {
623
+ "type": "poster",
624
+ "size": "cover",
625
+ "height": 270,
626
+ "width": 185,
627
+ "url": "http://cf1.themoviedb.org/posters/280/4d0153bf7b9aa11bc2000280/transformers-dark-of-the-moon-cover.jpg",
628
+ "id": "4d0153bf7b9aa11bc2000280"
629
+ }
630
+ },
631
+ {
632
+ "image": {
633
+ "type": "poster",
634
+ "size": "thumb",
635
+ "height": 134,
636
+ "width": 92,
637
+ "url": "http://cf1.themoviedb.org/posters/280/4d0153bf7b9aa11bc2000280/transformers-dark-of-the-moon-thumb.jpg",
638
+ "id": "4d0153bf7b9aa11bc2000280"
639
+ }
640
+ }],
641
+ "backdrops": [{
642
+ "image": {
643
+ "type": "backdrop",
644
+ "size": "original",
645
+ "height": 720,
646
+ "width": 1280,
647
+ "url": "http://cf1.themoviedb.org/backdrops/291/4d0156907b9aa11bc3000291/transformers-dark-of-the-moon-original.jpg",
648
+ "id": "4d0156907b9aa11bc3000291"
649
+ }
650
+ },
651
+ {
652
+ "image": {
653
+ "type": "backdrop",
654
+ "size": "poster",
655
+ "height": 439,
656
+ "width": 780,
657
+ "url": "http://cf1.themoviedb.org/backdrops/291/4d0156907b9aa11bc3000291/transformers-dark-of-the-moon-poster.jpg",
658
+ "id": "4d0156907b9aa11bc3000291"
659
+ }
660
+ },
661
+ {
662
+ "image": {
663
+ "type": "backdrop",
664
+ "size": "thumb",
665
+ "height": 169,
666
+ "width": 300,
667
+ "url": "http://cf1.themoviedb.org/backdrops/291/4d0156907b9aa11bc3000291/transformers-dark-of-the-moon-thumb.jpg",
668
+ "id": "4d0156907b9aa11bc3000291"
669
+ }
670
+ }],
671
+ "version": 58,
672
+ "last_modified_at": "2011-01-28 17:34:15"
673
+ },
674
+ {
675
+ "score": 4.9083095,
676
+ "popularity": 3,
677
+ "translated": true,
678
+ "adult": false,
679
+ "language": "en",
680
+ "original_name": "Transformers: Resparked",
681
+ "name": "Transformers: Resparked",
682
+ "alternative_name": null,
683
+ "movie_type": "movie",
684
+ "id": 18907,
685
+ "imdb_id": "",
686
+ "url": "http://www.themoviedb.org/movie/18907",
687
+ "votes": 0,
688
+ "rating": 0.0,
689
+ "runtime": 122,
690
+ "certification": "",
691
+ "overview": "No overview found.",
692
+ "released": "2008-03-09",
693
+ "posters": [{
694
+ "image": {
695
+ "type": "poster",
696
+ "size": "original",
697
+ "height": 1446,
698
+ "width": 1000,
699
+ "url": "http://cf1.themoviedb.org/posters/d0e/4bc954f9017a3c57fe025d0e/transformers-resparked-original.jpg",
700
+ "id": "4bc954f9017a3c57fe025d0e"
701
+ }
702
+ },
703
+ {
704
+ "image": {
705
+ "type": "poster",
706
+ "size": "mid",
707
+ "height": 723,
708
+ "width": 500,
709
+ "url": "http://cf1.themoviedb.org/posters/d0e/4bc954f9017a3c57fe025d0e/transformers-resparked-mid.jpg",
710
+ "id": "4bc954f9017a3c57fe025d0e"
711
+ }
712
+ },
713
+ {
714
+ "image": {
715
+ "type": "poster",
716
+ "size": "cover",
717
+ "height": 268,
718
+ "width": 185,
719
+ "url": "http://cf1.themoviedb.org/posters/d0e/4bc954f9017a3c57fe025d0e/transformers-resparked-cover.jpg",
720
+ "id": "4bc954f9017a3c57fe025d0e"
721
+ }
722
+ },
723
+ {
724
+ "image": {
725
+ "type": "poster",
726
+ "size": "thumb",
727
+ "height": 133,
728
+ "width": 92,
729
+ "url": "http://cf1.themoviedb.org/posters/d0e/4bc954f9017a3c57fe025d0e/transformers-resparked-thumb.jpg",
730
+ "id": "4bc954f9017a3c57fe025d0e"
731
+ }
732
+ }],
733
+ "backdrops": [],
734
+ "version": 8,
735
+ "last_modified_at": "2011-01-25 19:36:45"
736
+ },
737
+ {
738
+ "score": 4.2947707,
739
+ "popularity": 3,
740
+ "translated": true,
741
+ "adult": false,
742
+ "language": "en",
743
+ "original_name": "Transformers: Revenge of the Fallen",
744
+ "name": "Transformers: Revenge of the Fallen",
745
+ "alternative_name": "Transformers 2",
746
+ "movie_type": "movie",
747
+ "id": 8373,
748
+ "imdb_id": "tt1055369",
749
+ "url": "http://www.themoviedb.org/movie/8373",
750
+ "votes": 46,
751
+ "rating": 6.8,
752
+ "runtime": 147,
753
+ "certification": "PG-13",
754
+ "overview": "Sam Witwicky leaves the Autobots behind for a normal life. But when his mind is filled with cryptic symbols, the Decepticons target him and he is dragged back into the Transformers' war.",
755
+ "released": "2009-06-24",
756
+ "posters": [{
757
+ "image": {
758
+ "type": "poster",
759
+ "size": "original",
760
+ "height": 1500,
761
+ "width": 1000,
762
+ "url": "http://cf1.themoviedb.org/posters/511/4c9fa2365e73d6704b000511/transformers-revenge-of-the-fallen-original.jpg",
763
+ "id": "4c9fa2365e73d6704b000511"
764
+ }
765
+ },
766
+ {
767
+ "image": {
768
+ "type": "poster",
769
+ "size": "mid",
770
+ "height": 750,
771
+ "width": 500,
772
+ "url": "http://cf1.themoviedb.org/posters/511/4c9fa2365e73d6704b000511/transformers-revenge-of-the-fallen-mid.jpg",
773
+ "id": "4c9fa2365e73d6704b000511"
774
+ }
775
+ },
776
+ {
777
+ "image": {
778
+ "type": "poster",
779
+ "size": "cover",
780
+ "height": 278,
781
+ "width": 185,
782
+ "url": "http://cf1.themoviedb.org/posters/511/4c9fa2365e73d6704b000511/transformers-revenge-of-the-fallen-cover.jpg",
783
+ "id": "4c9fa2365e73d6704b000511"
784
+ }
785
+ },
786
+ {
787
+ "image": {
788
+ "type": "poster",
789
+ "size": "thumb",
790
+ "height": 138,
791
+ "width": 92,
792
+ "url": "http://cf1.themoviedb.org/posters/511/4c9fa2365e73d6704b000511/transformers-revenge-of-the-fallen-thumb.jpg",
793
+ "id": "4c9fa2365e73d6704b000511"
794
+ }
795
+ }],
796
+ "backdrops": [{
797
+ "image": {
798
+ "type": "backdrop",
799
+ "size": "original",
800
+ "height": 1080,
801
+ "width": 1920,
802
+ "url": "http://cf1.themoviedb.org/backdrops/350/4bc92149017a3c57fe00d350/transformers-revenge-of-the-fallen-original.jpg",
803
+ "id": "4bc92149017a3c57fe00d350"
804
+ }
805
+ },
806
+ {
807
+ "image": {
808
+ "type": "backdrop",
809
+ "size": "poster",
810
+ "height": 439,
811
+ "width": 780,
812
+ "url": "http://cf1.themoviedb.org/backdrops/350/4bc92149017a3c57fe00d350/transformers-revenge-of-the-fallen-poster.jpg",
813
+ "id": "4bc92149017a3c57fe00d350"
814
+ }
815
+ },
816
+ {
817
+ "image": {
818
+ "type": "backdrop",
819
+ "size": "thumb",
820
+ "height": 169,
821
+ "width": 300,
822
+ "url": "http://cf1.themoviedb.org/backdrops/350/4bc92149017a3c57fe00d350/transformers-revenge-of-the-fallen-thumb.jpg",
823
+ "id": "4bc92149017a3c57fe00d350"
824
+ }
825
+ }],
826
+ "version": 241,
827
+ "last_modified_at": "2011-01-28 15:20:21"
828
+ },
829
+ {
830
+ "score": 4.9083095,
831
+ "popularity": 3,
832
+ "translated": true,
833
+ "adult": false,
834
+ "language": "en",
835
+ "original_name": "Transformers: Scramble City",
836
+ "name": "Transformers: Scramble City",
837
+ "alternative_name": null,
838
+ "movie_type": "movie",
839
+ "id": 20368,
840
+ "imdb_id": "tt0147625",
841
+ "url": "http://www.themoviedb.org/movie/20368",
842
+ "votes": 0,
843
+ "rating": 0.0,
844
+ "runtime": 0,
845
+ "certification": "",
846
+ "overview": "Taking place after the 2nd Season of Transformers (Generation 1) Scramble City gets its original story underway, as the Autobots are shown to be in the midst of constructing the powerful \"Scramble City,\" overseen by their newest arrival, Ultra Magnus. When the Decepticons learn of this, their combiner robots are deployed to attack, and a battle between them and their Autobot counterparts ensues.",
847
+ "released": "1900-01-01",
848
+ "posters": [{
849
+ "image": {
850
+ "type": "poster",
851
+ "size": "original",
852
+ "height": 227,
853
+ "width": 300,
854
+ "url": "http://cf1.themoviedb.org/posters/3a5/4bc9596a017a3c57fe0283a5/transformers-scramble-city-original.jpg",
855
+ "id": "4bc9596a017a3c57fe0283a5"
856
+ }
857
+ },
858
+ {
859
+ "image": {
860
+ "type": "poster",
861
+ "size": "mid",
862
+ "height": 378,
863
+ "width": 500,
864
+ "url": "http://cf1.themoviedb.org/posters/3a5/4bc9596a017a3c57fe0283a5/transformers-scramble-city-mid.jpg",
865
+ "id": "4bc9596a017a3c57fe0283a5"
866
+ }
867
+ },
868
+ {
869
+ "image": {
870
+ "type": "poster",
871
+ "size": "cover",
872
+ "height": 140,
873
+ "width": 185,
874
+ "url": "http://cf1.themoviedb.org/posters/3a5/4bc9596a017a3c57fe0283a5/transformers-scramble-city-cover.jpg",
875
+ "id": "4bc9596a017a3c57fe0283a5"
876
+ }
877
+ },
878
+ {
879
+ "image": {
880
+ "type": "poster",
881
+ "size": "thumb",
882
+ "height": 70,
883
+ "width": 92,
884
+ "url": "http://cf1.themoviedb.org/posters/3a5/4bc9596a017a3c57fe0283a5/transformers-scramble-city-thumb.jpg",
885
+ "id": "4bc9596a017a3c57fe0283a5"
886
+ }
887
+ }],
888
+ "backdrops": [],
889
+ "version": 15,
890
+ "last_modified_at": "2011-01-28 16:13:24"
891
+ }]
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ # Download the sample files from here:
4
+ # http://trac.opensubtitles.org/projects/opensubtitles/wiki/HashSourceCodes
5
+ # and uncomment these tests before making any changes
6
+ describe TMDBParty::MovieHasher do
7
+ # Not sure the best way to have tests for this without having real files to work with.
8
+ it "should compute hash" do
9
+ pending
10
+ File.open('breakdance.avi') do |file|
11
+ TMDBParty::MovieHasher.compute_hash(file).should == "8e245d9679d31e12"
12
+ end
13
+ end
14
+
15
+ it "should compute hash on large file" do
16
+ pending
17
+ File.open('dummy.bin') do |file|
18
+ TMDBParty::MovieHasher.compute_hash(file).should == "61f7751fc2a72bfb"
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'httparty'
3
2
 
4
3
  describe TMDBParty::Movie do
5
4
  before(:each) do
@@ -65,6 +65,24 @@ describe TMDBParty::Base do
65
65
  tmdb.get_info(1858, 'sv').should_not be_nil
66
66
  end
67
67
  end
68
+
69
+ describe "#get_info with file" do
70
+ it "should return a movie instance" do
71
+ file = mock("file")
72
+ file.should_receive(:size).and_return(742086656)
73
+ TMDBParty::MovieHasher.should_receive(:compute_hash).with(file).and_return("907172e7fe51ba57")
74
+ stub_get('/Media.getInfo/en/json/key/907172e7fe51ba57/742086656', 'transformers.json')
75
+ tmdb.get_file_info(file).should have(1).movies
76
+ end
77
+
78
+ it "should return empty array when no movie found" do
79
+ file = mock("file")
80
+ file.should_receive(:size).and_return("fake")
81
+ TMDBParty::MovieHasher.should_receive(:compute_hash).with(file).and_return("fake")
82
+ stub_get('/Media.getInfo/en/json/key/fake/fake', 'nothing_found.json')
83
+ tmdb.get_file_info(file).should == []
84
+ end
85
+ end
68
86
 
69
87
  describe "#search_person" do
70
88
  it "should return empty array when no people was found" do
@@ -114,4 +132,27 @@ describe TMDBParty::Base do
114
132
  tmdb.get_genres('sv').first.name.should == 'Action'
115
133
  end
116
134
  end
117
- end
135
+
136
+
137
+ describe "#browse" do
138
+ it "should return an empty array when no matches was found" do
139
+ stub_get('/Movie.browse/en/json/key?order=asc&order_by=title&query=NothingFound', 'nothing_found.json')
140
+
141
+ tmdb.browse(:query => 'NothingFound').should == []
142
+ end
143
+
144
+ it "should return an array of movies" do
145
+ stub_get('/Movie.browse/en/json/key?order=asc&order_by=title&query=Transformers', 'browse.json')
146
+
147
+ tmdb.browse(:query => 'Transformers').should have(12).movies
148
+ tmdb.browse(:query => 'Transformers').first.should be_instance_of(TMDBParty::Movie)
149
+ end
150
+
151
+ it "should use the preferred language" do
152
+ stub_get('/Movie.browse/en/json/key?order=asc&order_by=title&query=Transformers', 'shitty_shit_result.json')
153
+ stub_get('/Movie.browse/sv/json/key?order=asc&order_by=title&query=Transformers', 'browse.json')
154
+
155
+ tmdb.browse({:query => 'Transformers'}, 'sv').should have(12).movies
156
+ end
157
+ end
158
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tmdb_party}
8
- s.version = "0.8.0"
8
+ s.version = "0.9.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["John Duff", "Jon Maddox"]
12
- s.date = %q{2011-01-29}
12
+ s.date = %q{2011-03-12}
13
13
  s.email = %q{duff.john@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -22,18 +22,19 @@ Gem::Specification.new do |s|
22
22
  "Rakefile",
23
23
  "VERSION.yml",
24
24
  "lib/tmdb_party.rb",
25
- "lib/tmdb_party/attributes.rb",
26
25
  "lib/tmdb_party/cast_member.rb",
27
26
  "lib/tmdb_party/category.rb",
28
- "lib/tmdb_party/core_extensions.rb",
29
27
  "lib/tmdb_party/country.rb",
28
+ "lib/tmdb_party/extras/attributes.rb",
29
+ "lib/tmdb_party/extras/httparty_icebox.rb",
30
+ "lib/tmdb_party/extras/movie_hasher.rb",
30
31
  "lib/tmdb_party/genre.rb",
31
- "lib/tmdb_party/httparty_icebox.rb",
32
32
  "lib/tmdb_party/image.rb",
33
33
  "lib/tmdb_party/movie.rb",
34
34
  "lib/tmdb_party/person.rb",
35
35
  "lib/tmdb_party/studio.rb",
36
36
  "lib/tmdb_party/video.rb",
37
+ "spec/fixtures/browse.json",
37
38
  "spec/fixtures/genres_results.json",
38
39
  "spec/fixtures/imdb_no_results.json",
39
40
  "spec/fixtures/imdb_search.json",
@@ -48,6 +49,7 @@ Gem::Specification.new do |s|
48
49
  "spec/fixtures/transformers.json",
49
50
  "spec/lib/tmdb_party/cast_member_spec.rb",
50
51
  "spec/lib/tmdb_party/country_spec.rb",
52
+ "spec/lib/tmdb_party/extras/movie_hasher_spec.rb",
51
53
  "spec/lib/tmdb_party/genre_spec.rb",
52
54
  "spec/lib/tmdb_party/image_spec.rb",
53
55
  "spec/lib/tmdb_party/movie_spec.rb",
@@ -66,6 +68,7 @@ Gem::Specification.new do |s|
66
68
  s.test_files = [
67
69
  "spec/lib/tmdb_party/cast_member_spec.rb",
68
70
  "spec/lib/tmdb_party/country_spec.rb",
71
+ "spec/lib/tmdb_party/extras/movie_hasher_spec.rb",
69
72
  "spec/lib/tmdb_party/genre_spec.rb",
70
73
  "spec/lib/tmdb_party/image_spec.rb",
71
74
  "spec/lib/tmdb_party/movie_spec.rb",
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 8
7
+ - 9
8
8
  - 0
9
- version: 0.8.0
9
+ version: 0.9.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - John Duff
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-29 00:00:00 -05:00
18
+ date: 2011-03-12 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -75,18 +75,19 @@ files:
75
75
  - Rakefile
76
76
  - VERSION.yml
77
77
  - lib/tmdb_party.rb
78
- - lib/tmdb_party/attributes.rb
79
78
  - lib/tmdb_party/cast_member.rb
80
79
  - lib/tmdb_party/category.rb
81
- - lib/tmdb_party/core_extensions.rb
82
80
  - lib/tmdb_party/country.rb
81
+ - lib/tmdb_party/extras/attributes.rb
82
+ - lib/tmdb_party/extras/httparty_icebox.rb
83
+ - lib/tmdb_party/extras/movie_hasher.rb
83
84
  - lib/tmdb_party/genre.rb
84
- - lib/tmdb_party/httparty_icebox.rb
85
85
  - lib/tmdb_party/image.rb
86
86
  - lib/tmdb_party/movie.rb
87
87
  - lib/tmdb_party/person.rb
88
88
  - lib/tmdb_party/studio.rb
89
89
  - lib/tmdb_party/video.rb
90
+ - spec/fixtures/browse.json
90
91
  - spec/fixtures/genres_results.json
91
92
  - spec/fixtures/imdb_no_results.json
92
93
  - spec/fixtures/imdb_search.json
@@ -101,6 +102,7 @@ files:
101
102
  - spec/fixtures/transformers.json
102
103
  - spec/lib/tmdb_party/cast_member_spec.rb
103
104
  - spec/lib/tmdb_party/country_spec.rb
105
+ - spec/lib/tmdb_party/extras/movie_hasher_spec.rb
104
106
  - spec/lib/tmdb_party/genre_spec.rb
105
107
  - spec/lib/tmdb_party/image_spec.rb
106
108
  - spec/lib/tmdb_party/movie_spec.rb
@@ -146,6 +148,7 @@ summary: Simple ruby wrapper to themoviedb.org (http://api.themoviedb.org/2.0/do
146
148
  test_files:
147
149
  - spec/lib/tmdb_party/cast_member_spec.rb
148
150
  - spec/lib/tmdb_party/country_spec.rb
151
+ - spec/lib/tmdb_party/extras/movie_hasher_spec.rb
149
152
  - spec/lib/tmdb_party/genre_spec.rb
150
153
  - spec/lib/tmdb_party/image_spec.rb
151
154
  - spec/lib/tmdb_party/movie_spec.rb
@@ -1,18 +0,0 @@
1
- class Array
2
- def extract_options!
3
- last.is_a?(::Hash) ? pop : {}
4
- end
5
-
6
- end
7
-
8
- class Float
9
- def self.parse(val)
10
- Float(val)
11
- end
12
- end
13
-
14
- class Integer
15
- def self.parse(val)
16
- Integer(val)
17
- end
18
- end