X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Futils%2Fvideos%2Fvideos.ts;h=2c09f008604556cdc226a79f37047b4f33fe9545;hb=418d092afa81e2c8fe8ac6838fc4b5eb0af6a782;hp=16ecbfe848851493ee3c8fdade13badc63c67a86;hpb=7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/utils/videos/videos.ts b/shared/utils/videos/videos.ts index 16ecbfe84..2c09f0086 100644 --- a/shared/utils/videos/videos.ts +++ b/shared/utils/videos/videos.ts @@ -223,6 +223,28 @@ function getVideoChannelVideos ( }) } +function getPlaylistVideos ( + url: string, + accessToken: string, + playlistId: number | string, + start: number, + count: number, + query: { nsfw?: boolean } = {} +) { + const path = '/api/v1/video-playlists/' + playlistId + '/videos' + + return makeGetRequest({ + url, + path, + query: immutableAssign(query, { + start, + count + }), + token: accessToken, + statusCodeExpected: 200 + }) +} + function getVideosListPagination (url: string, start: number, count: number, sort?: string) { const path = '/api/v1/videos' @@ -350,9 +372,6 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg if (attributes.licence !== undefined) { req.field('licence', attributes.licence.toString()) } - if (attributes.originallyPublishedAt !== undefined) { - req.field('originallyPublishedAt', attributes.originallyPublishedAt) - } for (let i = 0; i < attributes.tags.length; i++) { req.field('tags[' + i + ']', attributes.tags[i]) @@ -373,6 +392,10 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg } } + if (attributes.originallyPublishedAt !== undefined) { + req.field('originallyPublishedAt', attributes.originallyPublishedAt) + } + return req.attach('videofile', buildAbsoluteFixturePath(attributes.fixture)) .expect(specialStatus) } @@ -600,5 +623,6 @@ export { parseTorrentVideo, getLocalVideos, completeVideoCheck, - checkVideoFilesWereRemoved + checkVideoFilesWereRemoved, + getPlaylistVideos }