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
|
|
@ -11,6 +11,7 @@ struct StreamResolverTests {
|
|||
testSubtitleCandidateParsing()
|
||||
testOpenSubtitlesV3CandidateParsing()
|
||||
testOpenSubtitlesNestedAttributesFilesParsing()
|
||||
testOpenSubtitlesManifestIDsAreNotResolvedAsSubtitles()
|
||||
testOpenSubtitlesV3DownloadResponseResolution()
|
||||
testOpenSubtitlesNestedDownloadResponseResolution()
|
||||
await testSubtitleResolverDownloadJSONReturningLink()
|
||||
|
|
@ -189,6 +190,29 @@ struct StreamResolverTests {
|
|||
assertEqual(candidates[1].language, "eng")
|
||||
}
|
||||
|
||||
private static func testOpenSubtitlesManifestIDsAreNotResolvedAsSubtitles() {
|
||||
let payload: [String: Any] = [
|
||||
"subtitles": [
|
||||
[
|
||||
"url": "https://opensubtitles-v3.strem.io/manifest.json_14",
|
||||
"file_id": 98765,
|
||||
"lang": "eng"
|
||||
],
|
||||
[
|
||||
"url": "https://opensubtitles-v3.strem.io/manifest.json_15",
|
||||
"lang": "spa"
|
||||
],
|
||||
"https://opensubtitles-v3.strem.io/manifest.json_16"
|
||||
]
|
||||
]
|
||||
|
||||
let candidates = SubtitleCandidateParser.candidates(in: payload)
|
||||
|
||||
assertEqual(candidates.count, 1)
|
||||
assertEqual(candidates[0].url.absoluteString, "https://api.opensubtitles.com/api/v1/download/98765")
|
||||
assertEqual(candidates[0].language, "eng")
|
||||
}
|
||||
|
||||
private static func testOpenSubtitlesV3DownloadResponseResolution() {
|
||||
let payload = """
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue