-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
231 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
Example/DownloadToGo.xcodeproj/xcshareddata/xcschemes/DownloadToGo_Tests.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0830" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "607FACE41AFB9204008FA782" | ||
BuildableName = "DownloadToGo_Tests.xctest" | ||
BlueprintName = "DownloadToGo_Tests" | ||
ReferencedContainer = "container:DownloadToGo.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// HLSLocalizerTests.swift | ||
// DownloadToGo | ||
// | ||
// Created by Gal Orlanczyk on 26/07/2017. | ||
// Copyright © 2017 CocoaPods. All rights reserved. | ||
// | ||
|
||
import Quick | ||
import Nimble | ||
@testable import DownloadToGo | ||
|
||
class HLSLocalizerTests: QuickSpec { | ||
|
||
override func spec() { | ||
describe("HLSLocalizerTests") { | ||
|
||
let id = "test" | ||
let bundleURL = Bundle(for: type(of: self)).bundleURL | ||
let url = bundleURL.appendingPathComponent("Resources", isDirectory: true) | ||
.appendingPathComponent("SampleHLS", isDirectory: true) | ||
.appendingPathComponent("master.m3u8") | ||
let downloadPath = DTGFilePaths.itemDirUrl(forItemId: id) | ||
|
||
let localizer = HLSLocalizer(id: id, url: url, downloadPath: downloadPath, preferredVideoBitrate: nil) | ||
|
||
it("can localize hls m3u8 index file") { | ||
try! localizer.loadMetadata() | ||
let tasks = localizer.tasks | ||
// the sample hls provided has 30 media segments in total make sure it is the same | ||
expect(tasks.count).to(equal(30)) | ||
for task in tasks { | ||
let contentFileName = task.contentUrl.absoluteString.md5() | ||
// test file names are ok | ||
expect(tasks.contains { $0.destinationUrl.deletingPathExtension().lastPathComponent == contentFileName }).to(beTrue()) | ||
let expectedDestinationUrl = downloadPath.appendingPathComponent(task.trackType.asString(), isDirectory: true) | ||
.appendingPathComponent(task.contentUrl.absoluteString.md5()) | ||
.appendingPathExtension(task.contentUrl.pathExtension) | ||
// test destination url is ok | ||
expect(task.destinationUrl.absoluteString).to(equal(expectedDestinationUrl.absoluteString)) | ||
} | ||
} | ||
|
||
it("can save to to local file system") { | ||
try! localizer.saveLocalFiles() | ||
try! FileManager.default.removeItem(at: DTGFilePaths.itemDirUrl(forItemId: id)) | ||
} | ||
} | ||
} | ||
} |
Binary file added
BIN
+18 KB
Example/Tests/Resources/SampleHLS/audio/0523eedc55d06eb370dcc64890b67e0f.ts
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
Example/Tests/Resources/SampleHLS/audio/06ee6199748020cf8bfb1c07879db3b4.m3u8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#EXTM3U | ||
#EXT-X-TARGETDURATION:10 | ||
#EXT-X-ALLOW-CACHE:YES | ||
#EXT-X-PLAYLIST-TYPE:VOD | ||
#EXT-X-VERSION:3 | ||
#EXT-X-MEDIA-SEQUENCE:1 | ||
#EXTINF:2.000, | ||
09f1df7dfffa1c2a773c2c4353024a23.ts | ||
#EXTINF:2.000, | ||
973c6d5c9eb550f6fe8faba66f48020c.ts | ||
#EXTINF:2.000, | ||
9a9bd96537ded2ef5bb6921fe68c96c5.ts | ||
#EXTINF:4.000, | ||
83ec0e1e5f2e5a916ca38157f205ca20.ts | ||
#EXTINF:10.000, | ||
a4c7608dcfd18556262b04eb4b8fd221.ts | ||
#EXTINF:5.028, | ||
ee861377ec9e6bce754bc4c9a1c5066e.ts | ||
#EXT-X-ENDLIST |
Binary file added
BIN
+18 KB
Example/Tests/Resources/SampleHLS/audio/09f1df7dfffa1c2a773c2c4353024a23.ts
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
Example/Tests/Resources/SampleHLS/audio/1cab819c729f528e4140567e099757b7.m3u8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#EXTM3U | ||
#EXT-X-TARGETDURATION:10 | ||
#EXT-X-ALLOW-CACHE:YES | ||
#EXT-X-PLAYLIST-TYPE:VOD | ||
#EXT-X-VERSION:3 | ||
#EXT-X-MEDIA-SEQUENCE:1 | ||
#EXTINF:2.000, | ||
8e2e60048fd557eaaeef6e9256630218.ts | ||
#EXTINF:2.000, | ||
a02f21c1d3884fc0d187bdd9016a6009.ts | ||
#EXTINF:2.000, | ||
99712703991cdd23c63018a75f26253d.ts | ||
#EXTINF:4.000, | ||
747391dbd47cd9c55fb7844479fb03ca.ts | ||
#EXTINF:10.000, | ||
207085493d45e7436e17bcffb987e523.ts | ||
#EXTINF:5.003, | ||
60cc9e3ad7277bde95fdda9e317e1c35.ts | ||
#EXT-X-ENDLIST |
Binary file added
BIN
+18 KB
Example/Tests/Resources/SampleHLS/audio/1eba9f920bf694b1f8be0fb906ac8903.ts
Binary file not shown.
Binary file added
BIN
+171 KB
Example/Tests/Resources/SampleHLS/audio/207085493d45e7436e17bcffb987e523.ts
Binary file not shown.
Binary file added
BIN
+35.6 KB
Example/Tests/Resources/SampleHLS/audio/28cbe2742a45e7c65c0cbd2d88fde3fa.ts
Binary file not shown.
Binary file added
BIN
+35.6 KB
Example/Tests/Resources/SampleHLS/audio/410ed85925892d004d68ca9e575f18ca.ts
Binary file not shown.
Binary file added
BIN
+44.4 KB
Example/Tests/Resources/SampleHLS/audio/4530bdcf919e7fceef757ec697eff506.ts
Binary file not shown.
Binary file added
BIN
+88.5 KB
Example/Tests/Resources/SampleHLS/audio/5ce52fa0ee4b38ad26e201759730719c.ts
Binary file not shown.
Binary file added
BIN
+85.6 KB
Example/Tests/Resources/SampleHLS/audio/60cc9e3ad7277bde95fdda9e317e1c35.ts
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
Example/Tests/Resources/SampleHLS/audio/648ff69d5896bc4d814ec60a1acf482b.m3u8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#EXTM3U | ||
#EXT-X-TARGETDURATION:10 | ||
#EXT-X-ALLOW-CACHE:YES | ||
#EXT-X-PLAYLIST-TYPE:VOD | ||
#EXT-X-VERSION:3 | ||
#EXT-X-MEDIA-SEQUENCE:1 | ||
#EXTINF:2.000, | ||
cb38d516ca2453b65c450dadb5c5cb8c.ts | ||
#EXTINF:2.000, | ||
d5fa0546a05acc977bc597911fddd94c.ts | ||
#EXTINF:2.000, | ||
0523eedc55d06eb370dcc64890b67e0f.ts | ||
#EXTINF:4.000, | ||
28cbe2742a45e7c65c0cbd2d88fde3fa.ts | ||
#EXTINF:10.000, | ||
5ce52fa0ee4b38ad26e201759730719c.ts | ||
#EXTINF:5.028, | ||
9d569fd68b225743612b18bbd9d8c05a.ts | ||
#EXT-X-ENDLIST |
Binary file added
BIN
+70.9 KB
Example/Tests/Resources/SampleHLS/audio/747391dbd47cd9c55fb7844479fb03ca.ts
Binary file not shown.
Binary file added
BIN
+35.6 KB
Example/Tests/Resources/SampleHLS/audio/83ec0e1e5f2e5a916ca38157f205ca20.ts
Binary file not shown.
Binary file added
BIN
+35.6 KB
Example/Tests/Resources/SampleHLS/audio/8e2e60048fd557eaaeef6e9256630218.ts
Binary file not shown.
Binary file added
BIN
+18 KB
Example/Tests/Resources/SampleHLS/audio/973c6d5c9eb550f6fe8faba66f48020c.ts
Binary file not shown.
Binary file added
BIN
+35.6 KB
Example/Tests/Resources/SampleHLS/audio/99712703991cdd23c63018a75f26253d.ts
Binary file not shown.
Binary file added
BIN
+18 KB
Example/Tests/Resources/SampleHLS/audio/9a9bd96537ded2ef5bb6921fe68c96c5.ts
Binary file not shown.
Binary file added
BIN
+44.4 KB
Example/Tests/Resources/SampleHLS/audio/9d569fd68b225743612b18bbd9d8c05a.ts
Binary file not shown.
Binary file added
BIN
+35.6 KB
Example/Tests/Resources/SampleHLS/audio/a02f21c1d3884fc0d187bdd9016a6009.ts
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
Example/Tests/Resources/SampleHLS/audio/a26809bf2e43afd67f52109899040ecb.m3u8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#EXTM3U | ||
#EXT-X-TARGETDURATION:10 | ||
#EXT-X-ALLOW-CACHE:YES | ||
#EXT-X-PLAYLIST-TYPE:VOD | ||
#EXT-X-VERSION:3 | ||
#EXT-X-MEDIA-SEQUENCE:1 | ||
#EXTINF:2.000, | ||
fc97593fdace3270e3de97067540aaa7.ts | ||
#EXTINF:2.000, | ||
1eba9f920bf694b1f8be0fb906ac8903.ts | ||
#EXTINF:2.000, | ||
b077ea93d62f2c41e07c0b8abd2c4e04.ts | ||
#EXTINF:4.000, | ||
410ed85925892d004d68ca9e575f18ca.ts | ||
#EXTINF:10.000, | ||
b9682d336484ef2af9e154b6b7376769.ts | ||
#EXTINF:5.028, | ||
4530bdcf919e7fceef757ec697eff506.ts | ||
#EXT-X-ENDLIST |
Binary file added
BIN
+88.5 KB
Example/Tests/Resources/SampleHLS/audio/a4c7608dcfd18556262b04eb4b8fd221.ts
Binary file not shown.
Binary file added
BIN
+18 KB
Example/Tests/Resources/SampleHLS/audio/b077ea93d62f2c41e07c0b8abd2c4e04.ts
Binary file not shown.
Binary file added
BIN
+85.6 KB
Example/Tests/Resources/SampleHLS/audio/b9682d336484ef2af9e154b6b7376769.ts
Binary file not shown.
Binary file added
BIN
+20.9 KB
Example/Tests/Resources/SampleHLS/audio/cb38d516ca2453b65c450dadb5c5cb8c.ts
Binary file not shown.
Binary file added
BIN
+18 KB
Example/Tests/Resources/SampleHLS/audio/d5fa0546a05acc977bc597911fddd94c.ts
Binary file not shown.
Binary file added
BIN
+44.4 KB
Example/Tests/Resources/SampleHLS/audio/ee861377ec9e6bce754bc4c9a1c5066e.ts
Binary file not shown.
Binary file added
BIN
+18 KB
Example/Tests/Resources/SampleHLS/audio/fc97593fdace3270e3de97067540aaa7.ts
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#EXTM3U | ||
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="dan",NAME="Danish",AUTOSELECT=YES,DEFAULT=YES,URI="audio/06ee6199748020cf8bfb1c07879db3b4.m3u8" | ||
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="eng",NAME="English",AUTOSELECT=NO,DEFAULT=NO,URI="audio/1cab819c729f528e4140567e099757b7.m3u8" | ||
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="cze",NAME="cze",AUTOSELECT=NO,DEFAULT=NO,URI="audio/a26809bf2e43afd67f52109899040ecb.m3u8" | ||
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="bul",NAME="Bulgarian",AUTOSELECT=NO,DEFAULT=NO,URI="audio/648ff69d5896bc4d814ec60a1acf482b.m3u8" | ||
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=488448,RESOLUTION=640x360,AUDIO="audio" | ||
video/d2f7828257eab43b55634d1621b8a157.m3u8 |
Binary file added
BIN
+162 KB
Example/Tests/Resources/SampleHLS/video/29520a3cce2f3648e333b65086eba9e0.ts
Binary file not shown.
Binary file added
BIN
+141 KB
Example/Tests/Resources/SampleHLS/video/50e9c897e71fcafef5f915159deae690.ts
Binary file not shown.
Binary file added
BIN
+573 KB
Example/Tests/Resources/SampleHLS/video/9502085a51dbe9e88c9581b644dc4bc1.ts
Binary file not shown.
Binary file added
BIN
+253 KB
Example/Tests/Resources/SampleHLS/video/97aa8c9c21345575264ceff997dd0e4b.ts
Binary file not shown.
Binary file added
BIN
+323 KB
Example/Tests/Resources/SampleHLS/video/b2e2f41e9337b12f3d353971bb04728d.ts
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
Example/Tests/Resources/SampleHLS/video/d2f7828257eab43b55634d1621b8a157.m3u8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#EXTM3U | ||
#EXT-X-TARGETDURATION:10 | ||
#EXT-X-ALLOW-CACHE:YES | ||
#EXT-X-PLAYLIST-TYPE:VOD | ||
#EXT-X-VERSION:3 | ||
#EXT-X-MEDIA-SEQUENCE:1 | ||
#EXTINF:2.000, | ||
50e9c897e71fcafef5f915159deae690.ts | ||
#EXTINF:2.000, | ||
29520a3cce2f3648e333b65086eba9e0.ts | ||
#EXTINF:2.000, | ||
deb0c59ea4a8a1e5dbb7e724f78f3753.ts | ||
#EXTINF:4.000, | ||
97aa8c9c21345575264ceff997dd0e4b.ts | ||
#EXTINF:10.000, | ||
9502085a51dbe9e88c9581b644dc4bc1.ts | ||
#EXTINF:5.120, | ||
b2e2f41e9337b12f3d353971bb04728d.ts | ||
#EXT-X-ENDLIST |
Binary file added
BIN
+130 KB
Example/Tests/Resources/SampleHLS/video/deb0c59ea4a8a1e5dbb7e724f78f3753.ts
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters