ruby-imdb 0.7.0 → 0.7.1
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/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/imdb.rb +0 -1
- data/lib/imdb/movie.rb +12 -12
- data/lib/imdb/search.rb +2 -2
- data/lib/imdb/skeleton.rb +4 -5
- data/ruby-imdb.gemspec +2 -2
- metadata +3 -3
data/Rakefile
CHANGED
@@ -15,6 +15,7 @@ begin
|
|
15
15
|
s.add_dependency "mongo", ">= 1.0.1"
|
16
16
|
s.add_dependency "mongo_mapper", ">= 0.7.5"
|
17
17
|
s.add_dependency "chronic", ">= 0.2.3"
|
18
|
+
#s.add_dependency "rack", ">= 1.1.0"
|
18
19
|
end
|
19
20
|
rescue LoadError
|
20
21
|
puts "Jeweler not available. Install it with: gem install jeweler"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.1
|
data/lib/imdb.rb
CHANGED
data/lib/imdb/movie.rb
CHANGED
@@ -12,9 +12,9 @@ module IMDB
|
|
12
12
|
super("Movie", {:imdb_id => String,
|
13
13
|
:poster => String,
|
14
14
|
:title => String,
|
15
|
+
:release_date => String,
|
15
16
|
:cast => Array,
|
16
17
|
:photos => Array,
|
17
|
-
:release_date => String,
|
18
18
|
:director => String,
|
19
19
|
:genres => Array,
|
20
20
|
:writers => Array}, [:imdb_id])
|
@@ -51,21 +51,21 @@ module IMDB
|
|
51
51
|
# Get movie photos
|
52
52
|
# @return [Array]
|
53
53
|
def photos
|
54
|
-
|
55
|
-
|
56
|
-
img["src"]
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
54
|
+
begin
|
55
|
+
doc.search("img").map { |img|
|
56
|
+
unless img["src"][/_CR/].nil?
|
57
|
+
img["src"]
|
58
|
+
end
|
59
|
+
}
|
60
|
+
rescue
|
61
|
+
nil
|
62
|
+
end
|
62
63
|
end
|
63
64
|
|
64
65
|
# Get release date
|
65
66
|
# @return [String]
|
66
67
|
def release_date
|
67
|
-
Date.parse(Chronic.parse(doc.xpath("//h5[contains(., 'Release Date')]/..").first.content[/^\d{1,2} \w+ \d{4}/]).strftime('%Y/%m/%d'))
|
68
|
-
rescue nil
|
68
|
+
Date.parse(Chronic.parse(doc.xpath("//h5[contains(., 'Release Date')]/..").first.content[/^\d{1,2} \w+ \d{4}/]).strftime('%Y/%m/%d')).to_s rescue nil
|
69
69
|
end
|
70
70
|
|
71
71
|
# Get Director
|
@@ -90,7 +90,7 @@ module IMDB
|
|
90
90
|
doc.xpath("//a[@name='writers']/../../../..").search('a[@href^="/name/nm"]').map {|w|
|
91
91
|
name = w.content
|
92
92
|
profile = w['href']
|
93
|
-
IMDB::Person.new(@imdb_id, name, nil, profile, nil)
|
93
|
+
IMDB::Person.new(@imdb_id, name, "nil", profile, "nil")
|
94
94
|
}
|
95
95
|
end
|
96
96
|
|
data/lib/imdb/search.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module IMDB
|
2
|
-
class Search
|
2
|
+
class Search < IMDB::Skeleton
|
3
3
|
def self.movie(keyword)
|
4
4
|
doc = Nokogiri::HTML(open("http://www.imdb.com/find?s=tt&q=#{CGI.escape(keyword)}"))
|
5
5
|
ret_val = []
|
@@ -11,7 +11,7 @@ module IMDB
|
|
11
11
|
|
12
12
|
end # Search
|
13
13
|
|
14
|
-
class Result
|
14
|
+
class Result < IMDB::Skeleton
|
15
15
|
attr_accessor :id, :title, :link, :year
|
16
16
|
|
17
17
|
def initialize(id, title, link)
|
data/lib/imdb/skeleton.rb
CHANGED
@@ -28,14 +28,13 @@ module IMDB
|
|
28
28
|
end
|
29
29
|
|
30
30
|
if @db_query[meth].nil? or (@db_query[meth].length.zero? if @db_query[meth].kind_of?(Array))
|
31
|
-
|
32
31
|
a = send(old_meth)
|
33
32
|
if a.kind_of?(Array)
|
34
33
|
a.compact!
|
35
|
-
a.map! {
|
36
|
-
|
37
|
-
|
38
|
-
}
|
34
|
+
#a.map! {
|
35
|
+
# |c|
|
36
|
+
# c.to_hash
|
37
|
+
#}.compact
|
39
38
|
@db_query[meth] = a
|
40
39
|
else
|
41
40
|
@db_query[meth] = a
|
data/ruby-imdb.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruby-imdb}
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Yalcin Acikyildiz"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-30}
|
13
13
|
s.description = %q{Ruby IMDB Parsing Library}
|
14
14
|
s.email = %q{yalcin@webliyacelebi.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 0.7.
|
8
|
+
- 1
|
9
|
+
version: 0.7.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Yalcin Acikyildiz
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-30 00:00:00 +03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|