diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
commit | a24bd1ed41b43790bab6ba789580bb4e85f07d85 (patch) | |
tree | a54b0f6c921ba83a6e909cd0ced325b2d4b8863c /shared/extra-utils/videos/streaming-playlists-command.ts | |
parent | 5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565 (diff) | |
parent | c63830f15403ac4e750829f27d8bbbdc9a59282c (diff) | |
download | PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.gz PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.zst PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.zip |
Merge branch 'next' into develop
Diffstat (limited to 'shared/extra-utils/videos/streaming-playlists-command.ts')
-rw-r--r-- | shared/extra-utils/videos/streaming-playlists-command.ts | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/shared/extra-utils/videos/streaming-playlists-command.ts b/shared/extra-utils/videos/streaming-playlists-command.ts new file mode 100644 index 000000000..9662685da --- /dev/null +++ b/shared/extra-utils/videos/streaming-playlists-command.ts | |||
@@ -0,0 +1,44 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | ||
2 | import { unwrapBody, unwrapText } from '../requests' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | ||
4 | |||
5 | export class StreamingPlaylistsCommand extends AbstractCommand { | ||
6 | |||
7 | get (options: OverrideCommandOptions & { | ||
8 | url: string | ||
9 | }) { | ||
10 | return unwrapText(this.getRawRequest({ | ||
11 | ...options, | ||
12 | |||
13 | url: options.url, | ||
14 | implicitToken: false, | ||
15 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
16 | })) | ||
17 | } | ||
18 | |||
19 | getSegment (options: OverrideCommandOptions & { | ||
20 | url: string | ||
21 | range?: string | ||
22 | }) { | ||
23 | return unwrapBody<Buffer>(this.getRawRequest({ | ||
24 | ...options, | ||
25 | |||
26 | url: options.url, | ||
27 | range: options.range, | ||
28 | implicitToken: false, | ||
29 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
30 | })) | ||
31 | } | ||
32 | |||
33 | getSegmentSha256 (options: OverrideCommandOptions & { | ||
34 | url: string | ||
35 | }) { | ||
36 | return unwrapBody<{ [ id: string ]: string }>(this.getRawRequest({ | ||
37 | ...options, | ||
38 | |||
39 | url: options.url, | ||
40 | implicitToken: false, | ||
41 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
42 | })) | ||
43 | } | ||
44 | } | ||