mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Fix video file storage attribute
This commit is contained in:
parent
27bf92235f
commit
1870626af5
@ -190,6 +190,8 @@ export async function completeCheckHlsPlaylist (options: {
|
|||||||
|
|
||||||
for (const server of options.servers) {
|
for (const server of options.servers) {
|
||||||
const videoDetails = await server.videos.getWithToken({ id: videoUUID })
|
const videoDetails = await server.videos.getWithToken({ id: videoUUID })
|
||||||
|
const isOrigin = videoDetails.account.host === server.host
|
||||||
|
|
||||||
const requiresAuth = videoDetails.privacy.id === VideoPrivacy.PRIVATE || videoDetails.privacy.id === VideoPrivacy.INTERNAL
|
const requiresAuth = videoDetails.privacy.id === VideoPrivacy.PRIVATE || videoDetails.privacy.id === VideoPrivacy.INTERNAL
|
||||||
|
|
||||||
const privatePath = requiresAuth
|
const privatePath = requiresAuth
|
||||||
@ -221,25 +223,27 @@ export async function completeCheckHlsPlaylist (options: {
|
|||||||
expect(file.resolution.label).to.equal('Audio only')
|
expect(file.resolution.label).to.equal('Audio only')
|
||||||
expect(file.hasAudio).to.be.true
|
expect(file.hasAudio).to.be.true
|
||||||
expect(file.hasVideo).to.be.false
|
expect(file.hasVideo).to.be.false
|
||||||
|
|
||||||
|
expect(file.height).to.equal(0)
|
||||||
|
expect(file.width).to.equal(0)
|
||||||
} else {
|
} else {
|
||||||
expect(file.resolution.label).to.equal(resolution + 'p')
|
expect(file.resolution.label).to.equal(resolution + 'p')
|
||||||
|
|
||||||
expect(file.hasVideo).to.be.true
|
expect(file.hasVideo).to.be.true
|
||||||
expect(file.hasAudio).to.equal(hasAudio && !splittedAudio)
|
expect(file.hasAudio).to.equal(hasAudio && !splittedAudio)
|
||||||
}
|
|
||||||
|
|
||||||
if (resolution === 0) {
|
|
||||||
expect(file.height).to.equal(0)
|
|
||||||
expect(file.width).to.equal(0)
|
|
||||||
} else {
|
|
||||||
expect(Math.min(file.height, file.width)).to.equal(resolution)
|
expect(Math.min(file.height, file.width)).to.equal(resolution)
|
||||||
expect(Math.max(file.height, file.width)).to.be.greaterThan(resolution)
|
expect(Math.max(file.height, file.width)).to.be.greaterThan(resolution)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objectStorageBaseUrl) {
|
if (isOrigin) {
|
||||||
expect(file.storage).to.equal(FileStorage.OBJECT_STORAGE)
|
if (objectStorageBaseUrl) {
|
||||||
|
expect(file.storage).to.equal(FileStorage.OBJECT_STORAGE)
|
||||||
|
} else {
|
||||||
|
expect(file.storage).to.equal(FileStorage.FILE_SYSTEM)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
expect(file.storage).to.equal(FileStorage.FILE_SYSTEM)
|
expect(file.storage).to.be.null
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(file.magnetUri).to.have.lengthOf.above(2)
|
expect(file.magnetUri).to.have.lengthOf.above(2)
|
||||||
|
@ -64,10 +64,14 @@ export async function completeWebVideoFilesCheck (options: {
|
|||||||
expect(file.id).to.exist
|
expect(file.id).to.exist
|
||||||
expect(file.magnetUri).to.have.lengthOf.above(2)
|
expect(file.magnetUri).to.have.lengthOf.above(2)
|
||||||
|
|
||||||
if (objectStorageBaseUrl) {
|
if (server.internalServerNumber === originServer.internalServerNumber) {
|
||||||
expect(file.storage).to.equal(FileStorage.OBJECT_STORAGE)
|
if (objectStorageBaseUrl) {
|
||||||
|
expect(file.storage).to.equal(FileStorage.OBJECT_STORAGE)
|
||||||
|
} else {
|
||||||
|
expect(file.storage).to.equal(FileStorage.FILE_SYSTEM)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
expect(file.storage).to.equal(FileStorage.FILE_SYSTEM)
|
expect(file.storage).to.be.null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getResolutionLabel } from '@peertube/peertube-core-utils'
|
||||||
import {
|
import {
|
||||||
Video,
|
Video,
|
||||||
VideoAdditionalAttributes,
|
VideoAdditionalAttributes,
|
||||||
@ -25,7 +26,6 @@ import {
|
|||||||
import { MServer, MStreamingPlaylistRedundanciesOpt, MVideoFormattable, MVideoFormattableDetails } from '../../../types/models/index.js'
|
import { MServer, MStreamingPlaylistRedundanciesOpt, MVideoFormattable, MVideoFormattableDetails } from '../../../types/models/index.js'
|
||||||
import { MVideoFileRedundanciesOpt } from '../../../types/models/video/video-file.js'
|
import { MVideoFileRedundanciesOpt } from '../../../types/models/video/video-file.js'
|
||||||
import { sortByResolutionDesc } from './shared/index.js'
|
import { sortByResolutionDesc } from './shared/index.js'
|
||||||
import { getResolutionLabel } from '@peertube/peertube-core-utils'
|
|
||||||
|
|
||||||
export type VideoFormattingJSONOptions = {
|
export type VideoFormattingJSONOptions = {
|
||||||
completeDescription?: boolean
|
completeDescription?: boolean
|
||||||
@ -260,7 +260,9 @@ export function videoFilesModelToFormattedJSON (
|
|||||||
hasAudio: videoFile.hasAudio(),
|
hasAudio: videoFile.hasAudio(),
|
||||||
hasVideo: videoFile.hasVideo(),
|
hasVideo: videoFile.hasVideo(),
|
||||||
|
|
||||||
storage: videoFile.storage
|
storage: video.remote
|
||||||
|
? null
|
||||||
|
: videoFile.storage
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user