X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fvideos%2Fvideos.ts;h=d1ac48292887fdb9b0edde0bac66572fe89a8ba9;hb=44d4ee4fcb7cf8beebac73f85693c09919b91e66;hp=1fcc949daadad98ba21a33f0f353c42dd6737b80;hpb=d7a25329f9e607894d29ab342b9cb66638b56dc0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts index 1fcc949da..d1ac48292 100644 --- a/shared/extra-utils/videos/videos.ts +++ b/shared/extra-utils/videos/videos.ts @@ -16,7 +16,7 @@ import { ServerInfo, testImage } from '../' -import * as validator from 'validator' +import validator from 'validator' import { VideoDetails, VideoPrivacy } from '../../models/videos' import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, loadLanguages, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants' import { dateIsValid, webtorrentAdd, buildServerDirectory } from '../miscs/miscs' @@ -161,13 +161,14 @@ function getLocalVideos (url: string) { .expect('Content-Type', /json/) } -function getMyVideos (url: string, accessToken: string, start: number, count: number, sort?: string) { +function getMyVideos (url: string, accessToken: string, start: number, count: number, sort?: string, search?: string) { const path = '/api/v1/users/me/videos' const req = request(url) .get(path) .query({ start: start }) .query({ count: count }) + .query({ search: search }) if (sort) req.query({ sort }) @@ -247,7 +248,7 @@ function getPlaylistVideos ( }) } -function getVideosListPagination (url: string, start: number, count: number, sort?: string) { +function getVideosListPagination (url: string, start: number, count: number, sort?: string, skipCount?: boolean) { const path = '/api/v1/videos' const req = request(url) @@ -256,6 +257,7 @@ function getVideosListPagination (url: string, start: number, count: number, sor .query({ count: count }) if (sort) req.query({ sort }) + if (skipCount) req.query({ skipCount }) return req.set('Accept', 'application/json') .expect(200) @@ -585,19 +587,17 @@ async function completeVideoCheck ( 'File size for resolution ' + file.resolution.label + ' outside confidence interval (' + minSize + '> size <' + maxSize + ')') .to.be.above(minSize).and.below(maxSize) - { - await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath) - } - - if (attributes.previewfile) { - await testImage(url, attributes.previewfile, videoDetails.previewPath) - } - const torrent = await webtorrentAdd(file.magnetUri, true) expect(torrent.files).to.be.an('array') expect(torrent.files.length).to.equal(1) expect(torrent.files[0].path).to.exist.and.to.not.equal('') } + + await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath) + + if (attributes.previewfile) { + await testImage(url, attributes.previewfile, videoDetails.previewPath) + } } async function videoUUIDToId (url: string, id: number | string) {