unified_db 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -1
- data/lib/extensions/imdb.rb +1 -1
- data/lib/unified_db/version.rb +1 -1
- data/spec/unified_db/backend/imdb_spec.rb +18 -17
- metadata +49 -19
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
# Unified Movie Database
|
1
|
+
# Unified Movie Database
|
2
|
+
[![Build Status](https://travis-ci.org/imanel/UnifiedDB.png)](http://travis-ci.org/imanel/UnifiedDB)
|
2
3
|
|
3
4
|
This is project for unifying multiple movie database. Currently it support only IMDB and TVDB, but TMDB will be done shortly.
|
data/lib/extensions/imdb.rb
CHANGED
@@ -4,7 +4,7 @@ module Imdb
|
|
4
4
|
class Search < MovieList
|
5
5
|
|
6
6
|
def self.query(query)
|
7
|
-
open("http://anonymouse.org/cgi-bin/anon-www.cgi/http://akas.imdb.com/find?q=#{CGI::escape(query)}
|
7
|
+
open("http://anonymouse.org/cgi-bin/anon-www.cgi/http://akas.imdb.com/find?q=#{CGI::escape(query)}&s=tt")
|
8
8
|
end
|
9
9
|
|
10
10
|
def parse_movie
|
data/lib/unified_db/version.rb
CHANGED
@@ -14,9 +14,9 @@ describe UnifiedDB::Backend::IMDB do
|
|
14
14
|
|
15
15
|
first_result = result[:result].first
|
16
16
|
first_result.class.should eql(UnifiedDB::Result::Title)
|
17
|
-
first_result.id.should eql('
|
18
|
-
first_result.title.should eql('The Dark Knight')
|
19
|
-
first_result.year.should eql('
|
17
|
+
first_result.id.should eql('tt1345836')
|
18
|
+
first_result.title.should eql('The Dark Knight Rises')
|
19
|
+
first_result.year.should eql('2012')
|
20
20
|
|
21
21
|
encoded = Yajl::Encoder.new.encode result
|
22
22
|
decoded = Yajl::Parser.new.parse encoded
|
@@ -30,20 +30,21 @@ describe UnifiedDB::Backend::IMDB do
|
|
30
30
|
|
31
31
|
first_result = decoded['result'].first
|
32
32
|
first_result.class.should eql(Hash)
|
33
|
-
first_result['id'].should eql('
|
34
|
-
first_result['title'].should eql('The Dark Knight')
|
35
|
-
first_result['year'].should eql('
|
33
|
+
first_result['id'].should eql('tt1345836')
|
34
|
+
first_result['title'].should eql('The Dark Knight Rises')
|
35
|
+
first_result['year'].should eql('2012')
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
38
|
+
# It's impossible to get empty array - they have some crazy matcher with nonsense queries
|
39
|
+
# it "should return empty array if invalid find by title specified" do
|
40
|
+
# result = subject.find(:title => "qwertyuiopasdfghjkllzxcvbnm")
|
41
|
+
# result.class.should eql(Hash)
|
42
|
+
# do_sort(result.keys).should eql([:result, :service, :status])
|
43
|
+
# result[:status].should eql('success')
|
44
|
+
# result[:service].should eql('imdb')
|
45
|
+
# result[:result].class.should eql(Array)
|
46
|
+
# result[:result].size.should eql(0)
|
47
|
+
# end
|
47
48
|
|
48
49
|
|
49
50
|
it "should return valid find by id" do
|
@@ -59,13 +60,13 @@ describe UnifiedDB::Backend::IMDB do
|
|
59
60
|
result[:result].overview.class.should eql(String)
|
60
61
|
result[:result].overview.length.should be > 20
|
61
62
|
result[:result].release_date.class.should eql(String)
|
62
|
-
result[:result].genres.should eql(["
|
63
|
+
result[:result].genres.should eql(["Crime", "Drama", "Thriller"])
|
63
64
|
result[:result].rating.class.should eql(String)
|
64
65
|
result[:result].rating.to_f.should be > 4
|
65
66
|
result[:result].rating.to_f.should be < 10
|
66
67
|
result[:result].runtime.should eql("152")
|
67
68
|
result[:result].actors.class.should eql(Array)
|
68
|
-
result[:result].actors.first.should eql({"Christian Bale" => "Bruce Wayne
|
69
|
+
result[:result].actors.first.should eql({"Christian Bale" => "Bruce Wayne"})
|
69
70
|
result[:result].directors.should eql(["Christopher Nolan"])
|
70
71
|
result[:result].writers.should eql(["Jonathan Nolan", "Christopher Nolan"])
|
71
72
|
result[:result].posters.class.should eql(Array)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unified_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yajl-ruby
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,54 +21,79 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: imdb
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
|
-
- - =
|
35
|
+
- - '='
|
31
36
|
- !ruby/object:Gem::Version
|
32
37
|
version: 0.6.8
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - '='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.6.8
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: httparty
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
|
-
- - =
|
51
|
+
- - '='
|
42
52
|
- !ruby/object:Gem::Version
|
43
53
|
version: 0.8.1
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.8.1
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: imdb_party
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
|
-
- - =
|
67
|
+
- - '='
|
53
68
|
- !ruby/object:Gem::Version
|
54
69
|
version: 0.6.1
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - '='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.6.1
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: tvdb_party
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
|
-
- - =
|
83
|
+
- - '='
|
64
84
|
- !ruby/object:Gem::Version
|
65
85
|
version: 0.6.2
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - '='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.6.2
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: rspec
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ~>
|
@@ -76,7 +101,12 @@ dependencies:
|
|
76
101
|
version: '2.0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '2.0'
|
80
110
|
description: Scrapper for multiple Movie Databases
|
81
111
|
email:
|
82
112
|
- bernard.potocki@imanel.org
|
@@ -126,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
156
|
version: '0'
|
127
157
|
requirements: []
|
128
158
|
rubyforge_project:
|
129
|
-
rubygems_version: 1.8.
|
159
|
+
rubygems_version: 1.8.24
|
130
160
|
signing_key:
|
131
161
|
specification_version: 3
|
132
162
|
summary: Scrapper for multiple Movie Databases
|