From 1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Jul 2022 14:50:41 +0200 Subject: Add ability to delete a specific video file --- shared/server-commands/videos/videos-command.ts | 36 ++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'shared') 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 { VideosCommonQuery, VideoTranscodingCreate } from '@shared/models' +import { VideoSource } from '@shared/models/videos/video-source' import { unwrapBody } from '../requests' import { waitJobs } from '../server' import { AbstractCommand, OverrideCommandOptions } from '../shared' -import { VideoSource } from '@shared/models/videos/video-source' export type VideoEdit = Partial> & { fixture?: string @@ -605,7 +605,7 @@ export class VideosCommand extends AbstractCommand { // --------------------------------------------------------------------------- - removeHLSFiles (options: OverrideCommandOptions & { + removeHLSPlaylist (options: OverrideCommandOptions & { videoId: number | string }) { const path = '/api/v1/videos/' + options.videoId + '/hls' @@ -619,7 +619,22 @@ export class VideosCommand extends AbstractCommand { }) } - removeWebTorrentFiles (options: OverrideCommandOptions & { + removeHLSFile (options: OverrideCommandOptions & { + videoId: number | string + fileId: number + }) { + const path = '/api/v1/videos/' + options.videoId + '/hls/' + options.fileId + + return this.deleteRequest({ + ...options, + + path, + implicitToken: true, + defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 + }) + } + + removeAllWebTorrentFiles (options: OverrideCommandOptions & { videoId: number | string }) { const path = '/api/v1/videos/' + options.videoId + '/webtorrent' @@ -633,6 +648,21 @@ export class VideosCommand extends AbstractCommand { }) } + removeWebTorrentFile (options: OverrideCommandOptions & { + videoId: number | string + fileId: number + }) { + const path = '/api/v1/videos/' + options.videoId + '/webtorrent/' + options.fileId + + return this.deleteRequest({ + ...options, + + path, + implicitToken: true, + defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 + }) + } + runTranscoding (options: OverrideCommandOptions & { videoId: number | string transcodingType: 'hls' | 'webtorrent' -- cgit v1.2.3