osdb 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ end
10
10
  begin
11
11
  require 'echoe'
12
12
 
13
- Echoe.new('osdb', '0.0.3') do |p|
13
+ Echoe.new('osdb', '0.0.4') do |p|
14
14
  p.description = "Ruby library to access OSDb services like OpenSubtitles.org"
15
15
  p.url = "http://github.com/byroot/ruby-osdb"
16
16
  p.author = "Jean Boussier"
data/bin/getsub CHANGED
@@ -85,9 +85,9 @@ end
85
85
  def select_sub(subs)
86
86
  return subs.first if subs.length == 1
87
87
  movies = group_by_movie_name(subs)
88
- return movies.values.first.max(&:rating) if movies.length == 1
88
+ return movies.values.first.max if movies.length == 1
89
89
  selected_movie_subs = ask_user_to_identify_movie(movies)
90
- selected_movie_subs.max(&:rating)
90
+ selected_movie_subs.max
91
91
  end
92
92
 
93
93
  movies = ARGV.map{ |path| OSDb::Movie.new(path) }
data/lib/osdb/sub.rb CHANGED
@@ -10,11 +10,15 @@ module OSDb
10
10
  @url = URI.parse(data['SubDownloadLink'])
11
11
  @format = data['SubFormat']
12
12
  @language = Language.from_iso639_2b(data['SubLanguageID'])
13
- @rating = data['SubRating']
13
+ @rating = data['SubRating'].to_f
14
14
  @movie_name = data['MovieName']
15
15
  @raw_data = data
16
16
  end
17
17
 
18
+ def <=>(other)
19
+ rating <=> other.rating
20
+ end
21
+
18
22
  end
19
23
 
20
24
  end
data/osdb.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{osdb}
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jean Boussier"]
9
9
  s.cert_chain = ["/Users/byroot/.ssh/gem-public_cert.pem"]
10
- s.date = %q{2010-10-17}
10
+ s.date = %q{2010-10-30}
11
11
  s.default_executable = %q{getsub}
12
12
  s.description = %q{Ruby library to access OSDb services like OpenSubtitles.org}
13
13
  s.email = %q{jean.boussier @nospam@ gmail.com}
@@ -2,14 +2,18 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe OSDb::Sub do
4
4
 
5
- subject do
6
- OSDb::Sub.new(
5
+ before :each do
6
+ @response = {
7
7
  'SubFormat' => 'srt',
8
8
  'SubDownloadLink' => 'http://example.com/foo.srt.gz',
9
- 'SubRating' => 7.89,
9
+ 'SubRating' => '7.89',
10
10
  'SubLanguageID' => 'dut',
11
11
  'MovieName' => 'Lock, Stock and Two Smoking Barrels'
12
- )
12
+ }
13
+ end
14
+
15
+ subject do
16
+ OSDb::Sub.new @response
13
17
  end
14
18
 
15
19
  its(:format) { should == 'srt' }
@@ -22,4 +26,8 @@ describe OSDb::Sub do
22
26
 
23
27
  its(:movie_name) { should == 'Lock, Stock and Two Smoking Barrels' }
24
28
 
29
+ it 'should be comparable' do
30
+ [subject, OSDb::Sub.new(@response.merge('SubRating' => '2.45'))].max.should == subject
31
+ end
32
+
25
33
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osdb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jean Boussier
@@ -36,7 +36,7 @@ cert_chain:
36
36
  V/TAGOVlGVotOBnewCUdlw==
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2010-10-17 00:00:00 +02:00
39
+ date: 2010-10-30 00:00:00 +02:00
40
40
  default_executable:
41
41
  dependencies: []
42
42
 
metadata.gz.sig CHANGED
Binary file