diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/server/jobs.ts | 5 | ||||
-rw-r--r-- | shared/extra-utils/videos/video-playlists.ts | 8 | ||||
-rw-r--r-- | shared/models/videos/index.ts | 1 | ||||
-rw-r--r-- | shared/models/videos/playlist/video-exist-in-playlist.model.ts | 1 | ||||
-rw-r--r-- | shared/models/videos/playlist/video-playlist-element.model.ts | 19 | ||||
-rw-r--r-- | shared/models/videos/video.model.ts | 8 |
6 files changed, 27 insertions, 15 deletions
diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.ts index 11b570f60..b3db885e8 100644 --- a/shared/extra-utils/server/jobs.ts +++ b/shared/extra-utils/server/jobs.ts | |||
@@ -2,7 +2,6 @@ import * as request from 'supertest' | |||
2 | import { Job, JobState } from '../../models' | 2 | import { Job, JobState } from '../../models' |
3 | import { wait } from '../miscs/miscs' | 3 | import { wait } from '../miscs/miscs' |
4 | import { ServerInfo } from './servers' | 4 | import { ServerInfo } from './servers' |
5 | import { inspect } from 'util' | ||
6 | 5 | ||
7 | function getJobsList (url: string, accessToken: string, state: JobState) { | 6 | function getJobsList (url: string, accessToken: string, state: JobState) { |
8 | const path = '/api/v1/jobs/' + state | 7 | const path = '/api/v1/jobs/' + state |
@@ -37,11 +36,10 @@ async function waitJobs (serversArg: ServerInfo[] | ServerInfo) { | |||
37 | else servers = serversArg as ServerInfo[] | 36 | else servers = serversArg as ServerInfo[] |
38 | 37 | ||
39 | const states: JobState[] = [ 'waiting', 'active', 'delayed' ] | 38 | const states: JobState[] = [ 'waiting', 'active', 'delayed' ] |
40 | let pendingRequests = false | 39 | let pendingRequests: boolean |
41 | 40 | ||
42 | function tasksBuilder () { | 41 | function tasksBuilder () { |
43 | const tasks: Promise<any>[] = [] | 42 | const tasks: Promise<any>[] = [] |
44 | pendingRequests = false | ||
45 | 43 | ||
46 | // Check if each server has pending request | 44 | // Check if each server has pending request |
47 | for (const server of servers) { | 45 | for (const server of servers) { |
@@ -62,6 +60,7 @@ async function waitJobs (serversArg: ServerInfo[] | ServerInfo) { | |||
62 | } | 60 | } |
63 | 61 | ||
64 | do { | 62 | do { |
63 | pendingRequests = false | ||
65 | await Promise.all(tasksBuilder()) | 64 | await Promise.all(tasksBuilder()) |
66 | 65 | ||
67 | // Retry, in case of new jobs were created | 66 | // Retry, in case of new jobs were created |
diff --git a/shared/extra-utils/videos/video-playlists.ts b/shared/extra-utils/videos/video-playlists.ts index fd62bef19..cbb073fbc 100644 --- a/shared/extra-utils/videos/video-playlists.ts +++ b/shared/extra-utils/videos/video-playlists.ts | |||
@@ -196,11 +196,11 @@ function updateVideoPlaylistElement (options: { | |||
196 | url: string, | 196 | url: string, |
197 | token: string, | 197 | token: string, |
198 | playlistId: number | string, | 198 | playlistId: number | string, |
199 | videoId: number | string, | 199 | playlistElementId: number | string, |
200 | elementAttrs: VideoPlaylistElementUpdate, | 200 | elementAttrs: VideoPlaylistElementUpdate, |
201 | expectedStatus?: number | 201 | expectedStatus?: number |
202 | }) { | 202 | }) { |
203 | const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.videoId | 203 | const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.playlistElementId |
204 | 204 | ||
205 | return makePutBodyRequest({ | 205 | return makePutBodyRequest({ |
206 | url: options.url, | 206 | url: options.url, |
@@ -215,10 +215,10 @@ function removeVideoFromPlaylist (options: { | |||
215 | url: string, | 215 | url: string, |
216 | token: string, | 216 | token: string, |
217 | playlistId: number | string, | 217 | playlistId: number | string, |
218 | videoId: number | string, | 218 | playlistElementId: number, |
219 | expectedStatus?: number | 219 | expectedStatus?: number |
220 | }) { | 220 | }) { |
221 | const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.videoId | 221 | const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.playlistElementId |
222 | 222 | ||
223 | return makeDeleteRequest({ | 223 | return makeDeleteRequest({ |
224 | url: options.url, | 224 | url: options.url, |
diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index e3d78220e..194ae1b96 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts | |||
@@ -19,6 +19,7 @@ export * from './playlist/video-playlist-privacy.model' | |||
19 | export * from './playlist/video-playlist-type.model' | 19 | export * from './playlist/video-playlist-type.model' |
20 | export * from './playlist/video-playlist-update.model' | 20 | export * from './playlist/video-playlist-update.model' |
21 | export * from './playlist/video-playlist.model' | 21 | export * from './playlist/video-playlist.model' |
22 | export * from './playlist/video-playlist-element.model' | ||
22 | export * from './video-change-ownership.model' | 23 | export * from './video-change-ownership.model' |
23 | export * from './video-change-ownership-create.model' | 24 | export * from './video-change-ownership-create.model' |
24 | export * from './video-create.model' | 25 | export * from './video-create.model' |
diff --git a/shared/models/videos/playlist/video-exist-in-playlist.model.ts b/shared/models/videos/playlist/video-exist-in-playlist.model.ts index 71240f51d..1b57257e2 100644 --- a/shared/models/videos/playlist/video-exist-in-playlist.model.ts +++ b/shared/models/videos/playlist/video-exist-in-playlist.model.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | export type VideoExistInPlaylist = { | 1 | export type VideoExistInPlaylist = { |
2 | [videoId: number ]: { | 2 | [videoId: number ]: { |
3 | playlistElementId: number | ||
3 | playlistId: number | 4 | playlistId: number |
4 | startTimestamp?: number | 5 | startTimestamp?: number |
5 | stopTimestamp?: number | 6 | stopTimestamp?: number |
diff --git a/shared/models/videos/playlist/video-playlist-element.model.ts b/shared/models/videos/playlist/video-playlist-element.model.ts new file mode 100644 index 000000000..9a1203892 --- /dev/null +++ b/shared/models/videos/playlist/video-playlist-element.model.ts | |||
@@ -0,0 +1,19 @@ | |||
1 | import { Video } from '../video.model' | ||
2 | |||
3 | export enum VideoPlaylistElementType { | ||
4 | REGULAR = 0, | ||
5 | DELETED = 1, | ||
6 | PRIVATE = 2, | ||
7 | UNAVAILABLE = 3 // Blacklisted, blocked by the user/instance, NSFW... | ||
8 | } | ||
9 | |||
10 | export interface VideoPlaylistElement { | ||
11 | id: number | ||
12 | position: number | ||
13 | startTimestamp: number | ||
14 | stopTimestamp: number | ||
15 | |||
16 | type: VideoPlaylistElementType | ||
17 | |||
18 | video?: Video | ||
19 | } | ||
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts index 0489147e4..e057b3e06 100644 --- a/shared/models/videos/video.model.ts +++ b/shared/models/videos/video.model.ts | |||
@@ -17,12 +17,6 @@ export interface VideoFile { | |||
17 | fps: number | 17 | fps: number |
18 | } | 18 | } |
19 | 19 | ||
20 | export interface PlaylistElement { | ||
21 | position: number | ||
22 | startTimestamp: number | ||
23 | stopTimestamp: number | ||
24 | } | ||
25 | |||
26 | export interface Video { | 20 | export interface Video { |
27 | id: number | 21 | id: number |
28 | uuid: string | 22 | uuid: string |
@@ -59,8 +53,6 @@ export interface Video { | |||
59 | userHistory?: { | 53 | userHistory?: { |
60 | currentTime: number | 54 | currentTime: number |
61 | } | 55 | } |
62 | |||
63 | playlistElement?: PlaylistElement | ||
64 | } | 56 | } |
65 | 57 | ||
66 | export interface VideoDetails extends Video { | 58 | export interface VideoDetails extends Video { |