import express from 'express'
import { join } from 'path'
+import { ffprobePromise } from '@server/helpers/ffprobe-utils'
import { buildLogger } from '@server/helpers/logger'
import { CONFIG } from '@server/initializers/config'
import { WEBSERVER } from '@server/initializers/constants'
})
},
+ ffprobe: (path: string) => {
+ return ffprobePromise(path)
+ },
+
getFiles: async (id: number | string) => {
const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(id)
if (!video) return undefined
return res.json(details)
})
+
+ router.get('/ffprobe', async (req, res) => {
+ const result = await peertubeHelpers.videos.ffprobe(req.query.path)
+ if (!result) return res.sendStatus(404)
+
+ return res.json(result)
+ })
}
}
describe('Videos', function () {
let videoUUID: string
+ let videoPath: string
before(async () => {
this.timeout(240000)
await makeRawRequest(file.url, HttpStatusCode.OK_200)
}
}
+
+ videoPath = body.webtorrent.videoFiles[0].path
}
// Thumbnails check
}
})
+ it('Should probe a file', async function () {
+ const { body } = await makeGetRequest({
+ url: servers[0].url,
+ path: '/plugins/test-four/router/ffprobe',
+ query: {
+ path: videoPath
+ },
+ expectedStatus: HttpStatusCode.OK_200
+ })
+
+ expect(body.streams).to.be.an('array')
+ expect(body.streams).to.have.lengthOf(2)
+ })
+
it('Should remove a video after a view', async function () {
this.timeout(40000)
removeVideo: (videoId: number) => Promise<void>
+ ffprobe: (path: string) => Promise<any>
+
getFiles: (id: number | string) => Promise<{
webtorrent: {
videoFiles: {