undertexter 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.markdown +107 -76
  2. data/undertexter.gemspec +3 -3
  3. metadata +5 -36
data/README.markdown CHANGED
@@ -1,99 +1,133 @@
1
1
  # Undertexter
2
+
2
3
  ## What is Undertexter?
3
4
 
4
- Undertexter provides a basic search client that makes it possible to search for swedish and english subtitles on [Undertexter.se](http://undertexter.se)
5
+ *Undertexter* provides a basic API for [Undertexter.se](http://undertexter.se)
5
6
 
6
7
  *Support for other subtitles sites will be added in the future. Follow this project to know when.*
7
8
 
9
+ Follow me on [Twitter](http://twitter.com/linusoleander) or [Github](https://github.com/oleander/) for more info and updates.
10
+
8
11
  ## How to use
9
12
 
10
- ### Find a subtitle based on any string
13
+ ### Find a subtitle
11
14
 
12
- The find methods takes any string, including an IMDB id.
13
- This is how to use it in `irb`.
15
+ Pass an imdb id.
16
+
17
+ ```` ruby
18
+ subtite = Undertexter.find("tt0840361").first
14
19
 
15
- $ require 'undertexter'
16
- # => true
17
-
18
- $ subtite = Undertexter.find("tt0840361").first
19
- => #<SContainer::Subtitle:0x1020fff98 @downloads=8328, @movie_title="The Town", @title="The.Town.2010....BRRip", @url="http://www.undertexter.se/?p=undertext&id=23711", @cds=1>
20
- $ subtitle.downloads
21
- => 8328
22
- $ subtitle.movie_title
23
- => "The Town"
24
- $ subtitle.title
25
- => "The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC"
26
- $ subtitle.url
27
- = "http://www.undertexter.se/utext.php?id=23711"
28
- $ subtitle.details
29
- => "http://www.undertexter.se/?p=undertext&id=23711"
30
-
31
- $ Undertexter.find("die hard").count
32
- => 41
20
+ subtitle.downloads
21
+ # => 8328
22
+ subtitle.movie_title
23
+ # => "The Town"
24
+ subtitle.title
25
+ # => "The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC"
26
+ subtitle.url
27
+ # => "http://www.undertexter.se/utext.php?id=23711"
28
+ subtitle.details
29
+ # => "http://www.undertexter.se/?p=undertext&id=23711"
30
+ ````
33
31
 
34
- ### Find a subtitle with in centrain language
35
-
36
- $ Undertexter.find("tt0840361", :language => :english).count
37
- => 48
38
- $ Undertexter.find("tt0840361", :language => :swedish).count
39
- => 8
32
+ Pass any string.
40
33
 
41
- ### Download the subtitle to disk
34
+ ```` ruby
35
+ Undertexter.find("die hard").count
36
+ # => 41
37
+ ````
42
38
 
43
- $ Undertexter.find("tt0840361").first.download!
44
- => "/tmp/The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC.rar"
45
- $ File.exists?("/tmp/The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC.rar")
46
- => true
47
-
48
- ### Download the subtitle to a specified destination folder, both relative and absolute
49
-
50
- $ Undertexter.find("tt0840361").first.download!(:to => /some/dir)
51
- => "/some/dir/The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC.rar"
52
-
53
- $ Dir.pwd
54
- => /Users/linus/Downloads
55
- $ Undertexter.find("tt0840361").first.download!(:to => 'my_dir')
56
- => "/Users/linus/Downloads/my_dir/The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC.rar"
57
-
58
- ### Find the right subtitle based on the **release name** of the movie
59
-
60
- $ Undertexter.find("tt0840361").based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS")
61
- => #<SContainer::Subtitle:0x00000101b739d0 @cds=1, @downloads=1644, @title="The.Town.EXTENDED.2010.480p.BRRip.XviD.AC3-FLAWL3SS", @details="http://www.undertexter.se/?p=undertext&id=23752", @movie_title="The Town", @language=:swedish>
62
-
63
- ### Specify how sensitive the `based_on` method should be, from `0.0` to `1.0`
64
-
65
- $ Undertexter.find("tt0840361").based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS", limit: 0.0)
66
- => nil
67
-
68
- $ Undertexter.find("tt0840361").based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS", limit: 0.4)
69
- => #<SContainer::Subtitle:0x00000101b8d808 @cds=1, @downloads=1644, @title="The.Town.EXTENDED.2010.480p.BRRip.XviD.AC3-FLAWL3SS", @details="http://www.undertexter.se/?p=undertext&id=23752", @movie_title="The Town", @language=:swedish>
70
-
71
- $ Undertexter.find("tt0840361").based_on("The.Town.EXTENDED.2010.480p.BRRip.XviD.AC3-FLAWL3SS", limit: 0.0)
72
- => #<SContainer::Subtitle:0x00000101b8d718 @cds=1, @downloads=1644, @title="The.Town.EXTENDED.2010.480p.BRRip.XviD.AC3-FLAWL3SS", @details="http://www.undertexter.se/?p=undertext&id=23752", @movie_title="The Town", @language=:swedish>
39
+ ### Specify a language
40
+
41
+ ```` ruby
42
+ Undertexter.find("tt0840361", :language => :english).count
43
+ # => 48
44
+
45
+ Undertexter.find("tt0840361", :language => :swedish).count
46
+ # => 8
47
+ ````
48
+
49
+ ### Download subtitle to disk
50
+
51
+ Download to `/tmp`.
52
+
53
+ ```` ruby
54
+ Undertexter.find("tt0840361").first.download!
55
+ # => "/tmp/The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC.rar"
56
+
57
+ File.exists?("/tmp/The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC.rar")
58
+ # => true
59
+ ````
60
+
61
+ Specify an absolut path.
62
+
63
+ ```` ruby
64
+ Undertexter.find("tt0840361").first.download!(:to => /some/dir)
65
+ # => "/some/dir/The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC.rar"
66
+ ````
67
+
68
+ Specify a relative path.
69
+
70
+ ```` ruby
71
+ Dir.pwd
72
+ # => /Users/linus/Downloads
73
+ Undertexter.find("tt0840361").first.download!(:to => 'my_dir')
74
+ # => "/Users/linus/Downloads/my_dir/The.Town.2010.EXTENDED.480p.BRRip.XviD-NYDIC.rar"
75
+ ````
76
+
77
+ ### Find subtitle based on a release name
78
+
79
+ ```` ruby
80
+ Undertexter.find("tt0840361").based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS")
81
+ ````
82
+
83
+ ### Sensitive
84
+
85
+ Specify how sensitive the `based_on` method should be, from `0.0` to `1.0`.
86
+
87
+ ```` ruby
88
+ Undertexter.find("tt0840361").based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS", limit: 0.0)
89
+ # => nil
90
+ ````
91
+
92
+ ```` ruby
93
+ Undertexter.find("tt0840361").based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS", limit: 0.4)
94
+ # => #<SContainer::Subtitle:0x00000101b8d808 @cds=1, @downloads=1644, @title="The.Town.EXTENDED.2010.480p.BRRip.XviD.AC3-FLAWL3SS", @details="http://www.undertexter.se/?p=undertext&id=23752", @movie_title="The Town", @language=:swedish>
95
+ ````
96
+
97
+ ```` ruby
98
+ Undertexter.find("tt0840361").based_on("The.Town.EXTENDED.2010.480p.BRRip.XviD.AC3-FLAWL3SS", limit: 0.0)
99
+ # => #<SContainer::Subtitle:0x00000101b8d718 @cds=1, @downloads=1644, @title="The.Town.EXTENDED.2010.480p.BRRip.XviD.AC3-FLAWL3SS", @details="http://www.undertexter.se/?p=undertext&id=23752", @movie_title="The Town", @language=:swedish>
100
+ ````
73
101
 
74
102
  ## What is being returned?
75
103
 
76
- The find method returns an `Array` with zero or more `SContainer::Subtitle` instances. Every object provides some basic accessors.
104
+ The `find` method returns an `Array` with zero or more `Container::Subtitle` instances with some basic accessors.
77
105
 
78
106
  - `movie_title` (String) The official name of the movie.
79
- - `cds` (Integer) The amount of cds that the release should contain.
107
+ - `cds` (Fixnum) The amount of cds that the release should contain.
80
108
  - `title` (String) The release name of the subtitle, should have the same name as the downloaded movie.
81
- - `downloads` (Integer) The amount of downloads for this particular subtitle.
82
- - `url` (String) A direct link to the subtitle file, a rar file for example
83
- - `details` (String) A link to the details page for the subtitle
84
- - `download!` (String) The absolut path to the downloaded subtitle
109
+ - `downloads` (Fixnum) The amount of downloads for this particular subtitle.
110
+ - `url` (String) A direct link to the subtitle file, a rar file for example.
111
+ - `details` (String) A link to the details page for the subtitle.
112
+ - `download!` (String) The absolut path to the downloaded subtitle.
113
+
114
+ ## Options to pass
85
115
 
86
- ## Some optional options
116
+ ### `find` method
87
117
 
88
- ### The `find` method
118
+ Take a look at the *Specify a language* part for more info.
89
119
 
90
120
  - **:language** (Symbol) The language of the subtitle. Default is `:swedish`, the other option is `:english`.
91
121
 
92
- ### The `download!` method on the subtitle object
122
+ ### `download!` method
123
+
124
+ Take a look at the *Download subtitle to disk* part for more info.
93
125
 
94
126
  - **:to** (String) The absolut or relative path to where the downloaded file will be placed. Default is `/tmp`
95
127
 
96
- ### The `based_on` method on any array that is being returned from `Undertexter`
128
+ ### `based_on` method
129
+
130
+ Take a look at the *Find subtitle based on a release name* path for more info.
97
131
 
98
132
  - **:limit** (Float) The sensitivity of the method, where `0.0` is a perfect match and `1.0` is don't care. If this is set to high the method will return nil. Default is `0.4`. Read more about the [levenshtein](http://en.wikipedia.org/wiki/Levenshtein_distance) algorithm that is being used [here](http://www.erikveen.dds.nl/levenshtein/doc/index.html).
99
133
 
@@ -105,13 +139,10 @@ The find method returns an `Array` with zero or more `SContainer::Subtitle` inst
105
139
 
106
140
  Add `gem 'undertexter'` to your Gemfile and run `bundle`.
107
141
 
108
- ## How to help
142
+ ## Requirements
109
143
 
110
- - Start by copying the project or make your own branch.
111
- - Navigate to the root path of the project and run `bundle`.
112
- - Start by running all tests using rspec, `rspec spec/undertexter_spec.rb`.
113
- - Implement your own code, write some tests, commit and do a pull request.
144
+ *Undertexter* is tested in Mac OS X 10.6.6, 10.6.7 using Ruby 1.8.7, 1.9.2.
114
145
 
115
- ## Requirements
146
+ ## License
116
147
 
117
- Undertexter is tested on OS X 10.6.6 using Ruby 1.8.7 and 1.9.2.
148
+ *Undertexter* is released under the *MIT license*.
data/undertexter.gemspec CHANGED
@@ -3,13 +3,13 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "undertexter"
6
- s.version = "0.1.7"
6
+ s.version = "0.1.8"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Linus Oleander"]
9
9
  s.email = ["linus@oleander.nu"]
10
10
  s.homepage = "https://github.com/oleander/Undertexter"
11
- s.summary = %q{A subtitle search client for undertexter.se}
12
- s.description = %q{A subtitle search client to search for swedish subtitles on undertexter.se}
11
+ s.summary = %q{A basic API for Undertexter.se}
12
+ s.description = %q{A basic API for Undertexter.se.}
13
13
 
14
14
  s.rubyforge_project = "undertexter"
15
15
 
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: undertexter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 7
10
- version: 0.1.7
5
+ version: 0.1.8
11
6
  platform: ruby
12
7
  authors:
13
8
  - Linus Oleander
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-03-13 00:00:00 +01:00
13
+ date: 2011-05-03 00:00:00 +02:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,9 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
24
  version: "0"
33
25
  type: :runtime
34
26
  version_requirements: *id001
@@ -40,9 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
35
  version: "0"
47
36
  type: :runtime
48
37
  version_requirements: *id002
@@ -54,9 +43,6 @@ dependencies:
54
43
  requirements:
55
44
  - - ">="
56
45
  - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
46
  version: "0"
61
47
  type: :runtime
62
48
  version_requirements: *id003
@@ -68,9 +54,6 @@ dependencies:
68
54
  requirements:
69
55
  - - ">="
70
56
  - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
57
  version: "0"
75
58
  type: :runtime
76
59
  version_requirements: *id004
@@ -82,11 +65,6 @@ dependencies:
82
65
  requirements:
83
66
  - - "="
84
67
  - !ruby/object:Gem::Version
85
- hash: 31
86
- segments:
87
- - 2
88
- - 4
89
- - 0
90
68
  version: 2.4.0
91
69
  type: :development
92
70
  version_requirements: *id005
@@ -98,13 +76,10 @@ dependencies:
98
76
  requirements:
99
77
  - - ">="
100
78
  - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
79
  version: "0"
105
80
  type: :development
106
81
  version_requirements: *id006
107
- description: A subtitle search client to search for swedish subtitles on undertexter.se
82
+ description: A basic API for Undertexter.se.
108
83
  email:
109
84
  - linus@oleander.nu
110
85
  executables: []
@@ -145,26 +120,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
120
  requirements:
146
121
  - - ">="
147
122
  - !ruby/object:Gem::Version
148
- hash: 3
149
- segments:
150
- - 0
151
123
  version: "0"
152
124
  required_rubygems_version: !ruby/object:Gem::Requirement
153
125
  none: false
154
126
  requirements:
155
127
  - - ">="
156
128
  - !ruby/object:Gem::Version
157
- hash: 3
158
- segments:
159
- - 0
160
129
  version: "0"
161
130
  requirements: []
162
131
 
163
132
  rubyforge_project: undertexter
164
- rubygems_version: 1.5.0
133
+ rubygems_version: 1.6.2
165
134
  signing_key:
166
135
  specification_version: 3
167
- summary: A subtitle search client for undertexter.se
136
+ summary: A basic API for Undertexter.se
168
137
  test_files:
169
138
  - spec/array_spec.rb
170
139
  - spec/data/127.Hours.2010.DVDSCR.XViD-MC8