mirror of
https://github.com/dirtydishes/dreamio.git
synced 2026-06-06 13:37:24 +00:00
fix opensubtitles manifest subtitle urls
This commit is contained in:
parent
07741bae96
commit
6008272d0a
6 changed files with 275 additions and 5 deletions
|
|
@ -245,6 +245,9 @@ enum SubtitleCandidateParser {
|
|||
}
|
||||
|
||||
let lowercased = url.absoluteString.lowercased()
|
||||
if isOpenSubtitlesManifestIdentifier(url) {
|
||||
return nil
|
||||
}
|
||||
guard supportedExtensions.contains(url.pathExtension.lowercased())
|
||||
|| supportedExtensions.contains(where: { lowercased.contains(".\($0)?") || lowercased.contains(".\($0)&") })
|
||||
|| lowercased.contains("subtitle")
|
||||
|
|
@ -256,6 +259,14 @@ enum SubtitleCandidateParser {
|
|||
return url
|
||||
}
|
||||
|
||||
private static func isOpenSubtitlesManifestIdentifier(_ url: URL) -> Bool {
|
||||
guard url.host?.localizedCaseInsensitiveContains("opensubtitles") == true else {
|
||||
return false
|
||||
}
|
||||
let path = url.path.lowercased()
|
||||
return path == "/manifest.json" || path.range(of: #"/manifest\.json_\d+$"#, options: .regularExpression) != nil
|
||||
}
|
||||
|
||||
private static func openSubtitlesDownloadURL(from value: Any?) -> URL? {
|
||||
let id: String?
|
||||
if let string = value as? String, !string.isEmpty {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue