aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-29 14:50:41 +0200
committerChocobozzz <me@florianbigard.com>2022-08-01 14:55:10 +0200
commit1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7 (patch)
treea6554ee0a3ccc2ae402665b2ecf57bb38fd0ed72 /shared/server-commands
parent12d84abeca4917d2f1e3f308010bfcd56d37cb7c (diff)
downloadPeerTube-1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7.tar.gz
PeerTube-1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7.tar.zst
PeerTube-1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7.zip
Add ability to delete a specific video file
Diffstat (limited to 'shared/server-commands')
-rw-r--r--shared/server-commands/videos/videos-command.ts36
1 files changed, 33 insertions, 3 deletions
diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts
index e952c9777..c0b36d95b 100644
--- a/shared/server-commands/videos/videos-command.ts
+++ b/shared/server-commands/videos/videos-command.ts
@@ -20,10 +20,10 @@ import {
20 VideosCommonQuery, 20 VideosCommonQuery,
21 VideoTranscodingCreate 21 VideoTranscodingCreate
22} from '@shared/models' 22} from '@shared/models'
23import { VideoSource } from '@shared/models/videos/video-source'
23import { unwrapBody } from '../requests' 24import { unwrapBody } from '../requests'
24import { waitJobs } from '../server' 25import { waitJobs } from '../server'
25import { AbstractCommand, OverrideCommandOptions } from '../shared' 26import { AbstractCommand, OverrideCommandOptions } from '../shared'
26import { VideoSource } from '@shared/models/videos/video-source'
27 27
28export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { 28export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & {
29 fixture?: string 29 fixture?: string
@@ -605,7 +605,7 @@ export class VideosCommand extends AbstractCommand {
605 605
606 // --------------------------------------------------------------------------- 606 // ---------------------------------------------------------------------------
607 607
608 removeHLSFiles (options: OverrideCommandOptions & { 608 removeHLSPlaylist (options: OverrideCommandOptions & {
609 videoId: number | string 609 videoId: number | string
610 }) { 610 }) {
611 const path = '/api/v1/videos/' + options.videoId + '/hls' 611 const path = '/api/v1/videos/' + options.videoId + '/hls'
@@ -619,7 +619,22 @@ export class VideosCommand extends AbstractCommand {
619 }) 619 })
620 } 620 }
621 621
622 removeWebTorrentFiles (options: OverrideCommandOptions & { 622 removeHLSFile (options: OverrideCommandOptions & {
623 videoId: number | string
624 fileId: number
625 }) {
626 const path = '/api/v1/videos/' + options.videoId + '/hls/' + options.fileId
627
628 return this.deleteRequest({
629 ...options,
630
631 path,
632 implicitToken: true,
633 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
634 })
635 }
636
637 removeAllWebTorrentFiles (options: OverrideCommandOptions & {
623 videoId: number | string 638 videoId: number | string
624 }) { 639 }) {
625 const path = '/api/v1/videos/' + options.videoId + '/webtorrent' 640 const path = '/api/v1/videos/' + options.videoId + '/webtorrent'
@@ -633,6 +648,21 @@ export class VideosCommand extends AbstractCommand {
633 }) 648 })
634 } 649 }
635 650
651 removeWebTorrentFile (options: OverrideCommandOptions & {
652 videoId: number | string
653 fileId: number
654 }) {
655 const path = '/api/v1/videos/' + options.videoId + '/webtorrent/' + options.fileId
656
657 return this.deleteRequest({
658 ...options,
659
660 path,
661 implicitToken: true,
662 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
663 })
664 }
665
636 runTranscoding (options: OverrideCommandOptions & { 666 runTranscoding (options: OverrideCommandOptions & {
637 videoId: number | string 667 videoId: number | string
638 transcodingType: 'hls' | 'webtorrent' 668 transcodingType: 'hls' | 'webtorrent'