aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/streaming-playlists-command.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-09 10:21:10 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit57f879a540551c3b958b0991c8e1e3657a4481d8 (patch)
treecd9283dec9ef0b7fee116c93c36650de188ad892 /shared/extra-utils/videos/streaming-playlists-command.ts
parent6910f20f114b5bd020258a3a9a3f2117819a60c2 (diff)
downloadPeerTube-57f879a540551c3b958b0991c8e1e3657a4481d8.tar.gz
PeerTube-57f879a540551c3b958b0991c8e1e3657a4481d8.tar.zst
PeerTube-57f879a540551c3b958b0991c8e1e3657a4481d8.zip
Introduce streaming playlists command
Diffstat (limited to 'shared/extra-utils/videos/streaming-playlists-command.ts')
-rw-r--r--shared/extra-utils/videos/streaming-playlists-command.ts45
1 files changed, 45 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..4caec7137
--- /dev/null
+++ b/shared/extra-utils/videos/streaming-playlists-command.ts
@@ -0,0 +1,45 @@
1
2import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
3import { unwrapBody, unwrapText } from '../requests'
4import { AbstractCommand, OverrideCommandOptions } from '../shared'
5
6export class StreamingPlaylistsCommand extends AbstractCommand {
7
8 get (options: OverrideCommandOptions & {
9 url: string
10 }) {
11 return unwrapText(this.getRawRequest({
12 ...options,
13
14 url: options.url,
15 implicitToken: false,
16 defaultExpectedStatus: HttpStatusCode.OK_200
17 }))
18 }
19
20 getSegment (options: OverrideCommandOptions & {
21 url: string
22 range?: string
23 }) {
24 return unwrapText(this.getRawRequest({
25 ...options,
26
27 url: options.url,
28 range: options.range,
29 implicitToken: false,
30 defaultExpectedStatus: HttpStatusCode.OK_200,
31 }))
32 }
33
34 getSegmentSha256 (options: OverrideCommandOptions & {
35 url: string
36 }) {
37 return unwrapBody<{ [ id: string ]: string }>(this.getRawRequest({
38 ...options,
39
40 url: options.url,
41 implicitToken: false,
42 defaultExpectedStatus: HttpStatusCode.OK_200
43 }))
44 }
45}