diff options
author | Chocobozzz <me@florianbigard.com> | 2019-01-29 08:37:25 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-02-11 09:13:02 +0100 |
commit | 092092969633bbcf6d4891a083ea497a7d5c3154 (patch) | |
tree | 69e82fe4f60c444cca216830e96afe143a9dac71 /shared/utils/videos | |
parent | 4348a27d252a3349bafa7ef4859c0e2cf060c255 (diff) | |
download | PeerTube-092092969633bbcf6d4891a083ea497a7d5c3154.tar.gz PeerTube-092092969633bbcf6d4891a083ea497a7d5c3154.tar.zst PeerTube-092092969633bbcf6d4891a083ea497a7d5c3154.zip |
Add hls support on server
Diffstat (limited to 'shared/utils/videos')
-rw-r--r-- | shared/utils/videos/video-playlists.ts | 21 | ||||
-rw-r--r-- | shared/utils/videos/videos.ts | 13 |
2 files changed, 32 insertions, 2 deletions
diff --git a/shared/utils/videos/video-playlists.ts b/shared/utils/videos/video-playlists.ts new file mode 100644 index 000000000..9a0710ca6 --- /dev/null +++ b/shared/utils/videos/video-playlists.ts | |||
@@ -0,0 +1,21 @@ | |||
1 | import { makeRawRequest } from '../requests/requests' | ||
2 | |||
3 | function getPlaylist (url: string, statusCodeExpected = 200) { | ||
4 | return makeRawRequest(url, statusCodeExpected) | ||
5 | } | ||
6 | |||
7 | function getSegment (url: string, statusCodeExpected = 200) { | ||
8 | return makeRawRequest(url, statusCodeExpected) | ||
9 | } | ||
10 | |||
11 | function getSegmentSha256 (url: string, statusCodeExpected = 200) { | ||
12 | return makeRawRequest(url, statusCodeExpected) | ||
13 | } | ||
14 | |||
15 | // --------------------------------------------------------------------------- | ||
16 | |||
17 | export { | ||
18 | getPlaylist, | ||
19 | getSegment, | ||
20 | getSegmentSha256 | ||
21 | } | ||
diff --git a/shared/utils/videos/videos.ts b/shared/utils/videos/videos.ts index 0cf6e7c4f..b5b33e038 100644 --- a/shared/utils/videos/videos.ts +++ b/shared/utils/videos/videos.ts | |||
@@ -271,7 +271,16 @@ function removeVideo (url: string, token: string, id: number | string, expectedS | |||
271 | async function checkVideoFilesWereRemoved ( | 271 | async function checkVideoFilesWereRemoved ( |
272 | videoUUID: string, | 272 | videoUUID: string, |
273 | serverNumber: number, | 273 | serverNumber: number, |
274 | directories = [ 'redundancy', 'videos', 'thumbnails', 'torrents', 'previews', 'captions' ] | 274 | directories = [ |
275 | 'redundancy', | ||
276 | 'videos', | ||
277 | 'thumbnails', | ||
278 | 'torrents', | ||
279 | 'previews', | ||
280 | 'captions', | ||
281 | join('playlists', 'hls'), | ||
282 | join('redundancy', 'hls') | ||
283 | ] | ||
275 | ) { | 284 | ) { |
276 | const testDirectory = 'test' + serverNumber | 285 | const testDirectory = 'test' + serverNumber |
277 | 286 | ||
@@ -279,7 +288,7 @@ async function checkVideoFilesWereRemoved ( | |||
279 | const directoryPath = join(root(), testDirectory, directory) | 288 | const directoryPath = join(root(), testDirectory, directory) |
280 | 289 | ||
281 | const directoryExists = existsSync(directoryPath) | 290 | const directoryExists = existsSync(directoryPath) |
282 | expect(directoryExists).to.be.true | 291 | if (!directoryExists) continue |
283 | 292 | ||
284 | const files = await readdir(directoryPath) | 293 | const files = await readdir(directoryPath) |
285 | for (const file of files) { | 294 | for (const file of files) { |