diff options
Diffstat (limited to 'shared/extra-utils/videos')
-rw-r--r-- | shared/extra-utils/videos/blacklist-command.ts | 3 | ||||
-rw-r--r-- | shared/extra-utils/videos/captions-command.ts | 3 | ||||
-rw-r--r-- | shared/extra-utils/videos/change-ownership-command.ts | 3 | ||||
-rw-r--r-- | shared/extra-utils/videos/channels-command.ts | 3 | ||||
-rw-r--r-- | shared/extra-utils/videos/comments-command.ts | 3 | ||||
-rw-r--r-- | shared/extra-utils/videos/history-command.ts | 3 | ||||
-rw-r--r-- | shared/extra-utils/videos/imports-command.ts | 3 | ||||
-rw-r--r-- | shared/extra-utils/videos/live-command.ts | 3 | ||||
-rw-r--r-- | shared/extra-utils/videos/playlists-command.ts | 2 | ||||
-rw-r--r-- | shared/extra-utils/videos/streaming-playlists.ts | 3 | ||||
-rw-r--r-- | shared/extra-utils/videos/videos-command.ts | 15 | ||||
-rw-r--r-- | shared/extra-utils/videos/videos.ts | 2 |
12 files changed, 19 insertions, 27 deletions
diff --git a/shared/extra-utils/videos/blacklist-command.ts b/shared/extra-utils/videos/blacklist-command.ts index 9404d4c08..3a2ef89ba 100644 --- a/shared/extra-utils/videos/blacklist-command.ts +++ b/shared/extra-utils/videos/blacklist-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | 1 | ||
2 | import { ResultList } from '@shared/models' | 2 | import { HttpStatusCode, ResultList } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { VideoBlacklist, VideoBlacklistType } from '../../models/videos' | 3 | import { VideoBlacklist, VideoBlacklistType } from '../../models/videos' |
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
6 | 5 | ||
diff --git a/shared/extra-utils/videos/captions-command.ts b/shared/extra-utils/videos/captions-command.ts index 04dd32f84..a0608e1a6 100644 --- a/shared/extra-utils/videos/captions-command.ts +++ b/shared/extra-utils/videos/captions-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | 1 | import { HttpStatusCode, ResultList, VideoCaption } from '@shared/models' |
2 | import { ResultList, VideoCaption } from '@shared/models' | ||
3 | import { buildAbsoluteFixturePath } from '../miscs' | 2 | import { buildAbsoluteFixturePath } from '../miscs' |
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | 4 | ||
diff --git a/shared/extra-utils/videos/change-ownership-command.ts b/shared/extra-utils/videos/change-ownership-command.ts index ef6f07536..ad4c726ef 100644 --- a/shared/extra-utils/videos/change-ownership-command.ts +++ b/shared/extra-utils/videos/change-ownership-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | 1 | ||
2 | import { ResultList, VideoChangeOwnership } from '@shared/models' | 2 | import { HttpStatusCode, ResultList, VideoChangeOwnership } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | 4 | ||
6 | export class ChangeOwnershipCommand extends AbstractCommand { | 5 | export class ChangeOwnershipCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/videos/channels-command.ts b/shared/extra-utils/videos/channels-command.ts index e5393ff56..f8eb3f885 100644 --- a/shared/extra-utils/videos/channels-command.ts +++ b/shared/extra-utils/videos/channels-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { pick } from 'lodash' | 1 | import { pick } from 'lodash' |
2 | import { ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models' | 2 | import { HttpStatusCode, ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' | 3 | import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' |
5 | import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' | 4 | import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' |
6 | import { unwrapBody } from '../requests' | 5 | import { unwrapBody } from '../requests' |
diff --git a/shared/extra-utils/videos/comments-command.ts b/shared/extra-utils/videos/comments-command.ts index 7368f3ea2..dd14e4b64 100644 --- a/shared/extra-utils/videos/comments-command.ts +++ b/shared/extra-utils/videos/comments-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { pick } from 'lodash' | 1 | import { pick } from 'lodash' |
2 | import { HttpStatusCode } from '@shared/models' | 2 | import { HttpStatusCode, ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models' |
3 | import { ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models' | ||
4 | import { unwrapBody } from '../requests' | 3 | import { unwrapBody } from '../requests' |
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
6 | 5 | ||
diff --git a/shared/extra-utils/videos/history-command.ts b/shared/extra-utils/videos/history-command.ts index 41afc6bc6..13b7150c1 100644 --- a/shared/extra-utils/videos/history-command.ts +++ b/shared/extra-utils/videos/history-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | 1 | import { HttpStatusCode, ResultList, Video } from '@shared/models' |
2 | import { ResultList, Video } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class HistoryCommand extends AbstractCommand { | 4 | export class HistoryCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/videos/imports-command.ts b/shared/extra-utils/videos/imports-command.ts index d30f9745b..e4944694d 100644 --- a/shared/extra-utils/videos/imports-command.ts +++ b/shared/extra-utils/videos/imports-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | 1 | ||
2 | import { HttpStatusCode } from '@shared/models' | 2 | import { HttpStatusCode, ResultList } from '@shared/models' |
3 | import { ResultList } from '@shared/models' | ||
4 | import { VideoImport, VideoImportCreate } from '../../models/videos' | 3 | import { VideoImport, VideoImportCreate } from '../../models/videos' |
5 | import { unwrapBody } from '../requests' | 4 | import { unwrapBody } from '../requests' |
6 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
diff --git a/shared/extra-utils/videos/live-command.ts b/shared/extra-utils/videos/live-command.ts index 9dfe3087e..bf9486a05 100644 --- a/shared/extra-utils/videos/live-command.ts +++ b/shared/extra-utils/videos/live-command.ts | |||
@@ -3,8 +3,7 @@ | |||
3 | import { readdir } from 'fs-extra' | 3 | import { readdir } from 'fs-extra' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { HttpStatusCode } from '@shared/models' | 6 | import { HttpStatusCode, LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models' |
7 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models' | ||
8 | import { wait } from '../miscs' | 7 | import { wait } from '../miscs' |
9 | import { unwrapBody } from '../requests' | 8 | import { unwrapBody } from '../requests' |
10 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 9 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
diff --git a/shared/extra-utils/videos/playlists-command.ts b/shared/extra-utils/videos/playlists-command.ts index 40162c30d..6f329800e 100644 --- a/shared/extra-utils/videos/playlists-command.ts +++ b/shared/extra-utils/videos/playlists-command.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { omit, pick } from 'lodash' | 1 | import { omit, pick } from 'lodash' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { | 2 | import { |
4 | BooleanBothQuery, | 3 | BooleanBothQuery, |
4 | HttpStatusCode, | ||
5 | ResultList, | 5 | ResultList, |
6 | VideoExistInPlaylist, | 6 | VideoExistInPlaylist, |
7 | VideoPlaylist, | 7 | VideoPlaylist, |
diff --git a/shared/extra-utils/videos/streaming-playlists.ts b/shared/extra-utils/videos/streaming-playlists.ts index 007d3d98d..1ae3fefc1 100644 --- a/shared/extra-utils/videos/streaming-playlists.ts +++ b/shared/extra-utils/videos/streaming-playlists.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { expect } from 'chai' | 1 | import { expect } from 'chai' |
2 | import { sha256 } from '@server/helpers/core-utils' | 2 | import { sha256 } from '@server/helpers/core-utils' |
3 | import { HttpStatusCode } from '@shared/models' | 3 | import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models' |
4 | import { VideoStreamingPlaylist } from '@shared/models' | ||
5 | import { PeerTubeServer } from '../server' | 4 | import { PeerTubeServer } from '../server' |
6 | 5 | ||
7 | async function checkSegmentHash (options: { | 6 | async function checkSegmentHash (options: { |
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts index f46d386f4..40cc4dc28 100644 --- a/shared/extra-utils/videos/videos-command.ts +++ b/shared/extra-utils/videos/videos-command.ts | |||
@@ -7,8 +7,8 @@ import { omit, pick } from 'lodash' | |||
7 | import validator from 'validator' | 7 | import validator from 'validator' |
8 | import { buildUUID } from '@server/helpers/uuid' | 8 | import { buildUUID } from '@server/helpers/uuid' |
9 | import { loadLanguages } from '@server/initializers/constants' | 9 | import { loadLanguages } from '@server/initializers/constants' |
10 | import { HttpStatusCode } from '@shared/models' | ||
11 | import { | 10 | import { |
11 | HttpStatusCode, | ||
12 | ResultList, | 12 | ResultList, |
13 | UserVideoRateType, | 13 | UserVideoRateType, |
14 | Video, | 14 | Video, |
@@ -332,7 +332,7 @@ export class VideosCommand extends AbstractCommand { | |||
332 | attributes?: VideoEdit | 332 | attributes?: VideoEdit |
333 | mode?: 'legacy' | 'resumable' // default legacy | 333 | mode?: 'legacy' | 'resumable' // default legacy |
334 | } = {}) { | 334 | } = {}) { |
335 | const { mode = 'legacy', expectedStatus } = options | 335 | const { mode = 'legacy' } = options |
336 | let defaultChannelId = 1 | 336 | let defaultChannelId = 1 |
337 | 337 | ||
338 | try { | 338 | try { |
@@ -360,22 +360,23 @@ export class VideosCommand extends AbstractCommand { | |||
360 | ...options.attributes | 360 | ...options.attributes |
361 | } | 361 | } |
362 | 362 | ||
363 | const res = mode === 'legacy' | 363 | const created = mode === 'legacy' |
364 | ? await this.buildLegacyUpload({ ...options, attributes }) | 364 | ? await this.buildLegacyUpload({ ...options, attributes }) |
365 | : await this.buildResumeUpload({ ...options, attributes }) | 365 | : await this.buildResumeUpload({ ...options, attributes }) |
366 | 366 | ||
367 | // Wait torrent generation | 367 | // Wait torrent generation |
368 | const expectedStatus = this.buildExpectedStatus({ ...options, defaultExpectedStatus: HttpStatusCode.OK_200 }) | ||
368 | if (expectedStatus === HttpStatusCode.OK_200) { | 369 | if (expectedStatus === HttpStatusCode.OK_200) { |
369 | let video: VideoDetails | 370 | let video: VideoDetails |
370 | 371 | ||
371 | do { | 372 | do { |
372 | video = await this.getWithToken({ ...options, id: video.uuid }) | 373 | video = await this.getWithToken({ ...options, id: created.uuid }) |
373 | 374 | ||
374 | await wait(50) | 375 | await wait(50) |
375 | } while (!video.files[0].torrentUrl) | 376 | } while (!video.files[0].torrentUrl) |
376 | } | 377 | } |
377 | 378 | ||
378 | return res | 379 | return created |
379 | } | 380 | } |
380 | 381 | ||
381 | async buildLegacyUpload (options: OverrideCommandOptions & { | 382 | async buildLegacyUpload (options: OverrideCommandOptions & { |
@@ -535,13 +536,13 @@ export class VideosCommand extends AbstractCommand { | |||
535 | 536 | ||
536 | async randomUpload (options: OverrideCommandOptions & { | 537 | async randomUpload (options: OverrideCommandOptions & { |
537 | wait?: boolean // default true | 538 | wait?: boolean // default true |
538 | additionalParams?: VideoEdit & { prefixName: string } | 539 | additionalParams?: VideoEdit & { prefixName?: string } |
539 | } = {}) { | 540 | } = {}) { |
540 | const { wait = true, additionalParams } = options | 541 | const { wait = true, additionalParams } = options |
541 | const prefixName = additionalParams?.prefixName || '' | 542 | const prefixName = additionalParams?.prefixName || '' |
542 | const name = prefixName + buildUUID() | 543 | const name = prefixName + buildUUID() |
543 | 544 | ||
544 | const attributes = { name, additionalParams } | 545 | const attributes = { name, ...additionalParams } |
545 | 546 | ||
546 | const result = await this.upload({ ...options, attributes }) | 547 | const result = await this.upload({ ...options, attributes }) |
547 | 548 | ||
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts index a96073c56..9a9bfb3cf 100644 --- a/shared/extra-utils/videos/videos.ts +++ b/shared/extra-utils/videos/videos.ts | |||
@@ -202,7 +202,7 @@ async function uploadRandomVideoOnServers ( | |||
202 | additionalParams?: VideoEdit & { prefixName?: string } | 202 | additionalParams?: VideoEdit & { prefixName?: string } |
203 | ) { | 203 | ) { |
204 | const server = servers.find(s => s.serverNumber === serverNumber) | 204 | const server = servers.find(s => s.serverNumber === serverNumber) |
205 | const res = await server.videos.randomUpload({ wait: false, ...additionalParams }) | 205 | const res = await server.videos.randomUpload({ wait: false, additionalParams }) |
206 | 206 | ||
207 | await waitJobs(servers) | 207 | await waitJobs(servers) |
208 | 208 | ||