https://github.com/erizocosmico/subtitler
Downloading subtitles with Swift
https://github.com/erizocosmico/subtitler
library opensubtitles subtitle subtitles swift
Last synced: 3 months ago
JSON representation
Downloading subtitles with Swift
- Host: GitHub
- URL: https://github.com/erizocosmico/subtitler
- Owner: erizocosmico
- License: mit
- Created: 2016-01-22T15:28:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-28T13:13:36.000Z (over 9 years ago)
- Last Synced: 2025-07-02T07:46:46.186Z (4 months ago)
- Topics: library, opensubtitles, subtitle, subtitles, swift
- Language: Swift
- Size: 21.5 KB
- Stars: 12
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Subtitler
[](http://mit-license.org)
[](https://developer.apple.com/resources/)
[](https://developer.apple.com/swift)
[](http://cocoadocs.org/docsets/Subtitler/)Subtitler uses the API of [OpenSubtitles.org](http://opensubtitles.org) to retrieve subtitles for your movies and tv shows. Just give a path to the file to Subtitler, everything else is handled by it.
**Note:** you will need your own user agent. More info about OpenSubtitles user agents [here](http://trac.opensubtitles.org/projects/opensubtitles/wiki/DevReadFirst).
## Example
Download subtitles in english for `/Users/foo/Desktop/MyMovie.mp4`.```swift
import Subtitlerlet s = Subtitler(lang:"en", userAgent:"OSTestUserAgent")
s.download("/Users/foo/Desktop/MyMovie.mp4") { result in
switch result {
case .Success(let subtitlesPath):
// Do something with the subtitles
case .Failure(let error):
// Handle error
}
}
```#### Languages
For the languages of the subtitles, use the ISO639 code of the language.
Subtitles are downloaded to the same path where the original file is and the same name but with `.srt` extension. In this case, the result would be `/Users/foo/Desktop/MyMovie.srt`.
## Requirements
* Mac OS X 10.10+ / iOS 8.0+
* Xcode 7
* libz## Install with CocoaPods
Use this in your `Podfile`!
```ruby
use_frameworks!target 'MyApp' do
pod 'Subtitler', '0.2.0'
end
```## License
Subtitler is released under the MIT license.