Add peertube import test
This commit is contained in:
parent
41fb13c330
commit
e3c9ea7226
3 changed files with 34 additions and 1 deletions
|
@ -3,6 +3,7 @@ import { move, readFile } from 'fs-extra'
|
||||||
import { decode } from 'magnet-uri'
|
import { decode } from 'magnet-uri'
|
||||||
import parseTorrent, { Instance } from 'parse-torrent'
|
import parseTorrent, { Instance } from 'parse-torrent'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
import { isVideoFileExtnameValid } from '@server/helpers/custom-validators/videos'
|
||||||
import { ServerConfigManager } from '@server/lib/server-config-manager'
|
import { ServerConfigManager } from '@server/lib/server-config-manager'
|
||||||
import { setVideoTags } from '@server/lib/video'
|
import { setVideoTags } from '@server/lib/video'
|
||||||
import { FilteredModelAttributes } from '@server/types'
|
import { FilteredModelAttributes } from '@server/types'
|
||||||
|
@ -185,11 +186,14 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
|
||||||
// Get video subtitles
|
// Get video subtitles
|
||||||
await processYoutubeSubtitles(youtubeDL, targetUrl, video.id)
|
await processYoutubeSubtitles(youtubeDL, targetUrl, video.id)
|
||||||
|
|
||||||
|
let fileExt = `.${youtubeDLInfo.ext}`
|
||||||
|
if (!isVideoFileExtnameValid(fileExt)) fileExt = '.mp4'
|
||||||
|
|
||||||
// Create job to import the video
|
// Create job to import the video
|
||||||
const payload = {
|
const payload = {
|
||||||
type: 'youtube-dl' as 'youtube-dl',
|
type: 'youtube-dl' as 'youtube-dl',
|
||||||
videoImportId: videoImport.id,
|
videoImportId: videoImport.id,
|
||||||
fileExt: `.${youtubeDLInfo.ext || 'mp4'}`
|
fileExt
|
||||||
}
|
}
|
||||||
await JobQueue.Instance.createJobWithPromise({ type: 'video-import', payload })
|
await JobQueue.Instance.createJobWithPromise({ type: 'video-import', payload })
|
||||||
|
|
||||||
|
|
|
@ -336,6 +336,32 @@ Ajouter un sous-titre est vraiment facile`)
|
||||||
expect(maxResolution, 'expected max resolution not met').to.equals(VideoResolution.H_1080P)
|
expect(maxResolution, 'expected max resolution not met').to.equals(VideoResolution.H_1080P)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Should import a peertube video', async function () {
|
||||||
|
this.timeout(120_000)
|
||||||
|
|
||||||
|
// TODO: include peertube_short when https://github.com/ytdl-org/youtube-dl/pull/29475 is merged
|
||||||
|
for (const targetUrl of [ FIXTURE_URLS.peertube_long ]) {
|
||||||
|
// for (const targetUrl of [ FIXTURE_URLS.peertube_long, FIXTURE_URLS.peertube_short ]) {
|
||||||
|
await servers[0].config.disableTranscoding()
|
||||||
|
|
||||||
|
const attributes = {
|
||||||
|
targetUrl,
|
||||||
|
channelId: channelIdServer1,
|
||||||
|
privacy: VideoPrivacy.PUBLIC
|
||||||
|
}
|
||||||
|
const { video } = await servers[0].imports.importVideo({ attributes })
|
||||||
|
const videoUUID = video.uuid
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
for (const server of servers) {
|
||||||
|
const video = await server.videos.get({ id: videoUUID })
|
||||||
|
|
||||||
|
expect(video.name).to.equal('E2E tests')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
await cleanupTests(servers)
|
await cleanupTests(servers)
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,6 +2,9 @@ import { stat } from 'fs-extra'
|
||||||
import { basename, isAbsolute, join, resolve } from 'path'
|
import { basename, isAbsolute, join, resolve } from 'path'
|
||||||
|
|
||||||
const FIXTURE_URLS = {
|
const FIXTURE_URLS = {
|
||||||
|
peertube_long: 'https://peertube2.cpy.re/videos/watch/122d093a-1ede-43bd-bd34-59d2931ffc5e',
|
||||||
|
peertube_short: 'https://peertube2.cpy.re/w/3fbif9S3WmtTP8gGsC5HBd',
|
||||||
|
|
||||||
youtube: 'https://www.youtube.com/watch?v=msX3jv1XdvM',
|
youtube: 'https://www.youtube.com/watch?v=msX3jv1XdvM',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue