mirror of
https://github.com/dirtydishes/dreamio.git
synced 2026-06-06 21:38:15 +00:00
accept stremio subtitle download urls
This commit is contained in:
parent
11ed364094
commit
11b9c6a12a
7 changed files with 540 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ struct StreamResolverTests {
|
|||
testOpenSubtitlesNestedAttributesFilesParsing()
|
||||
testOpenSubtitlesManifestIDsAreNotResolvedAsSubtitles()
|
||||
testOpenSubtitlesArtworkAndAddonEndpointsAreIgnored()
|
||||
testStremioSubtitleDownloadURLParsing()
|
||||
testOpenSubtitlesV3DownloadResponseResolution()
|
||||
testOpenSubtitlesNestedDownloadResponseResolution()
|
||||
await testSubtitleResolverDownloadJSONReturningLink()
|
||||
|
|
@ -240,6 +241,30 @@ struct StreamResolverTests {
|
|||
assertEqual(candidates[0].label, "English")
|
||||
}
|
||||
|
||||
private static func testStremioSubtitleDownloadURLParsing() {
|
||||
let payload: [String: Any] = [
|
||||
"subtitles": [
|
||||
[
|
||||
"label": "English",
|
||||
"lang": "eng",
|
||||
"url": "https://subs5.strem.io/en/download/subencoding-stremio-utf8/src-api/file/1952341941"
|
||||
],
|
||||
[
|
||||
"label": "Not a subtitle",
|
||||
"url": "https://www.strem.io/images/addons/opensubtitles-logo.png"
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
let candidates = SubtitleCandidateParser.candidates(in: payload)
|
||||
|
||||
assertEqual(candidates.count, 1)
|
||||
assertEqual(candidates[0].url.absoluteString, "https://subs5.strem.io/en/download/subencoding-stremio-utf8/src-api/file/1952341941")
|
||||
assertEqual(candidates[0].label, "English")
|
||||
assertEqual(candidates[0].language, "eng")
|
||||
assert(SubtitleResolver.isDirectSubtitleFile(candidates[0].url), "Expected Stremio subtitle downloads to be attachable without another resolver hop")
|
||||
}
|
||||
|
||||
private static func testOpenSubtitlesV3DownloadResponseResolution() {
|
||||
let payload = """
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue