Subtitler uses the API of 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.
Download subtitles in english for /Users/foo/Desktop/MyMovie.mp4
.
import Subtitler
let 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
}
}
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
.
- Mac OS X 10.10+ / iOS 8.0+
- Xcode 7
- libz
Use this in your Podfile
!
use_frameworks!
target 'MyApp' do
pod 'Subtitler', '0.2.0'
end
Subtitler is released under the MIT license.