Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oleander/subtitle_source
Ruby bindings for subtitlesource.org
https://github.com/oleander/subtitle_source
Last synced: about 2 months ago
JSON representation
Ruby bindings for subtitlesource.org
- Host: GitHub
- URL: https://github.com/oleander/subtitle_source
- Owner: oleander
- Created: 2011-07-11T12:06:52.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-07-12T16:28:28.000Z (over 13 years ago)
- Last Synced: 2024-11-07T13:07:59.590Z (2 months ago)
- Language: Ruby
- Homepage: https://github.com/oleander/subtitle_source
- Size: 126 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Subtitle Source
Ruby bindings for [subtitlesource.org](http://www.subtitlesource.org/).
Follow me on [Twitter](http://twitter.com/linusoleander) or [Github](https://github.com/oleander/) 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](http://www.subtitlesource.org/help/contact).
### Initialize
Pass your API key to the constructor.
*This is just an example.*```` ruby
@subtitles = SubtitleSource.new("6894b779456d330e")
````### Search for a subtitle
```` ruby
@subtitles.query("Heroes.S03E09.HDTV.XviD-LOL").fetch
````### Specify a language
```` ruby
@subtitles.language("english").query("Heroes.S03E09.HDTV.XviD-LOL").fetch
````### Find by IMDb id
```` ruby
@subtitles.imdb("tt0813715").fetch
````### Specify a page
Default is *1*.
*20* results per page.```` ruby
@subtitles.imdb("tt0813715").page(2).fetch
````### Find subtitle based on a release name
```` ruby
@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`.
```` ruby
@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.
```` ruby
@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](http://www.subtitlesource.org/subs/73538/Source.Code.(2011).DVDRip.XviD-MAXSPEED).
- **url** (*String*) Url to the zipped subtitle. [Example](http://www.subtitlesource.org/download/zip/73538).
- **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*.