undertexter 0.0.4 → 0.0.5

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- undertexter (0.0.3)
4
+ undertexter (0.0.4)
5
5
  nokogiri
6
6
  rest-client
7
7
 
data/lib/subtitle.rb CHANGED
@@ -6,7 +6,7 @@ class Subtitle
6
6
  end
7
7
 
8
8
  def url
9
- "http://www.undertexter.se/utext.php?id=#{id}"
9
+ @language == :english ? "http://eng.undertexter.se/subtitle.php?id=#{id}" : "http://www.undertexter.se/utext.php?id=#{id}"
10
10
  end
11
11
 
12
12
  private
data/lib/undertexter.rb CHANGED
@@ -10,7 +10,8 @@ class Undertexter
10
10
  :language => {
11
11
  :swedish => 'soek',
12
12
  :english => 'eng_search'
13
- }
13
+ },
14
+ :preferred_language => options[:language]
14
15
  }
15
16
 
16
17
  # If a non existing language is being used, swedish will be the default
@@ -79,7 +80,8 @@ class Undertexter
79
80
  :downloads => movie[1].match(/\d+$/)[0].to_i,
80
81
  :title => movie[2],
81
82
  :details => movie[3],
82
- :movie_title => movie[4]
83
+ :movie_title => movie[4],
84
+ :language => @options[:preferred_language]
83
85
  })
84
86
  end
85
87
  end
@@ -1,3 +1,3 @@
1
1
  module Undertexter
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -91,15 +91,22 @@ end
91
91
 
92
92
  describe Undertexter, "should work when trying to fetch some english subtitles" do
93
93
  it "should return at least 48 subtitles" do
94
- Undertexter.should have_at_least(48).find("tt0840361", {:language => :english})
94
+ Undertexter.should have_at_least(48).find("tt0840361", :language => :english)
95
95
  end
96
96
 
97
97
  it "should return at least 8 subtitles" do
98
- Undertexter.should have_at_least(8).find("tt0840361", {:language => :swedish})
98
+ Undertexter.should have_at_least(8).find("tt0840361", :language => :swedish)
99
99
  end
100
100
 
101
101
  it "should return at least 8 subtitles" do
102
- Undertexter.should have_at_least(8).find("tt0840361", {:language => :strange})
102
+ Undertexter.should have_at_least(8).find("tt0840361", :language => :strange)
103
+ end
104
+
105
+ it "should return the right url when trying to fetch an english sub" do
106
+ Undertexter.find("tt0840361", :language => :english).first.url.should match(/http:\/\/eng\.undertexter\.se\/subtitle\.php\?id=\d+/)
107
+ end
108
+
109
+ it "should return the right url when trying to fetch an swedish sub" do
110
+ Undertexter.find("tt0840361", :language => :swedish).first.url.should match(/http:\/\/www\.undertexter\.se\/utext\.php\?id=\d+/)
103
111
  end
104
- # http://www.undertexter.se/www.php?www=http://engsub.net/?p=subtitle&id=92097
105
112
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: undertexter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
4
+ hash: 21
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Linus Oleander
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-23 00:00:00 +01:00
18
+ date: 2011-01-25 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  requirements: []
113
113
 
114
114
  rubyforge_project: undertexter
115
- rubygems_version: 1.4.2
115
+ rubygems_version: 1.3.7
116
116
  signing_key:
117
117
  specification_version: 3
118
118
  summary: A subtitle search client for undertexter.se