myimdb 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +45 -21
- data/VERSION +1 -1
- data/bin/myimdb +6 -5
- data/lib/myimdb/search/base.rb +2 -2
- data/myimdb.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -8,30 +8,55 @@ Utility gem for fetching movie details.
|
|
8
8
|
|
9
9
|
==== Command line info for a movie
|
10
10
|
|
11
|
-
~> myimdb
|
11
|
+
~> myimdb
|
12
|
+
Usage: myimdb [movie name]
|
13
|
+
-h, --help Displays this help info
|
14
|
+
-r, --rottentomatoes Generates data from Rotten Tomatoes
|
15
|
+
-m, --metacritic Generates data from Metacritic
|
16
|
+
-b, --freebase Generates data from Freebase
|
17
|
+
-i, --imdb Generates data from Imdb
|
18
|
+
~> myimdb the dark knight -i -b
|
12
19
|
====================================================
|
13
20
|
Imdb details for: the dark knight
|
14
21
|
====================================================
|
15
22
|
Directors : Christopher Nolan
|
16
23
|
Writers : Jonathan Nolan, Christopher Nolan
|
17
24
|
Rating : 8.9
|
18
|
-
Votes :
|
25
|
+
Votes : 430594
|
19
26
|
Genres : Action, Crime, Drama, Thriller
|
20
27
|
Tagline : Why So Serious?
|
21
|
-
Plot : Batman, Gordon and Harvey Dent are forced to deal with the chaos
|
28
|
+
Plot : Batman, Gordon and Harvey Dent are forced to deal with the chaos (truncated)...
|
22
29
|
Year : 2008
|
23
|
-
|
30
|
+
Release_date : 2008-07-18
|
31
|
+
====================================================
|
32
|
+
Freebase details for: the dark knight
|
33
|
+
====================================================
|
34
|
+
Directors : Christopher Nolan
|
35
|
+
Writers : Bob Kane, Christopher Nolan, Jonathan Nolan, Jerry Robinson, Bill Finger
|
36
|
+
Rating :
|
37
|
+
Votes :
|
38
|
+
Genres : Superhero, Action, Crime fiction, Evil clown
|
39
|
+
Tagline : Welcome to a world without rules.
|
40
|
+
Plot : The Dark Knight is a 2008 superhero crime thriller film directed (truncated)...
|
41
|
+
Year : 2008
|
42
|
+
Release_date : 2008-07-16
|
24
43
|
|
25
44
|
|
26
45
|
==== Catalogue a movie directory
|
27
46
|
|
28
47
|
~/m> ls
|
29
48
|
the dark knight
|
49
|
+
~/m> myimdb-catalogue
|
50
|
+
Usage: myimdb-catalogue [movie name]
|
51
|
+
-h, --help Displays this help info
|
52
|
+
-f, --force Force generate data even if already present
|
53
|
+
-m, --metadata Generates metadata (renames folders)
|
54
|
+
-i, --images Generates images (works properly only on windows)
|
55
|
+
-r, --recursive Generate data on all the directories given in current directory
|
56
|
+
-a, --apply-icon Finds first jpg or png in the folder and converts it to movie icon
|
30
57
|
~/m> myimdb-catalogue the\ dark\ knight/
|
31
|
-
|
32
|
-
|
33
|
-
~/m> ls
|
34
|
-
the dark knight [2008] [8.9,420667] [Christopher Nolan]
|
58
|
+
Fetching metadata for: the dark knight
|
59
|
+
Renaming: the dark knight to: the dark knight [2008] [8.9,430594] [Christopher Nolan]
|
35
60
|
|
36
61
|
|
37
62
|
==== As a library
|
@@ -39,26 +64,25 @@ Utility gem for fetching movie details.
|
|
39
64
|
>> require 'myimdb'
|
40
65
|
=> true
|
41
66
|
>> search_result = Myimdb::Search::Google.search_text('the dark knight', :restrict_to=> 'imdb.com')[0]
|
42
|
-
=> {
|
43
|
-
>> site = Myimdb::Scraper::Imdb.new(search_result[
|
44
|
-
=> #<Myimdb::Scraper::Imdb:
|
67
|
+
=> {:url=>"http://www.imdb.com/title/tt0468569/", :title=>"The Dark Knight (2008)"}
|
68
|
+
>> site = Myimdb::Scraper::Imdb.new(search_result[:url])
|
69
|
+
=> #<Myimdb::Scraper::Imdb:0x10227b160 @url="http://www.imdb.com/title/tt0468569/">
|
45
70
|
>> site.rating
|
46
71
|
=> 8.9
|
47
72
|
>> site.votes
|
48
|
-
=>
|
73
|
+
=> 430594
|
49
74
|
>> site.release_date.to_s
|
50
75
|
=> "2008-07-18"
|
51
76
|
|
77
|
+
or
|
78
|
+
|
79
|
+
>> require 'myimdb'
|
80
|
+
=> true
|
81
|
+
>> movie = ImdbMovie.search('the dark knight')
|
82
|
+
=> #<Myimdb::Scraper::Imdb:0x10225b9f0 @url="http://www.imdb.com/title/tt0468569/">
|
83
|
+
>> movie.rating
|
84
|
+
=> 8.9
|
52
85
|
|
53
|
-
== Note on Patches/Pull Requests
|
54
|
-
|
55
|
-
* Fork the project.
|
56
|
-
* Make your feature addition or bug fix.
|
57
|
-
* Add tests for it. This is important so I don't break it in a
|
58
|
-
future version unintentionally.
|
59
|
-
* Commit, do not mess with rakefile, version, or history.
|
60
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
61
|
-
* Send me a pull request. Bonus points for topic branches.
|
62
86
|
|
63
87
|
== Copyright
|
64
88
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/bin/myimdb
CHANGED
@@ -36,16 +36,17 @@ OptionParser.new do |opts|
|
|
36
36
|
puts opts
|
37
37
|
exit 1
|
38
38
|
end
|
39
|
+
|
40
|
+
# need a movie name
|
41
|
+
if ARGV.empty?
|
42
|
+
puts opts
|
43
|
+
exit(0)
|
44
|
+
end
|
39
45
|
end
|
40
46
|
|
41
47
|
# add imdb as default
|
42
48
|
options.merge!(:imdb=> true) if options.empty?
|
43
49
|
|
44
|
-
# need a movie name
|
45
|
-
if ARGV.empty?
|
46
|
-
abort "Movie name required - exiting"
|
47
|
-
end
|
48
|
-
|
49
50
|
name = ARGV.join(' ')
|
50
51
|
|
51
52
|
def details(klass_name, name)
|
data/lib/myimdb/search/base.rb
CHANGED
@@ -12,13 +12,13 @@ module Myimdb
|
|
12
12
|
def search( text, options )
|
13
13
|
engines = [Myimdb::Search::Google, Myimdb::Search::Bing]
|
14
14
|
|
15
|
-
def
|
15
|
+
def _search(engine, text, options)
|
16
16
|
engine.search_text(text, options)
|
17
17
|
end
|
18
18
|
|
19
19
|
engines.each do |engine|
|
20
20
|
puts "Retrying using #{engine}" unless engines.index(engine) == 0
|
21
|
-
result =
|
21
|
+
result = _search(engine, text, options)
|
22
22
|
return result unless result.nil? or result.empty?
|
23
23
|
end
|
24
24
|
end
|
data/myimdb.gemspec
CHANGED