Subtitle Source
Ruby bindings for subtitlesource.org.
Follow me on Twitter or Github for more info and updates.
How to use
Request an API key
You can easily request an API key at the Subtitle Source API page.
Initialize
Pass your API key to the constructor.
This is just an example.
@subtitles = SubtitleSource.new("6894b779456d330e")
Search for a subtitle
@subtitles.query("Heroes.S03E09.HDTV.XviD-LOL").fetch
Specify a language
@subtitles.language("english").query("Heroes.S03E09.HDTV.XviD-LOL").fetch
Find by IMDb id
@subtitles.imdb("tt0813715").fetch
Specify a page
Default is 1.
20 results per page.
@subtitles.imdb("tt0813715").page(2).fetch
Find subtitle based on a release name
@subtitles.imdb("tt0813715").fetch.based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS").title
# => "The Town"
Sensitive
Specify how sensitive the based_on
method should be, 0.0
to 1.0
. Default is 0.4
.
@subtitles.imdb("tt0813715").fetch.based_on("The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS", limit: 0.0).release_name
# => "The Town EXTENDED 2010 480p BRRip XviD AC3 FLAWL3SS"
Data to work with
The fetch
method returns a list for subtitles. Each subtitle has the following accessors.
@subtitles.imdb("tt0813715").fetch.first.release_name
# => "Heroes.S03E09.HDTV.XviD-LOL"
- title (String) Movie/TV serie title.
- imdb (String) IMDb id.
- id (Fixnum) Subtitle Source id.
- rid (Fixnum) Same as above, I think.
- language (String) Subtitle language.
- season (Fixnum) Season for the given TV serie.
- episode (Fixnum) Episode for the given TV serie.
- release_name (String) Subtitle release name.
- fps (Fixnum) Frames per second.
- cd (Fixnum) The amount of cd's for the given TV serie.
- details (String) Url to the details page. Example.
- url (String) Url to the zipped subtitle. Example.
- hi (Fixnum)
How to install
[sudo] gem install subtitlesource
Requirements
Subtitle Source is tested in OS X 10.6.8 using Ruby 1.9.2.
License
Subtitle Source is released under the MIT license.