myimdb 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,30 +8,55 @@ Utility gem for fetching movie details.
8
8
 
9
9
  ==== Command line info for a movie
10
10
 
11
- ~> myimdb the dark knight
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 : 420667
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 unleashed by an anarchist mastermind known only as the Joker, as it drives each of them to their limits.
28
+ Plot : Batman, Gordon and Harvey Dent are forced to deal with the chaos (truncated)...
22
29
  Year : 2008
23
- Release Date : 2008-07-18
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
- "Fetching metadata for: the dark knight"
32
- "Renaming: the dark knight to: the dark knight [2008] [8.9,420667] [Christopher Nolan]"
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
- => {"GsearchResultClass"=>"GwebSearch", "title"=>"<b>The Dark Knight</b> (2008)", "url"=>"http://www.imdb.com/title/tt0468569/", "cacheUrl"=>"http://www.google.com/search?q=cache:6zAp1ivBuzEJ:www.imdb.com", "content"=>"Directed by Christopher Nolan. With Christian Bale, Heath Ledger, Aaron Eckhart. Batman, Gordon and Harvey Dent are forced to deal with the chaos unleashed <b>...</b>", "visibleUrl"=>"www.imdb.com", "unescapedUrl"=>"http://www.imdb.com/title/tt0468569/", "titleNoFormatting"=>"The Dark Knight (2008)"}
43
- >> site = Myimdb::Scraper::Imdb.new(search_result['url'])
44
- => #<Myimdb::Scraper::Imdb:0x1023a2e80 @url="http://www.imdb.com/title/tt0468569/">
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
- => 420667
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
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)
@@ -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 search(engine, text, options)
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 = search(engine, text, options)
21
+ result = _search(engine, text, options)
22
22
  return result unless result.nil? or result.empty?
23
23
  end
24
24
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{myimdb}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gaurav"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myimdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gaurav